summaryrefslogtreecommitdiffstats
path: root/source/MobProximityCounter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/MobProximityCounter.cpp')
-rw-r--r--source/MobProximityCounter.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/MobProximityCounter.cpp b/source/MobProximityCounter.cpp
index 59979fa10..e0b7f34cb 100644
--- a/source/MobProximityCounter.cpp
+++ b/source/MobProximityCounter.cpp
@@ -14,12 +14,18 @@ void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, doubl
{
sDistanceAndChunk newDistanceAndChunck(a_Distance,a_Chunk);
std::pair<tMonsterToDistance::iterator,bool> result = m_MonsterToDistance.insert(tMonsterToDistance::value_type(&a_Monster,newDistanceAndChunck));
- assert(result.second);
+ if (!result.second)
+ {
+ ASSERT("A collected Monster was not found inside distance map using find(), but insert() said there already is a key for it");
+ }
}
else
{
- it->second.m_Distance = a_Distance;
- it->second.m_Chunk = a_Chunk;
+ if (a_Distance < it->second.m_Distance)
+ {
+ it->second.m_Distance = a_Distance;
+ it->second.m_Chunk = a_Chunk;
+ }
}
m_EligibleForSpawnChunks.insert(&a_Chunk);