Proper entity removal functions

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1386 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-04-13 21:28:55 +00:00
parent a49c004278
commit f5842062d3
5 changed files with 32 additions and 56 deletions
+10 -10
View File
@@ -1722,7 +1722,7 @@ void cWorld::AddPlayer(cPlayer * a_Player)
void cWorld::RemovePlayer(cPlayer * a_Player)
{
m_ChunkMap->RemoveEntityFromChunk(a_Player, a_Player->GetChunkX(), a_Player->GetChunkZ());
m_ChunkMap->RemoveEntity(a_Player);
cCSLock Lock(m_CSPlayers);
m_Players.remove(a_Player);
}
@@ -1853,15 +1853,6 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer)
void cWorld::RemoveEntityFromChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkZ)
{
m_ChunkMap->RemoveEntityFromChunk(a_Entity, a_ChunkX, a_ChunkZ);
}
bool cWorld::ForEachEntity(cEntityCallback & a_Callback)
{
return m_ChunkMap->ForEachEntity(a_Callback);
@@ -2084,6 +2075,15 @@ bool cWorld::HasEntity(int a_UniqueID)
void cWorld::RemoveEntity(cEntity * a_Entity)
{
m_ChunkMap->RemoveEntity(a_Entity);
}
unsigned int cWorld::GetNumPlayers(void)
{
cCSLock Lock(m_CSPlayers);