fix(wot): clamp liquid type to known range on load

WoW liquid types are 0=water/1=ocean/2=magma/3=slime. A user-edited
WOT could carry an out-of-range value that the editor renderer
silently maps to plain water but the server treats as undefined.
This commit is contained in:
Kelsi 2026-05-06 07:09:48 -07:00
parent 1c1250a37c
commit ed749b9afa

View file

@ -137,6 +137,10 @@ bool WoweeTerrainLoader::loadMetadata(const std::string& wotPath, ADTTerrain& te
if (wci < 0 || wci >= 256) continue;
ADTTerrain::WaterLayer wl;
wl.liquidType = w.value("type", 0u);
// Known WoW liquid types: 0=water, 1=ocean, 2=magma, 3=slime.
// Out-of-range values would default to plain water in render
// but might break server-side liquid behaviour.
if (wl.liquidType > 3) wl.liquidType = 0;
wl.maxHeight = w.value("height", 0.0f);
// NaN water height would produce NaN vertex positions and
// a degenerate GPU draw, or crash the water mesh build.