mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
fix(editor): NaN-safe baseHeight propagation in addAdjacentTile
Source tile's chunks[0].position[2] could be NaN if mid-edit terrain hadn't run stitchEdges yet. Fall back to 100.0 so the adjacent tile doesn't start with poisoned base.
This commit is contained in:
parent
b7e3266c7a
commit
eb251639cf
1 changed files with 5 additions and 1 deletions
|
|
@ -1514,7 +1514,11 @@ void EditorApp::addAdjacentTile(int offsetX, int offsetY) {
|
|||
int newY = loadedTileY_ + offsetY;
|
||||
if (newX < 0 || newX > 63 || newY < 0 || newY > 63) return;
|
||||
|
||||
auto adj = TerrainEditor::createBlankTerrain(newX, newY, terrain_.chunks[0].position[2],
|
||||
// Source base height could be NaN if mid-edit terrain hadn't stitched —
|
||||
// fall back to a safe default so the new tile starts clean.
|
||||
float baseHeight = terrain_.chunks[0].position[2];
|
||||
if (!std::isfinite(baseHeight)) baseHeight = 100.0f;
|
||||
auto adj = TerrainEditor::createBlankTerrain(newX, newY, baseHeight,
|
||||
Biome::Grassland);
|
||||
|
||||
// Stitch edge heights from current tile to adjacent tile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue