summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-08 19:57:04 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-08 19:57:04 +0100
commita204e3325010fd7baa8f30a5b05e3ba8450a73c7 (patch)
treef2ce933d000a1294c67cb92ab300ffd2aa56a7f8 /source/cWorld.cpp
parentcPluginManager: slight cleanup (diff)
downloadcuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.tar
cuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.tar.gz
cuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.tar.bz2
cuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.tar.lz
cuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.tar.xz
cuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.tar.zst
cuberite-a204e3325010fd7baa8f30a5b05e3ba8450a73c7.zip
Diffstat (limited to '')
-rw-r--r--source/cWorld.cpp110
1 files changed, 108 insertions, 2 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index ba103c906..00dcbd80e 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -945,17 +945,29 @@ void cWorld::SetMaxPlayers(int iMax)
}
}
+
+
+
+
void cWorld::AddPlayer( cPlayer* a_Player )
{
m_pState->Players.remove( a_Player );
m_pState->Players.push_back( a_Player );
}
+
+
+
+
void cWorld::RemovePlayer( cPlayer* a_Player )
{
m_pState->Players.remove( a_Player );
}
+
+
+
+
void cWorld::GetAllPlayers( lua_State* L )
{
lua_createtable(L, m_pState->Players.size(), 0);
@@ -970,6 +982,10 @@ void cWorld::GetAllPlayers( lua_State* L )
}
}
+
+
+
+
cPlayer* cWorld::GetPlayer( const char* a_PlayerName )
{
cPlayer* BestMatch = 0;
@@ -1034,6 +1050,10 @@ cEntity* cWorld::GetEntity( int a_UniqueID )
return 0;
}
+
+
+
+
// void cWorld::RemoveClient( cClientHandle* a_Client )
// {
// m_pState->m_Clients.remove( a_Client );
@@ -1044,6 +1064,10 @@ cEntity* cWorld::GetEntity( int a_UniqueID )
// }
// }
+
+
+
+
void cWorld::RemoveEntity( cEntity* a_Entity )
{
m_pState->RemoveEntityQueue.remove( a_Entity );
@@ -1054,6 +1078,10 @@ void cWorld::RemoveEntity( cEntity* a_Entity )
}
}
+
+
+
+
bool cWorld::RemoveEntityFromChunk( cEntity & a_Entity, cChunk* a_CalledFrom /* = 0 */ )
{
LockChunks();
@@ -1062,6 +1090,10 @@ bool cWorld::RemoveEntityFromChunk( cEntity & a_Entity, cChunk* a_CalledFrom /*
return retVal;
}
+
+
+
+
void cWorld::SaveAllChunks()
{
LOG("Saving all chunks...");
@@ -1072,36 +1104,64 @@ void cWorld::SaveAllChunks()
LOG("Done saving chunks");
}
+
+
+
+
void cWorld::LockClientHandle()
{
m_ClientHandleCriticalSection->Lock();
}
+
+
+
+
void cWorld::UnlockClientHandle()
{
m_ClientHandleCriticalSection->Unlock();
}
+
+
+
+
void cWorld::LockEntities()
{
m_EntitiesCriticalSection->Lock();
}
+
+
+
+
void cWorld::UnlockEntities()
{
m_EntitiesCriticalSection->Unlock();
}
+
+
+
+
void cWorld::LockChunks()
{
m_ChunksCriticalSection->Lock();
}
+
+
+
+
void cWorld::UnlockChunks()
{
m_ChunksCriticalSection->Unlock();
}
+
+
+
+
void cWorld::ReSpreadLighting( const ptr_cChunk& a_Chunk )
{
LockChunks();
@@ -1112,6 +1172,10 @@ void cWorld::ReSpreadLighting( const ptr_cChunk& a_Chunk )
UnlockChunks();
}
+
+
+
+
void cWorld::RemoveSpread( const ptr_cChunk& a_Chunk )
{
LockChunks();
@@ -1120,6 +1184,9 @@ void cWorld::RemoveSpread( const ptr_cChunk& a_Chunk )
}
+
+
+
/************************************************************************/
/* Get and set */
/************************************************************************/
@@ -1131,35 +1198,74 @@ void cWorld::RemoveSpread( const ptr_cChunk& a_Chunk )
// {
// return m_pState->m_Clients;
// }
+
+
+
+
+
cWorld::EntityList & cWorld::GetEntities()
{
return m_pState->AllEntities;
}
+
+
+
+
+
void cWorld::AddEntity( cEntity* a_Entity )
{
m_pState->AllEntities.push_back( a_Entity );
}
+
+
+
+
+
cWorld::PlayerList & cWorld::GetAllPlayers()
{
return m_pState->Players;
}
+
+
+
+
+
unsigned int cWorld::GetNumPlayers()
{
return m_pState->Players.size();
}
+
+
+
+
+
void cWorld::AddToRemoveEntityQueue( cEntity & a_Entity )
{
m_pState->AllEntities.remove( &a_Entity);
m_pState->RemoveEntityQueue.push_back( &a_Entity );
}
+
+
+
+
+
const char* cWorld::GetName()
{
return m_pState->WorldName.c_str();
}
-int cWorld::GetNumChunks()
+
+
+
+
+
+int cWorld::GetNumChunks(void)
{
LockChunks();
int NumChunks = m_ChunkMap->GetNumChunks();
UnlockChunks();
return NumChunks;
-} \ No newline at end of file
+}
+
+
+
+