From 008addf5d746b2d158f9116e4f6302861b42852f Mon Sep 17 00:00:00 2001 From: faketruth Date: Thu, 16 Feb 2012 17:20:28 +0000 Subject: Got rid of dangerous GetEntity(), not using DoWithEntity() git-svn-id: http://mc-server.googlecode.com/svn/trunk@278 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWorld.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/cWorld.cpp') diff --git a/source/cWorld.cpp b/source/cWorld.cpp index 8e95b5bd5..fc6941250 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -1168,18 +1168,17 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer) -// TODO: This interface is dangerous! -cEntity * cWorld::GetEntity( int a_UniqueID ) +bool cWorld::DoWithEntity( int a_UniqueID, cEntityCallback & a_Callback ) { cCSLock Lock(m_CSEntities); for (cEntityList::iterator itr = m_AllEntities.begin(); itr != m_AllEntities.end(); ++itr ) { if( (*itr)->GetUniqueID() == a_UniqueID ) { - return *itr; + return a_Callback.Item(*itr); } - } - return NULL; + } // for itr - m_AllEntities[] + return false; } -- cgit v1.2.3