Phase 1: Safety & performance foundation for Grid/Entity overhaul
- Fix Entity3D self-reference cycle: replace raw `self` pointer with `pyobject` strong-ref pattern matching UIEntity (closes #266) - TileLayer inherits Grid texture when none set, in all three attachment paths: constructor, add_layer(), and .grid property (closes #254) - Add SpatialHash::queryCell() for O(1) entity-at-cell lookup; fix missing spatial_hash.insert() in Entity.__init__ grid= kwarg path; use queryCell in GridPoint.entities (closes #253) - Add FOV dirty flag and parameter cache to skip redundant computeFOV calls when map unchanged and params match (closes #292) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
836a0584df
commit
94f5f5a3fd
13 changed files with 436 additions and 47 deletions
|
|
@ -33,6 +33,10 @@ public:
|
|||
// This removes from old bucket and inserts into new bucket if needed
|
||||
void update(std::shared_ptr<UIEntity> entity, float old_x, float old_y);
|
||||
|
||||
// Query all entities at a specific cell (exact integer position match)
|
||||
// O(n) where n = entities in the bucket containing this cell
|
||||
std::vector<std::shared_ptr<UIEntity>> queryCell(int x, int y) const;
|
||||
|
||||
// Query all entities within radius of a point
|
||||
// Returns entities whose positions are within the circular radius
|
||||
std::vector<std::shared_ptr<UIEntity>> queryRadius(float x, float y, float radius) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue