summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-16 10:35:07 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-16 10:35:07 +0200
commitada984facf47465b7a081eaf75d5541110c12f60 (patch)
treeebf09e32018e76a20df35e49965e15f8235cd6e2 /source/cWorld.cpp
parentLua binding for cVine fixed (diff)
downloadcuberite-ada984facf47465b7a081eaf75d5541110c12f60.tar
cuberite-ada984facf47465b7a081eaf75d5541110c12f60.tar.gz
cuberite-ada984facf47465b7a081eaf75d5541110c12f60.tar.bz2
cuberite-ada984facf47465b7a081eaf75d5541110c12f60.tar.lz
cuberite-ada984facf47465b7a081eaf75d5541110c12f60.tar.xz
cuberite-ada984facf47465b7a081eaf75d5541110c12f60.tar.zst
cuberite-ada984facf47465b7a081eaf75d5541110c12f60.zip
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;
}