mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
fix(editor): bound tile coords + NaN-guard baseHeight in createNewTerrain
Same defensive validation as loadADT — out-of-range tile coords would generate broken save paths. Also guards against a NaN baseHeight slider (would propagate into every terrain vertex).
This commit is contained in:
parent
d9d0797b7f
commit
891bb711a0
1 changed files with 6 additions and 0 deletions
|
|
@ -1038,6 +1038,12 @@ void EditorApp::loadADT(const std::string& mapName, int tileX, int tileY) {
|
|||
}
|
||||
|
||||
void EditorApp::createNewTerrain(const std::string& mapName, int tileX, int tileY, float baseHeight, Biome biome) {
|
||||
if (tileX < 0 || tileX > 63 || tileY < 0 || tileY > 63) {
|
||||
LOG_ERROR("createNewTerrain rejected: tile (", tileX, ",", tileY,
|
||||
") out of valid 0..63 range");
|
||||
return;
|
||||
}
|
||||
if (!std::isfinite(baseHeight)) baseHeight = 0.0f;
|
||||
terrain_ = TerrainEditor::createBlankTerrain(tileX, tileY, baseHeight, biome);
|
||||
// Clear all previous state
|
||||
clearAllObjects();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue