summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cWorld.cpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 82243a8a9..0616fcf44 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -1602,14 +1602,32 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer)
-bool cWorld::DoWithEntity( int a_UniqueID, cEntityCallback & a_Callback )
+void cWorld::RemoveEntityFromChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkY, int a_ChunkZ)
+{
+ m_ChunkMap->RemoveEntityFromChunk(a_Entity, a_ChunkX, a_ChunkY, a_ChunkZ);
+}
+
+
+
+
+
+void cWorld::MoveEntityToChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkY, int a_ChunkZ)
+{
+ m_ChunkMap->MoveEntityToChunk(a_Entity, a_ChunkX, a_ChunkY, a_ChunkZ);
+}
+
+
+
+
+
+bool cWorld::ForEachEntity(cEntityCallback & a_Callback)
{
cCSLock Lock(m_CSEntities);
for (cEntityList::iterator itr = m_AllEntities.begin(); itr != m_AllEntities.end(); ++itr )
{
- if( (*itr)->GetUniqueID() == a_UniqueID )
+ if (a_Callback.Item(*itr))
{
- return a_Callback.Item(*itr);
+ return false;
}
} // for itr - m_AllEntities[]
return false;
@@ -1619,18 +1637,26 @@ bool cWorld::DoWithEntity( int a_UniqueID, cEntityCallback & a_Callback )
-void cWorld::RemoveEntityFromChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkY, int a_ChunkZ)
+bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback)
{
- m_ChunkMap->RemoveEntityFromChunk(a_Entity, a_ChunkX, a_ChunkY, a_ChunkZ);
+ return m_ChunkMap->ForEachEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
-void cWorld::MoveEntityToChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkY, int a_ChunkZ)
+bool cWorld::DoWithEntityByID( int a_UniqueID, cEntityCallback & a_Callback )
{
- m_ChunkMap->MoveEntityToChunk(a_Entity, a_ChunkX, a_ChunkY, a_ChunkZ);
+ cCSLock Lock(m_CSEntities);
+ for (cEntityList::iterator itr = m_AllEntities.begin(); itr != m_AllEntities.end(); ++itr )
+ {
+ if( (*itr)->GetUniqueID() == a_UniqueID )
+ {
+ return a_Callback.Item(*itr);
+ }
+ } // for itr - m_AllEntities[]
+ return false;
}