Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::ecs::NavPath Struct Reference

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().
 

Detailed Description

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.

Member Function Documentation

◆ update()

bool aegis2d::ecs::NavPath::update ( const NavGrid &  grid)
inline

Finds the path again if the grid changed since the last time.

Parameters
gridGrid to walk.
Returns
true if the path was found again.

Member Data Documentation

◆ from

Cell aegis2d::ecs::NavPath::from {}

Start cell.

◆ points

std::vector<Vec2> aegis2d::ecs::NavPath::points {}

Centers of the path's cells, empty when there is no path.

◆ to

Cell aegis2d::ecs::NavPath::to {}

End cell.

◆ version

std::uint64_t aegis2d::ecs::NavPath::version = 0

NavGrid::version() the points were found for; 0 before the first update().


The documentation for this struct was generated from the following file: