GridPoint and GridPointState Python objects now store (grid, x, y) coordinates instead of raw C++ pointers. Data addresses are computed on each property access, preventing dangling pointers after vector resizes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a12e035a71
commit
115e16f4f2
5 changed files with 182 additions and 61 deletions
|
|
@ -22,16 +22,15 @@ class UIGridPointState;
|
|||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
UIGridPoint* data;
|
||||
std::shared_ptr<UIGrid> grid;
|
||||
int x, y; // Grid coordinates - compute data pointer on access
|
||||
} PyUIGridPointObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
UIGridPointState* data;
|
||||
std::shared_ptr<UIGrid> grid;
|
||||
std::shared_ptr<UIEntity> entity;
|
||||
int x, y; // Position in grid (needed for .point property)
|
||||
int x, y; // Position in grid - compute state on access
|
||||
} PyUIGridPointStateObject;
|
||||
|
||||
// UIGridPoint - grid cell data for pathfinding and layer access
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue