From 59f46353091ef3a453193ea3d74dd712bb0acf38 Mon Sep 17 00:00:00 2001 From: mgueydan Date: Mon, 9 Sep 2013 18:45:39 +0200 Subject: replacing dynamic_cast by c-style cast --- source/Chunk.cpp | 15 ++++----------- 1 file 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(**itr); - currentPosition = Monster.GetPosition(); - for (std::list::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_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[] -- cgit v1.2.3