Skip to content

fix: Spawn removal and Optimize creature checks - #866

Open
jprzimba wants to merge 2 commits into
mainfrom
fix-checkcreatures
Open

fix: Spawn removal and Optimize creature checks#866
jprzimba wants to merge 2 commits into
mainfrom
fix-checkcreatures

Conversation

@jprzimba

@jprzimba jprzimba commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Return immediately after removing NPCs/Monsters that can't spawn to avoid continuing logic. Rework creature-check machinery: add checkCreatureSizes, reserve bucket capacity when queuing creatures to reduce reallocations, and replace std::erase_if with a manual compacting loop in checkCreatures. The new loop skips empty buckets early, schedules delayed monster attack work as before, compacts live entries in-place (writeIndex), clears inCheckCreaturesVector for removed entries, resizes/shrinks buckets heuristically, and updates tracked sizes. Changes reduce memory churn and prevent potential use-after-processing after removal.

jprzimba and others added 2 commits August 5, 2026 15:36
Return immediately after removing NPCs/Monsters that can't spawn to avoid continuing logic. Rework creature-check machinery: add checkCreatureSizes, reserve bucket capacity when queuing creatures to reduce reallocations, and replace std::erase_if with a manual compacting loop in checkCreatures. The new loop skips empty buckets early, schedules delayed monster attack work as before, compacts live entries in-place (writeIndex), clears inCheckCreaturesVector for removed entries, resizes/shrinks buckets heuristically, and updates tracked sizes. Changes reduce memory churn and prevent potential use-after-processing after removal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant