Repository navigation
'3dveins': fix failure on embarks that cross midmap tiles - #5913
Merged
Merged
Conversation
MapCache assumed that map block `region_offset` values index the biome neighborhood of the map's anchor region (region_x/16). They actually index the neighborhood of each block's own region_pos, so blocks in other midmap cells resolved their biomes to the wrong region. On such embarks 3dveins compared layer thicknesses against the wrong geobiome spec and aborted with "Layer height change" errors. The MapCache biome list now covers the neighborhood of every midmap cell that the map touches, and biomeIndexAt resolves the biome through the block's own region_pos. Maps::getBiomeRgnPos is exported for this; it was already used internally by getBlockTileBiomeRgn and ReadGeology. Fixes DFHack#5880
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MapCachebuiltbiomes[]as a fixed 3x3 neighborhood anchored atregion_x/16and indexed it directly withmap_block.region_offset.region_offsetis actually relative to each block's ownregion_pos, so on embarks that span multiple midmap cells, blocks outside the anchor cell resolved their biomes to the wrong world region.3dveinsthen compared measured layer heights against the wrong geobiome spec and aborted withLayer height change ... instead of ...on such embarks.biomes[]now covers the union of neighborhoods around every midmap cell the map touches, with abiome_indexmap from world region coords to slots.Block::biomeIndexAtresolves the offset throughblock->region_pos, matchingMaps::getBlockTileBiomeRgn,probe, andchangelayer.Maps::getBiomeRgnPos(previously an internal helper used bygetBlockTileBiomeRgn/ReadGeology), now also guardingworld_dataand the index range.Testing
3dveinsaborted withLayer height change in layer 5 at (144 0 112): 3 instead of 4on the old build.Maps::getTileBiomeRgnagrees with the corrected resolution.3dveinsstill completes normally.prospector(heavy MapCache consumer) smoke-tested on the crossing embark.Fixes #5880