McRogueFace/roguelike_tutorial
John McCardle b5eab85e70 Convert UIGrid perspective from index to weak_ptr<UIEntity>
Major refactor of the perspective system to use entity references instead of indices:

- Replaced `int perspective` with `std::weak_ptr<UIEntity> perspective_entity`
- Added `bool perspective_enabled` flag for explicit control
- Direct entity assignment: `grid.perspective = player`
- Automatic cleanup when entity is destroyed (weak_ptr becomes invalid)
- No issues with collection reordering or entity removal
- PythonObjectCache integration preserves Python derived classes

API changes:
- Old: `grid.perspective = 0` (index), `-1` for omniscient
- New: `grid.perspective = entity` (object), `None` to clear
- New: `grid.perspective_enabled` controls rendering mode

Three rendering states:
1. `perspective_enabled = False`: Omniscient view (default)
2. `perspective_enabled = True` with valid entity: Entity's FOV
3. `perspective_enabled = True` with invalid entity: All black

Also includes:
- Part 3: Procedural dungeon generation with libtcod.line()
- Part 4: Field of view with entity perspective switching

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 23:47:21 -04:00
..
mcrogueface_does_the_entire_tutorial_2025 draft lessons 2025-07-10 00:14:56 -04:00
part_0.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
part_1.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
part_1b.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
part_2-naive.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
part_2-onemovequeued.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
part_2.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
part_3.py Convert UIGrid perspective from index to weak_ptr<UIEntity> 2025-07-21 23:47:21 -04:00
part_4.py Convert UIGrid perspective from index to weak_ptr<UIEntity> 2025-07-21 23:47:21 -04:00
tutorial2.png Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
tutorial_hero.png Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00