From 220449ea9a51199c330c26494aff3e317464dd5e Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 25 May 2019 16:01:44 +0000 Subject: [PATCH] JPS - make the JPC cache usable again (98f4ed6cb8 fix) Reviewed By: Itms Differential Revision: https://code.wildfiregames.com/D1875 This was SVN commit r22301. --- source/simulation2/helpers/LongPathfinder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/simulation2/helpers/LongPathfinder.cpp b/source/simulation2/helpers/LongPathfinder.cpp index 8f888606d9..aa6f202f50 100644 --- a/source/simulation2/helpers/LongPathfinder.cpp +++ b/source/simulation2/helpers/LongPathfinder.cpp @@ -719,7 +719,10 @@ void LongPathfinder::ComputeJPSPath(const HierarchicalPathfinder& hierPath, enti PROFILE2_IFSPIKE("ComputePathJPS", 0.0002); PathfinderState state = { 0 }; - if (m_UseJPSCache && m_JumpPointCache.find(passClass) == m_JumpPointCache.end()) + std::map >::const_iterator it = m_JumpPointCache.find(passClass); + state.jpc = it->second.get(); + + if (m_UseJPSCache && !state.jpc) { state.jpc = new JumpPointCache; state.jpc->reset(m_Grid, passClass);