summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormgueydan <gueydan.mathieuÃ@gmail.com>2013-09-09 18:45:39 +0200
committermgueydan <gueydan.mathieuÃ@gmail.com>2013-09-09 18:45:39 +0200
commit59f46353091ef3a453193ea3d74dd712bb0acf38 (patch)
tree1fae40661ab137ef94c97777f2b99f5b945742d6
parentreplacing C-style cast by dynamic_cast (diff)
downloadcuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.tar
cuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.tar.gz
cuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.tar.bz2
cuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.tar.lz
cuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.tar.xz
cuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.tar.zst
cuberite-59f46353091ef3a453193ea3d74dd712bb0acf38.zip
-rw-r--r--source/Chunk.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 00010e806..21401163b 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -449,18 +449,11 @@ void cChunk::CollectMobCensus(cMobCensus& toFill)
//LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
if ((*itr)->IsMob())
{
- try
- {
- cMonster& Monster = dynamic_cast<cMonster&>(**itr);
- currentPosition = Monster.GetPosition();
- for (std::list<const Vector3d*>::const_iterator itr2 = playerPositions.begin(); itr2 != playerPositions.end(); itr2 ++)
- {
- toFill.CollectMob(Monster,*this,(currentPosition-**itr2).SqrLength());
- }
- }
- catch (std::bad_cast& e)
+ cMonster& Monster = (cMonster&)(**itr);
+ currentPosition = Monster.GetPosition();
+ for (std::list<const Vector3d*>::const_iterator itr2 = playerPositions.begin(); itr2 != playerPositions.end(); itr2 ++)
{
- LOGD("Something wrong happend I'm collecting an entity that respond 'true' to IsMob() but are not castable in cMonster - No Action");
+ toFill.CollectMob(Monster,*this,(currentPosition-**itr2).SqrLength());
}
}
} // for itr - m_Entitites[]