summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-03-29 20:23:53 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-03-30 13:56:47 +0200
commit630ceed2c0572df2cf5c34b66b185d021200b806 (patch)
treec9c029db48142bc3d87b6ed6f245237ded472466 /src/World.cpp
parentMerge pull request #3109 from LogicParrot/moveToNewWorld (diff)
downloadcuberite-630ceed2c0572df2cf5c34b66b185d021200b806.tar
cuberite-630ceed2c0572df2cf5c34b66b185d021200b806.tar.gz
cuberite-630ceed2c0572df2cf5c34b66b185d021200b806.tar.bz2
cuberite-630ceed2c0572df2cf5c34b66b185d021200b806.tar.lz
cuberite-630ceed2c0572df2cf5c34b66b185d021200b806.tar.xz
cuberite-630ceed2c0572df2cf5c34b66b185d021200b806.tar.zst
cuberite-630ceed2c0572df2cf5c34b66b185d021200b806.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 365447428..79098487f 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1014,15 +1014,12 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La
// Add entities waiting in the queue to be added:
{
cCSLock Lock(m_CSEntitiesToAdd);
- for (cEntityList::iterator itr = m_EntitiesToAdd.begin(), end = m_EntitiesToAdd.end(); itr != end; ++itr)
+ for (auto & Entity : m_EntitiesToAdd)
{
- (*itr)->SetWorld(this);
- m_ChunkMap->AddEntity(*itr);
- ASSERT(!(*itr)->IsTicking());
- if (m_ChunkMap->HasEntity((*itr)->GetUniqueID()))
- {
- (*itr)->SetIsTicking(true);
- }
+ Entity->SetWorld(this);
+ m_ChunkMap->AddEntity(Entity);
+ ASSERT(!Entity->IsTicking());
+ Entity->SetIsTicking(true);
}
m_EntitiesToAdd.clear();
}
@@ -3820,21 +3817,18 @@ void cWorld::AddQueuedPlayers(void)
// Add all the players in the grabbed list:
{
cCSLock Lock(m_CSPlayers);
- for (cPlayerList::iterator itr = PlayersToAdd.begin(), end = PlayersToAdd.end(); itr != end; ++itr)
+ for (auto Player : m_Players)
{
- ASSERT(std::find(m_Players.begin(), m_Players.end(), *itr) == m_Players.end()); // Is it already in the list? HOW?
- LOGD("Adding player %s to world \"%s\".", (*itr)->GetName().c_str(), m_WorldName.c_str());
+ ASSERT(std::find(m_Players.begin(), m_Players.end(), Player) == m_Players.end()); // Is it already in the list? HOW?
+ LOGD("Adding player %s to world \"%s\".", Player->GetName().c_str(), m_WorldName.c_str());
- m_Players.push_back(*itr);
- (*itr)->SetWorld(this);
+ m_Players.push_back(Player);
+ Player->SetWorld(this);
// Add to chunkmap, if not already there (Spawn vs MoveToWorld):
- m_ChunkMap->AddEntityIfNotPresent(*itr);
- ASSERT(!(*itr)->IsTicking());
- if (m_ChunkMap->HasEntity((*itr)->GetUniqueID()))
- {
- (*itr)->SetIsTicking(true);
- }
+ m_ChunkMap->AddEntityIfNotPresent(Player);
+ ASSERT(!Player->IsTicking());
+ Player->SetIsTicking(true);
} // for itr - PlayersToAdd[]
} // Lock(m_CSPlayers)