mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
fix(npc): cap spawn count at 50k on load
Same defense pattern as QuestEditor (4096) and ObjectPlacer (100k). A stale autosave or scatter-runaway could carry millions of NPCs; each emits creature_template + creature + optional addon/waypoint rows, drowning the SQL output and the M2 marker mesh. Every editor JSON loader now has a matched-to-cost upper bound (NPCs 50k, quests 4k, objects 100k, waypoints 256).
This commit is contained in:
parent
49a2907bc5
commit
bd97470929
1 changed files with 10 additions and 0 deletions
|
|
@ -154,7 +154,17 @@ bool NpcSpawner::loadFromFile(const std::string& path) {
|
|||
selectedIdx_ = -1;
|
||||
idCounter_ = 1;
|
||||
|
||||
// Cap NPC count — same defense pattern as QuestEditor / ObjectPlacer.
|
||||
// 50k creatures is generous; each emits a creature_template +
|
||||
// creature INSERT, plus optional addon/waypoint rows.
|
||||
constexpr size_t kMaxSpawns = 50'000;
|
||||
|
||||
for (const auto& js : arr) {
|
||||
if (spawns_.size() >= kMaxSpawns) {
|
||||
LOG_WARNING("NPC cap reached (", kMaxSpawns,
|
||||
") — remaining entries dropped");
|
||||
break;
|
||||
}
|
||||
CreatureSpawn s;
|
||||
s.name = js.value("name", "");
|
||||
s.modelPath = js.value("model", "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue