diff options
author | mgueydan <gueydan.mathieuÃ@gmail.com> | 2013-09-09 18:45:39 +0200 |
---|---|---|
committer | mgueydan <gueydan.mathieuÃ@gmail.com> | 2013-09-09 18:45:39 +0200 |
commit | 59f46353091ef3a453193ea3d74dd712bb0acf38 (patch) | |
tree | 1fae40661ab137ef94c97777f2b99f5b945742d6 /source | |
parent | replacing C-style cast by dynamic_cast (diff) | |
download | cuberite-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 |
Diffstat (limited to 'source')
-rw-r--r-- | source/Chunk.cpp | 15 |
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[] |