Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/helpers/LongPathfinder.h
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | |||||
class LongOverlay; | class LongOverlay; | ||||
class LongPathfinder | class LongPathfinder | ||||
{ | { | ||||
public: | public: | ||||
LongPathfinder(); | LongPathfinder(); | ||||
~LongPathfinder(); | ~LongPathfinder(); | ||||
#ifdef TEST | |||||
HierarchicalPathfinder& GetHierarchicalPathfinder() { return m_PathfinderHier; } | |||||
#endif | |||||
void SetDebugOverlay(bool enabled); | void SetDebugOverlay(bool enabled); | ||||
void SetHierDebugOverlay(bool enabled, const CSimContext *simContext) | void SetHierDebugOverlay(bool enabled, const CSimContext *simContext) | ||||
{ | { | ||||
m_PathfinderHier.SetDebugOverlay(enabled, simContext); | m_PathfinderHier.SetDebugOverlay(enabled, simContext); | ||||
} | } | ||||
void SetDebugPath(entity_pos_t x0, entity_pos_t z0, const PathGoal& goal, pass_class_t passClass) | void SetDebugPath(entity_pos_t x0, entity_pos_t z0, const PathGoal& goal, pass_class_t passClass) | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | #endif | ||||
* Compute a tile-based path from the given point to the goal, excluding the regions | * Compute a tile-based path from the given point to the goal, excluding the regions | ||||
* specified in excludedRegions (which are treated as impassable) and return the set of waypoints. | * specified in excludedRegions (which are treated as impassable) and return the set of waypoints. | ||||
* The waypoints correspond to the centers of horizontally/vertically adjacent tiles | * The waypoints correspond to the centers of horizontally/vertically adjacent tiles | ||||
* along the path. | * along the path. | ||||
*/ | */ | ||||
void ComputePath(entity_pos_t x0, entity_pos_t z0, const PathGoal& origGoal, | void ComputePath(entity_pos_t x0, entity_pos_t z0, const PathGoal& origGoal, | ||||
pass_class_t passClass, std::vector<CircularRegion> excludedRegions, WaypointPath& path); | pass_class_t passClass, std::vector<CircularRegion> excludedRegions, WaypointPath& path); | ||||
bool MakeGoalReachable(u16 i0, u16 j0, PathGoal &goal, pass_class_t passClass) { return m_PathfinderHier.MakeGoalReachable(i0, j0, goal, passClass); }; | |||||
void FindNearestPassableNavcell(u16& i, u16& j, pass_class_t passClass) { return m_PathfinderHier.FindNearestPassableNavcell(i, j, passClass); }; | |||||
bool NavcellIsReachable(u16 i0, u16 j0, u16 i1, u16 j1, pass_class_t passClass) | |||||
{ | |||||
return m_PathfinderHier.GetGlobalRegion(i0, j0, passClass) == m_PathfinderHier.GetGlobalRegion(i1, j1, passClass); | |||||
}; | |||||
Grid<u16> GetConnectivityGrid(pass_class_t passClass) | Grid<u16> GetConnectivityGrid(pass_class_t passClass) | ||||
{ | { | ||||
return m_PathfinderHier.GetConnectivityGrid(passClass); | return m_PathfinderHier.GetConnectivityGrid(passClass); | ||||
} | } | ||||
void GetDebugData(u32& steps, double& time, Grid<u8>& grid) const | void GetDebugData(u32& steps, double& time, Grid<u8>& grid) const | ||||
{ | { | ||||
GetDebugDataJPS(steps, time, grid); | GetDebugDataJPS(steps, time, grid); | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator