mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
fix(project): cap zones at 1024 on project load
Same defense pattern as the other editor JSON loaders. WoW only supports 65535 maps total and the editor loads one tile at a time; 1024 zones per project is plenty. Stale autosave or hand- edit could otherwise grow zones unbounded and slow the project picker UI.
This commit is contained in:
parent
ffc0862977
commit
fc284c7460
1 changed files with 10 additions and 0 deletions
|
|
@ -55,7 +55,17 @@ bool EditorProject::load(const std::string& path) {
|
|||
|
||||
zones.clear();
|
||||
if (j.contains("zones") && j["zones"].is_array()) {
|
||||
// Cap project zones — same defense pattern as the other
|
||||
// editor JSON loaders. WoW only supports 65535 maps total
|
||||
// and the editor loads one tile at a time, so 1024 zones
|
||||
// per project is plenty.
|
||||
constexpr size_t kMaxZones = 1024;
|
||||
for (const auto& jz : j["zones"]) {
|
||||
if (zones.size() >= kMaxZones) {
|
||||
LOG_WARNING("Project zone cap reached (", kMaxZones,
|
||||
") — remaining entries dropped");
|
||||
break;
|
||||
}
|
||||
ProjectZone z;
|
||||
z.mapName = jz.value("mapName", "");
|
||||
z.tileX = jz.value("tileX", 32);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue