Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/helpers/LongPathfinder.cpp
Show First 20 Lines • Show All 714 Lines • ▼ Show 20 Lines | |||||
void LongPathfinder::ComputeJPSPath(const HierarchicalPathfinder& hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal& origGoal, pass_class_t passClass, WaypointPath& path) const | void LongPathfinder::ComputeJPSPath(const HierarchicalPathfinder& hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal& origGoal, pass_class_t passClass, WaypointPath& path) const | ||||
{ | { | ||||
PROFILE("ComputePathJPS"); | PROFILE("ComputePathJPS"); | ||||
PROFILE2_IFSPIKE("ComputePathJPS", 0.0002); | PROFILE2_IFSPIKE("ComputePathJPS", 0.0002); | ||||
PathfinderState state = { 0 }; | PathfinderState state = { 0 }; | ||||
std::map<pass_class_t, shared_ptr<JumpPointCache> >::const_iterator it = m_JumpPointCache.find(passClass); | std::map<pass_class_t, shared_ptr<JumpPointCache> >::const_iterator it = m_JumpPointCache.find(passClass); | ||||
if (it != m_JumpPointCache.end()) | |||||
state.jpc = it->second.get(); | state.jpc = it->second.get(); | ||||
if (m_UseJPSCache && !state.jpc) | if (m_UseJPSCache && !state.jpc) | ||||
{ | { | ||||
state.jpc = new JumpPointCache; | state.jpc = new JumpPointCache; | ||||
state.jpc->reset(m_Grid, passClass); | state.jpc->reset(m_Grid, passClass); | ||||
debug_printf("PATHFINDER: JPC memory: %d kB\n", (int)state.jpc->GetMemoryUsage() / 1024); | debug_printf("PATHFINDER: JPC memory: %d kB\n", (int)state.jpc->GetMemoryUsage() / 1024); | ||||
m_JumpPointCache[passClass] = shared_ptr<JumpPointCache>(state.jpc); | m_JumpPointCache[passClass] = shared_ptr<JumpPointCache>(state.jpc); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 314 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator