Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/helpers/HierarchicalPathfinder.cpp
Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | else if (!enabled && m_DebugOverlay) | ||||
m_SimContext = NULL; | m_SimContext = NULL; | ||||
} | } | ||||
} | } | ||||
void HierarchicalPathfinder::Recompute(Grid<NavcellData>* grid, | void HierarchicalPathfinder::Recompute(Grid<NavcellData>* grid, | ||||
const std::map<std::string, pass_class_t>& nonPathfindingPassClassMasks, | const std::map<std::string, pass_class_t>& nonPathfindingPassClassMasks, | ||||
const std::map<std::string, pass_class_t>& pathfindingPassClassMasks) | const std::map<std::string, pass_class_t>& pathfindingPassClassMasks) | ||||
{ | { | ||||
PROFILE3("Hierarchical Recompute"); | PROFILE2("Hierarchical Recompute"); | ||||
m_PassClassMasks = pathfindingPassClassMasks; | m_PassClassMasks = pathfindingPassClassMasks; | ||||
std::map<std::string, pass_class_t> allPassClasses = m_PassClassMasks; | std::map<std::string, pass_class_t> allPassClasses = m_PassClassMasks; | ||||
allPassClasses.insert(nonPathfindingPassClassMasks.begin(), nonPathfindingPassClassMasks.end()); | allPassClasses.insert(nonPathfindingPassClassMasks.begin(), nonPathfindingPassClassMasks.end()); | ||||
m_W = grid->m_W; | m_W = grid->m_W; | ||||
m_H = grid->m_H; | m_H = grid->m_H; | ||||
Show All 31 Lines | for (int cj = 0; cj < m_ChunksH; ++cj) | ||||
{ | { | ||||
FindEdges(ci, cj, passClass, edges); | FindEdges(ci, cj, passClass, edges); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (m_DebugOverlay) | if (m_DebugOverlay) | ||||
{ | { | ||||
PROFILE("debug overlay"); | |||||
m_DebugOverlayLines.clear(); | m_DebugOverlayLines.clear(); | ||||
AddDebugEdges(GetPassabilityClass("default")); | AddDebugEdges(GetPassabilityClass("default")); | ||||
} | } | ||||
} | } | ||||
void HierarchicalPathfinder::Update(Grid<NavcellData>* grid, const Grid<u8>& dirtinessGrid) | void HierarchicalPathfinder::Update(Grid<NavcellData>* grid, const Grid<u8>& dirtinessGrid) | ||||
{ | { | ||||
PROFILE3("Hierarchical Update"); | PROFILE3("Hierarchical Update"); | ||||
Show All 32 Lines | for (int cj = 0; cj < m_ChunksH; ++cj) | ||||
{ | { | ||||
FindEdges(ci, cj, passClass, edges); | FindEdges(ci, cj, passClass, edges); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (m_DebugOverlay) | if (m_DebugOverlay) | ||||
{ | { | ||||
PROFILE("debug overlay"); | |||||
m_DebugOverlayLines.clear(); | m_DebugOverlayLines.clear(); | ||||
AddDebugEdges(GetPassabilityClass("default")); | AddDebugEdges(GetPassabilityClass("default")); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Find edges between regions in this chunk and the adjacent below/left chunks. | * Find edges between regions in this chunk and the adjacent below/left chunks. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 320 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator