From cb640ffea4a51a10db2e379ada8dc0487378ba09 Mon Sep 17 00:00:00 2001 From: bibo38 Date: Wed, 12 Oct 2016 14:38:45 +0200 Subject: Spectators added (#2852) --- src/Chunk.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Chunk.cpp') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 508fe355e..28a7c7272 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -2051,13 +2051,22 @@ bool cChunk::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_ bool cChunk::DoWithEntityByID(UInt32 a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult) +{ + return DoWithEntityByID(a_EntityID, std::bind(&cEntityCallback::Item, &a_Callback, std::placeholders::_1), a_CallbackResult); +} + + + + + +bool cChunk::DoWithEntityByID(UInt32 a_EntityID, cLambdaEntityCallback a_Callback, bool & a_CallbackResult) { // The entity list is locked by the parent chunkmap's CS for (cEntityList::iterator itr = m_Entities.begin(), end = m_Entities.end(); itr != end; ++itr) { if (((*itr)->GetUniqueID() == a_EntityID) && ((*itr)->IsTicking())) { - a_CallbackResult = a_Callback.Item(*itr); + a_CallbackResult = a_Callback(*itr); return true; } } // for itr - m_Entitites[] -- cgit v1.2.3