Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/helpers/HierarchicalPathfinder.h
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | public: | ||||
* the goal center. | * the goal center. | ||||
* | * | ||||
* In the case of a non-point reachable goal, it is replaced with a point goal | * In the case of a non-point reachable goal, it is replaced with a point goal | ||||
* at the reachable navcell of the goal which is nearest to the starting navcell. | * at the reachable navcell of the goal which is nearest to the starting navcell. | ||||
*/ | */ | ||||
void MakeGoalReachable(u16 i0, u16 j0, PathGoal& goal, pass_class_t passClass); | void MakeGoalReachable(u16 i0, u16 j0, PathGoal& goal, pass_class_t passClass); | ||||
/** | /** | ||||
* Updates @p i, @p j (which is assumed to be an impassable navcell) | * Updates @p i, @p j (which is assumed to be an impassable navcell) | ||||
Freagarach: -`.` | |||||
* to the nearest passable navcell. | * to the nearest passable navcell. | ||||
*/ | */ | ||||
void FindNearestPassableNavcell(u16& i, u16& j, pass_class_t passClass); | void FindNearestPassableNavcell(u16& i, u16& j, pass_class_t passClass); | ||||
/** | /** | ||||
* Generates the connectivity grid associated with the given pass_class | * Generates the connectivity grid associated with the given pass_class | ||||
*/ | */ | ||||
Grid<u16> GetConnectivityGrid(pass_class_t passClass); | Grid<u16> GetConnectivityGrid(pass_class_t passClass); | ||||
void FindReachableRegions(RegionID from, std::set<RegionID>& reachable, pass_class_t passClass); | |||||
pass_class_t GetPassabilityClass(const std::string& name) const | pass_class_t GetPassabilityClass(const std::string& name) const | ||||
{ | { | ||||
auto it = m_PassClassMasks.find(name); | auto it = m_PassClassMasks.find(name); | ||||
Not Done Inline ActionsIs there a reason why you moved this above? wraitii: Is there a reason why you moved this above? | |||||
Done Inline ActionsMaking it public. However, I don't need to use it if I use GetGlobalRegion. causative: Making it public. However, I don't need to use it if I use GetGlobalRegion. | |||||
if (it != m_PassClassMasks.end()) | if (it != m_PassClassMasks.end()) | ||||
return it->second; | return it->second; | ||||
LOGERROR("Invalid passability class name '%s'", name.c_str()); | LOGERROR("Invalid passability class name '%s'", name.c_str()); | ||||
return 0; | return 0; | ||||
} | } | ||||
private: | private: | ||||
Show All 18 Lines | struct Chunk | ||||
bool RegionNearestNavcellInGoal(u16 r, u16 i0, u16 j0, const PathGoal& goal, u16& iOut, u16& jOut, u32& dist2Best) const; | bool RegionNearestNavcellInGoal(u16 r, u16 i0, u16 j0, const PathGoal& goal, u16& iOut, u16& jOut, u32& dist2Best) const; | ||||
}; | }; | ||||
typedef std::map<RegionID, std::set<RegionID> > EdgesMap; | typedef std::map<RegionID, std::set<RegionID> > EdgesMap; | ||||
void FindEdges(u8 ci, u8 cj, pass_class_t passClass, EdgesMap& edges); | void FindEdges(u8 ci, u8 cj, pass_class_t passClass, EdgesMap& edges); | ||||
void FindReachableRegions(RegionID from, std::set<RegionID>& reachable, pass_class_t passClass); | |||||
void FindPassableRegions(std::set<RegionID>& regions, pass_class_t passClass); | void FindPassableRegions(std::set<RegionID>& regions, pass_class_t passClass); | ||||
/** | /** | ||||
* Updates @p iGoal and @p jGoal to the navcell that is the nearest to the | * Updates @p iGoal and @p jGoal to the navcell that is the nearest to the | ||||
* initial goal coordinates, in one of the given @p regions. | * initial goal coordinates, in one of the given @p regions. | ||||
* (Assumes @p regions is non-empty.) | * (Assumes @p regions is non-empty.) | ||||
*/ | */ | ||||
void FindNearestNavcellInRegions(const std::set<RegionID>& regions, u16& iGoal, u16& jGoal, pass_class_t passClass); | void FindNearestNavcellInRegions(const std::set<RegionID>& regions, u16& iGoal, u16& jGoal, pass_class_t passClass); | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
-.