Fix gridstate heap overflows and spatial hash cleanup
Add ensureGridstate() helper that unconditionally checks gridstate size against current grid dimensions and resizes if mismatched. Replace all lazy-init guards (size == 0) with ensureGridstate() calls. Previously, gridstate was only initialized when empty. When an entity moved to a differently-sized grid, gridstate kept the old size, causing heap buffer overflows when updateVisibility() or at() iterated using the new grid's dimensions. Also adds spatial_hash.remove() calls in set_grid() before removing entities from old grids, and replaces PyObject_GetAttrString type lookup with direct &mcrfpydef::PyUIGridType reference. Closes #258, closes #259, closes #260, closes #261, closes #262, closes #263, closes #274, closes #276, closes #278 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
08407e48e1
commit
348826a0f5
5 changed files with 203 additions and 130 deletions
|
|
@ -73,6 +73,7 @@ public:
|
|||
~UIEntity();
|
||||
|
||||
// Visibility methods
|
||||
void ensureGridstate(); // Resize gridstate to match current grid dimensions
|
||||
void updateVisibility(); // Update gridstate from current FOV
|
||||
|
||||
// Property system for animations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue