|
Aegis2D
Modular C++26 2D game engine for networked games
|
Path between two cells, found again only when the grid has changed. More...
#include <aegis2d/ecs/pathfinding.hpp>
Public Member Functions | |
| bool | update (const NavGrid &grid) |
| Finds the path again if the grid changed since the last time. | |
Public Attributes | |
| Cell | from {} |
| Start cell. | |
| Cell | to {} |
| End cell. | |
| std::vector< Vec2 > | points {} |
| Centers of the path's cells, empty when there is no path. | |
| std::uint64_t | version = 0 |
| NavGrid::version() the points were found for; 0 before the first update(). | |
Path between two cells, found again only when the grid has changed.
Set from and to and call update() each tick: it runs NavGrid::find_path() the first time and after each change of the grid, and does nothing otherwise. Set version back to 0 after changing from or to.
|
inline |
Finds the path again if the grid changed since the last time.
| grid | Grid to walk. |
true if the path was found again. | Cell aegis2d::ecs::NavPath::from {} |
Start cell.
| std::vector<Vec2> aegis2d::ecs::NavPath::points {} |
Centers of the path's cells, empty when there is no path.
| Cell aegis2d::ecs::NavPath::to {} |
End cell.
| std::uint64_t aegis2d::ecs::NavPath::version = 0 |
NavGrid::version() the points were found for; 0 before the first update().