mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
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:
parent
1c1250a37c
commit
ed749b9afa
1 changed files with 4 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue