BSP: add room adjacency graph for corridor generation (closes #210)
New features: - bsp.adjacency[i] returns tuple of neighbor leaf indices - bsp.get_leaf(index) returns BSPNode by leaf index (O(1) lookup) - node.leaf_index returns this leaf's index (0..n-1) or None - node.adjacent_tiles[j] returns tuple of Vector wall tiles bordering neighbor j Implementation details: - Lazy-computed adjacency cache with generation-based invalidation - O(n²) pairwise adjacency check on first access - Wall tiles computed per-direction (not symmetric) for correct perspective - Supports 'in' operator: `5 in leaf.adjacent_tiles` Code review fixes applied: - split_once now increments generation to invalidate cache - Wall tile cache uses (self, neighbor) key, not symmetric - Added sq_contains for 'in' operator support - Documented wall tile semantics (tiles on THIS leaf's boundary) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5a86602789
commit
8628ac164b
4 changed files with 1058 additions and 2 deletions
|
|
@ -441,6 +441,8 @@ PyObject* PyInit_mcrfpy()
|
|||
/*BSP internal types - returned by BSP methods but not directly instantiable*/
|
||||
&mcrfpydef::PyBSPNodeType,
|
||||
&mcrfpydef::PyBSPIterType,
|
||||
&mcrfpydef::PyBSPAdjacencyType, // #210: BSP.adjacency wrapper
|
||||
&mcrfpydef::PyBSPAdjacentTilesType, // #210: BSPNode.adjacent_tiles wrapper
|
||||
|
||||
nullptr};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue