mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-08 18:13:52 +00:00
fix(zone): drop out-of-range tile coords on manifest load
WoW's tile grid is 64x64. A tile (200,200) entry would generate an ADT filename the loader rejects and silently leave the zone with no terrain. Drop bad entries instead.
This commit is contained in:
parent
4a98dd7a2c
commit
bc1839d9ab
1 changed files with 9 additions and 2 deletions
|
|
@ -95,8 +95,15 @@ bool ZoneManifest::load(const std::string& path) {
|
||||||
tiles.clear();
|
tiles.clear();
|
||||||
if (j.contains("tiles") && j["tiles"].is_array()) {
|
if (j.contains("tiles") && j["tiles"].is_array()) {
|
||||||
for (const auto& t : j["tiles"]) {
|
for (const auto& t : j["tiles"]) {
|
||||||
if (t.is_array() && t.size() >= 2)
|
if (t.is_array() && t.size() >= 2) {
|
||||||
tiles.push_back({t[0].get<int>(), t[1].get<int>()});
|
int tx = t[0].get<int>();
|
||||||
|
int ty = t[1].get<int>();
|
||||||
|
// WoW tile grid is 64x64. Out-of-range coords would
|
||||||
|
// generate ADT filenames the loader rejects, leaving
|
||||||
|
// the zone with no terrain.
|
||||||
|
if (tx < 0 || tx > 63 || ty < 0 || ty > 63) continue;
|
||||||
|
tiles.push_back({tx, ty});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue