summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormgueydan <gueydan.mathieuÃ@gmail.com>2013-09-08 12:04:20 +0200
committermgueydan <gueydan.mathieuÃ@gmail.com>2013-09-08 12:04:20 +0200
commite6e85168bc1462f66011096fb28f9899b9743d6b (patch)
treedeefb1e660bbb4d615cb9b4e36a0c3a2cdbfeeb8 /source
parentrenaming the cChunk::getRandomBlock method + removing a buggy working log (diff)
downloadcuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.tar
cuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.tar.gz
cuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.tar.bz2
cuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.tar.lz
cuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.tar.xz
cuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.tar.zst
cuberite-e6e85168bc1462f66011096fb28f9899b9743d6b.zip
Diffstat (limited to '')
-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);