summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp85
1 files changed, 10 insertions, 75 deletions
diff --git a/src/World.cpp b/src/World.cpp
index bd06af1b7..6babfd4b2 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -786,15 +786,6 @@ void cWorld::InitialiseAndLoadMobSpawningValues(cIniFile & a_IniFile)
void cWorld::Stop(void)
{
- // Delete the clients that have been in this world:
- {
- cCSLock Lock(m_CSClients);
- for (auto itr = m_Clients.begin(); itr != m_Clients.end(); ++itr)
- {
- (*itr)->Destroy();
- } // for itr - m_Clients[]
- m_Clients.clear();
- }
// Write settings to file; these are all plugin changeable values - keep updated!
cIniFile IniFile;
@@ -884,7 +875,6 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La
m_ChunkMap->Tick(a_Dt);
m_MapManager.TickMaps();
- TickClients(static_cast<float>(a_Dt.count()));
TickQueuedBlocks();
TickQueuedTasks();
@@ -1048,56 +1038,6 @@ void cWorld::TickQueuedTasks(void)
-void cWorld::TickClients(float a_Dt)
-{
- cClientHandlePtrs RemoveClients;
- {
- cCSLock Lock(m_CSClients);
-
- // Remove clients scheduled for removal:
- for (auto itr = m_ClientsToRemove.begin(), end = m_ClientsToRemove.end(); itr != end; ++itr)
- {
- for (auto itrC = m_Clients.begin(), endC = m_Clients.end(); itrC != endC; ++itrC)
- {
- if (itrC->get() == *itr)
- {
- m_Clients.erase(itrC);
- break;
- }
- }
- } // for itr - m_ClientsToRemove[]
- m_ClientsToRemove.clear();
-
- // Add clients scheduled for adding:
- for (auto itr = m_ClientsToAdd.begin(), end = m_ClientsToAdd.end(); itr != end; ++itr)
- {
- ASSERT(std::find(m_Clients.begin(), m_Clients.end(), *itr) == m_Clients.end());
- m_Clients.push_back(*itr);
- } // for itr - m_ClientsToRemove[]
- m_ClientsToAdd.clear();
-
- // Tick the clients, take out those that have been destroyed into RemoveClients
- for (auto itr = m_Clients.begin(); itr != m_Clients.end();)
- {
- if ((*itr)->IsDestroyed())
- {
- // Remove the client later, when CS is not held, to avoid deadlock
- RemoveClients.push_back(*itr);
- itr = m_Clients.erase(itr);
- continue;
- }
- (*itr)->Tick(a_Dt);
- ++itr;
- } // for itr - m_Clients[]
- }
-
- // Delete the clients queued for removal:
- RemoveClients.clear();
-}
-
-
-
-
void cWorld::UpdateSkyDarkness(void)
{
@@ -2690,15 +2630,16 @@ bool cWorld::IsChunkValid(int a_ChunkX, int a_ChunkZ) const
-bool cWorld::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const
+bool cWorld::cChunkGeneratorCallbacks::IsNeeded(int a_ChunkX, int a_ChunkZ)
{
- return m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ);
+ return m_World->m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ);
}
+
void cWorld::UnloadUnusedChunks(void)
{
m_LastUnload = std::chrono::duration_cast<cTickTimeLong>(m_WorldAge);
@@ -2754,16 +2695,6 @@ void cWorld::RemovePlayer(cPlayer * a_Player, bool a_RemoveFromChunk)
LOGD("Removing player %s from world \"%s\"", a_Player->GetName().c_str(), m_WorldName.c_str());
m_Players.remove(a_Player);
}
-
- // Remove the player's client from the list of clients to be ticked:
- cClientHandle * Client = a_Player->GetClientHandle();
- if (Client != nullptr)
- {
- Client->RemoveFromWorld();
- m_ChunkMap->RemoveClientFromChunks(Client);
- cCSLock Lock(m_CSClients);
- m_ClientsToRemove.push_back(Client);
- }
}
@@ -2962,12 +2893,12 @@ bool cWorld::DoWithEntityByID(UInt32 a_UniqueID, cEntityCallback & a_Callback)
-
+/*
void cWorld::CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback)
{
m_ChunkMap->CompareChunkClients(a_ChunkX1, a_ChunkZ1, a_ChunkX2, a_ChunkZ2, a_Callback);
}
-
+*/
@@ -3506,6 +3437,7 @@ void cWorld::SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicke
+
cRedstoneSimulator * cWorld::InitializeRedstoneSimulator(cIniFile & a_IniFile)
{
AString SimulatorName = a_IniFile.GetValueSet("Physics", "RedstoneSimulator", "Incremental");
@@ -3633,6 +3565,7 @@ void cWorld::AddQueuedPlayers(void)
} // for itr - PlayersToAdd[]
} // Lock(m_CSPlayers)
+ /*
// Add all the players' clienthandles:
{
cCSLock Lock(m_CSClients);
@@ -3645,6 +3578,7 @@ void cWorld::AddQueuedPlayers(void)
}
} // for itr - PlayersToAdd[]
} // Lock(m_CSClients)
+ */
// Stream chunks to all eligible clients:
for (cPlayerList::iterator itr = PlayersToAdd.begin(), end = PlayersToAdd.end(); itr != end; ++itr)
@@ -3713,11 +3647,12 @@ bool cWorld::cChunkGeneratorCallbacks::IsChunkQueued(int a_ChunkX, int a_ChunkZ)
-
+/*
bool cWorld::cChunkGeneratorCallbacks::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ)
{
return m_World->HasChunkAnyClients(a_ChunkX, a_ChunkZ);
}
+*/