summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 09:45:06 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-02 09:50:23 +0200
commit49c443896dcac8c4eaf08c4024e8bd2366ad899a (patch)
treeb1ec46cab2b4e5731860c7136f1bbfca6fe9d458 /src/World.cpp
parentSetSwimState now takes into account head height (diff)
downloadcuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.gz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.bz2
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.lz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.xz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.zst
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp196
1 files changed, 133 insertions, 63 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 9baf9500a..acec3049e 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1,4 +1,4 @@
-
+
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "World.h"
@@ -1117,52 +1117,59 @@ void cWorld::TickMobs(std::chrono::milliseconds a_Dt)
{
m_ChunkMap->SpawnMobs(Spawner);
// do the spawn
- for (auto & Mob : Spawner.getSpawned())
+ for (cMobSpawner::tSpawnedContainer::const_iterator itr2 = Spawner.getSpawned().begin(); itr2 != Spawner.getSpawned().end(); ++itr2)
{
- SpawnMobFinalize(std::move(Mob));
+ SpawnMobFinalize(std::move(const_cast<std::unique_ptr<cMonster> &>(*itr2)));
}
}
} // for i - AllFamilies[]
} // if (Spawning enabled)
- ForEachEntity([=](cEntity & a_Entity)
+ class cCallback : public cEntityCallback
+ {
+ virtual bool Item(cEntity * a_Entity) override
{
- if (!a_Entity.IsMob())
+ if (!a_Entity->IsMob())
{
return false;
}
- if (!a_Entity.IsTicking())
+ if (!a_Entity->IsTicking())
{
return false;
}
- auto & Monster = static_cast<cMonster &>(a_Entity);
- ASSERT(Monster.GetParentChunk() != nullptr); // A ticking entity must have a valid parent chunk
+ auto Monster = static_cast<cMonster *>(a_Entity);
+ ASSERT(Monster->GetParentChunk() != nullptr); // A ticking entity must have a valid parent chunk
// Tick close mobs
- if (Monster.GetParentChunk()->HasAnyClients())
+ if (Monster->GetParentChunk()->HasAnyClients())
{
- Monster.Tick(a_Dt, *(a_Entity.GetParentChunk()));
+ Monster->Tick(m_Dt, *(a_Entity->GetParentChunk()));
}
// Destroy far hostile mobs except if last target was a player
- else if ((Monster.GetMobFamily() == cMonster::eFamily::mfHostile) && !Monster.WasLastTargetAPlayer())
+ else if ((Monster->GetMobFamily() == cMonster::eFamily::mfHostile) && !Monster->WasLastTargetAPlayer())
{
- if (Monster.GetMobType() != eMonsterType::mtWolf)
+ if (Monster->GetMobType() != eMonsterType::mtWolf)
{
- Monster.Destroy(true);
+ Monster->Destroy(true);
}
else
{
- auto & Wolf = static_cast<cWolf &>(Monster);
- if (Wolf.IsAngry())
+ auto Wolf = static_cast<cWolf *>(Monster);
+ if (Wolf->IsAngry())
{
- Monster.Destroy(true);
+ Monster->Destroy(true);
}
}
}
return false;
}
- );
+ public:
+ std::chrono::milliseconds m_Dt;
+ } Callback;
+
+ Callback.m_Dt = a_Dt;
+ ForEachEntity(Callback);
}
@@ -1314,7 +1321,7 @@ void cWorld::WakeUpSimulatorsInArea(const cCuboid & a_Area)
-bool cWorld::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, const cBlockEntityCallback & a_Callback)
+bool cWorld::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback)
{
return m_ChunkMap->ForEachBlockEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1323,7 +1330,7 @@ bool cWorld::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, const cBlockE
-bool cWorld::ForEachBrewingstandInChunk(int a_ChunkX, int a_ChunkZ, const cBrewingstandCallback & a_Callback)
+bool cWorld::ForEachBrewingstandInChunk(int a_ChunkX, int a_ChunkZ, cBrewingstandCallback & a_Callback)
{
return m_ChunkMap->ForEachBrewingstandInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1332,7 +1339,7 @@ bool cWorld::ForEachBrewingstandInChunk(int a_ChunkX, int a_ChunkZ, const cBrewi
-bool cWorld::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, const cChestCallback & a_Callback)
+bool cWorld::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback)
{
return m_ChunkMap->ForEachChestInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1341,7 +1348,7 @@ bool cWorld::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, const cChestCallbac
-bool cWorld::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, const cDispenserCallback & a_Callback)
+bool cWorld::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback)
{
return m_ChunkMap->ForEachDispenserInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1350,7 +1357,7 @@ bool cWorld::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, const cDispense
-bool cWorld::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, const cDropperCallback & a_Callback)
+bool cWorld::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback)
{
return m_ChunkMap->ForEachDropperInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1359,7 +1366,7 @@ bool cWorld::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, const cDropperCal
-bool cWorld::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, const cDropSpenserCallback & a_Callback)
+bool cWorld::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback)
{
return m_ChunkMap->ForEachDropSpenserInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1368,7 +1375,7 @@ bool cWorld::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, const cDropSp
-bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, const cFurnaceCallback & a_Callback)
+bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback)
{
return m_ChunkMap->ForEachFurnaceInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1423,7 +1430,7 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo
-bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBlockEntityCallback & a_Callback)
+bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback)
{
return m_ChunkMap->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1432,7 +1439,7 @@ bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, const
-bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBeaconCallback & a_Callback)
+bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback & a_Callback)
{
return m_ChunkMap->DoWithBeaconAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1441,7 +1448,7 @@ bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBea
-bool cWorld::DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBedCallback & a_Callback)
+bool cWorld::DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBedCallback & a_Callback)
{
return m_ChunkMap->DoWithBedAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1450,7 +1457,7 @@ bool cWorld::DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBedCal
-bool cWorld::DoWithBrewingstandAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBrewingstandCallback & a_Callback)
+bool cWorld::DoWithBrewingstandAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBrewingstandCallback & a_Callback)
{
return m_ChunkMap->DoWithBrewingstandAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1459,7 +1466,7 @@ bool cWorld::DoWithBrewingstandAt(int a_BlockX, int a_BlockY, int a_BlockZ, cons
-bool cWorld::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cChestCallback & a_Callback)
+bool cWorld::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback)
{
return m_ChunkMap->DoWithChestAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1468,7 +1475,7 @@ bool cWorld::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cChes
-bool cWorld::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cDispenserCallback & a_Callback)
+bool cWorld::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback)
{
return m_ChunkMap->DoWithDispenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1477,7 +1484,7 @@ bool cWorld::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, const c
-bool cWorld::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cDropperCallback & a_Callback)
+bool cWorld::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback)
{
return m_ChunkMap->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1486,7 +1493,7 @@ bool cWorld::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cDr
-bool cWorld::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cDropSpenserCallback & a_Callback)
+bool cWorld::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback)
{
return m_ChunkMap->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1495,7 +1502,7 @@ bool cWorld::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, const
-bool cWorld::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cFurnaceCallback & a_Callback)
+bool cWorld::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback)
{
return m_ChunkMap->DoWithFurnaceAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1504,7 +1511,7 @@ bool cWorld::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cFu
-bool cWorld::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cNoteBlockCallback & a_Callback)
+bool cWorld::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBlockCallback & a_Callback)
{
return m_ChunkMap->DoWithNoteBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1513,7 +1520,7 @@ bool cWorld::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, const c
-bool cWorld::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cCommandBlockCallback & a_Callback)
+bool cWorld::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback)
{
return m_ChunkMap->DoWithCommandBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1522,7 +1529,7 @@ bool cWorld::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cons
-bool cWorld::DoWithMobHeadAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cMobHeadCallback & a_Callback)
+bool cWorld::DoWithMobHeadAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadCallback & a_Callback)
{
return m_ChunkMap->DoWithMobHeadAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1531,7 +1538,7 @@ bool cWorld::DoWithMobHeadAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cMo
-bool cWorld::DoWithFlowerPotAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cFlowerPotCallback & a_Callback)
+bool cWorld::DoWithFlowerPotAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFlowerPotCallback & a_Callback)
{
return m_ChunkMap->DoWithFlowerPotAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
}
@@ -1549,7 +1556,7 @@ bool cWorld::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_
-bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, const cChunkCallback & a_Callback)
+bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback)
{
return m_ChunkMap->DoWithChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -1558,7 +1565,31 @@ bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, const cChunkCallback & a_Ca
-bool cWorld::DoWithChunkAt(Vector3i a_BlockPos, const cChunkCallback & a_Callback)
+bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, std::function<bool(cChunk &)> a_Callback)
+{
+ struct cCallBackWrapper : cChunkCallback
+ {
+ cCallBackWrapper(std::function<bool(cChunk &)> a_InnerCallback) :
+ m_Callback(a_InnerCallback)
+ {
+ }
+
+ virtual bool Item(cChunk * a_Chunk)
+ {
+ return m_Callback(*a_Chunk);
+ }
+
+ private:
+ std::function<bool(cChunk &)> m_Callback;
+ } callback(a_Callback);
+ return m_ChunkMap->DoWithChunk(a_ChunkX, a_ChunkZ, callback);
+}
+
+
+
+
+
+bool cWorld::DoWithChunkAt(Vector3i a_BlockPos, std::function<bool(cChunk &)> a_Callback)
{
return m_ChunkMap->DoWithChunkAt(a_BlockPos, a_Callback);
}
@@ -3132,13 +3163,18 @@ bool cWorld::IsPlayerReferencedInWorldOrChunk(cPlayer & a_Player)
-bool cWorld::ForEachPlayer(const cPlayerListCallback & a_Callback)
+bool cWorld::ForEachPlayer(cPlayerListCallback & a_Callback)
{
// Calls the callback for each player in the list
cCSLock Lock(m_CSPlayers);
- for (auto & Player : m_Players)
+ for (cPlayerList::iterator itr = m_Players.begin(), itr2 = itr; itr != m_Players.end(); itr = itr2)
{
- if (Player->IsTicking() && a_Callback(*Player))
+ ++itr2;
+ if (!(*itr)->IsTicking())
+ {
+ continue;
+ }
+ if (a_Callback.Item(*itr))
{
return false;
}
@@ -3150,15 +3186,19 @@ bool cWorld::ForEachPlayer(const cPlayerListCallback & a_Callback)
-bool cWorld::DoWithPlayer(const AString & a_PlayerName, const cPlayerListCallback & a_Callback)
+bool cWorld::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback)
{
// Calls the callback for the specified player in the list
cCSLock Lock(m_CSPlayers);
- for (auto & Player : m_Players)
+ for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
- if (Player->IsTicking() && (NoCaseCompare(Player->GetName(), a_PlayerName) == 0))
+ if (!(*itr)->IsTicking())
+ {
+ continue;
+ }
+ if (NoCaseCompare((*itr)->GetName(), a_PlayerName) == 0)
{
- a_Callback(*Player);
+ a_Callback.Item(*itr);
return true;
}
} // for itr - m_Players[]
@@ -3169,7 +3209,7 @@ bool cWorld::DoWithPlayer(const AString & a_PlayerName, const cPlayerListCallbac
-bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, const cPlayerListCallback & a_Callback)
+bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback)
{
cPlayer * BestMatch = nullptr;
size_t BestRating = 0;
@@ -3196,7 +3236,7 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, const cPlayer
if (BestMatch != nullptr)
{
- return a_Callback(*BestMatch);
+ return a_Callback.Item (BestMatch);
}
return false;
}
@@ -3205,14 +3245,27 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, const cPlayer
-bool cWorld::DoWithPlayerByUUID(const cUUID & a_PlayerUUID, const cPlayerListCallback & a_Callback)
+bool cWorld::DoWithPlayerByUUID(const cUUID & a_PlayerUUID, cPlayerListCallback & a_Callback)
+{
+ return DoWithPlayerByUUID(a_PlayerUUID, std::bind(&cPlayerListCallback::Item, &a_Callback, std::placeholders::_1));
+}
+
+
+
+
+
+bool cWorld::DoWithPlayerByUUID(const cUUID & a_PlayerUUID, cLambdaPlayerCallback a_Callback)
{
cCSLock Lock(m_CSPlayers);
- for (auto & Player : m_Players)
+ for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
- if (Player->IsTicking() && (Player->GetUUID() == a_PlayerUUID))
+ if (!(*itr)->IsTicking())
{
- return a_Callback(*Player);
+ continue;
+ }
+ if ((*itr)->GetUUID() == a_PlayerUUID)
+ {
+ return a_Callback(*itr);
}
}
return false;
@@ -3280,7 +3333,7 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer)
-bool cWorld::ForEachEntity(const cEntityCallback & a_Callback)
+bool cWorld::ForEachEntity(cEntityCallback & a_Callback)
{
return m_ChunkMap->ForEachEntity(a_Callback);
}
@@ -3289,7 +3342,7 @@ bool cWorld::ForEachEntity(const cEntityCallback & a_Callback)
-bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, const cEntityCallback & a_Callback)
+bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback)
{
return m_ChunkMap->ForEachEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback);
}
@@ -3298,7 +3351,7 @@ bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, const cEntityCallb
-bool cWorld::ForEachEntityInBox(const cBoundingBox & a_Box, const cEntityCallback & a_Callback)
+bool cWorld::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_Callback)
{
return m_ChunkMap->ForEachEntityInBox(a_Box, a_Callback);
}
@@ -3307,7 +3360,16 @@ bool cWorld::ForEachEntityInBox(const cBoundingBox & a_Box, const cEntityCallbac
-bool cWorld::DoWithEntityByID(UInt32 a_UniqueID, const cEntityCallback & a_Callback)
+bool cWorld::DoWithEntityByID(UInt32 a_UniqueID, cEntityCallback & a_Callback)
+{
+ return DoWithEntityByID(a_UniqueID, std::bind(&cEntityCallback::Item, &a_Callback, std::placeholders::_1));
+}
+
+
+
+
+
+bool cWorld::DoWithEntityByID(UInt32 a_UniqueID, cLambdaEntityCallback a_Callback)
{
// First check the entities-to-add:
{
@@ -3316,7 +3378,7 @@ bool cWorld::DoWithEntityByID(UInt32 a_UniqueID, const cEntityCallback & a_Callb
{
if (ent->GetUniqueID() == a_UniqueID)
{
- a_Callback(*ent);
+ a_Callback(ent.get());
return true;
}
} // for ent - m_EntitiesToAdd[]
@@ -3448,12 +3510,20 @@ bool cWorld::SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AStrin
bool cWorld::SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command)
{
- return DoWithCommandBlockAt(a_BlockX, a_BlockY, a_BlockZ, [&](cCommandBlockEntity & a_CommandBlock)
+ class cUpdateCommandBlock : public cCommandBlockCallback
+ {
+ AString m_Command;
+ public:
+ cUpdateCommandBlock(const AString & a_CallbackCommand) : m_Command(a_CallbackCommand) {}
+
+ virtual bool Item(cCommandBlockEntity * a_CommandBlock) override
{
- a_CommandBlock.SetCommand(a_Command);
+ a_CommandBlock->SetCommand(m_Command);
return false;
}
- );
+ } CmdBlockCB (a_Command);
+
+ return DoWithCommandBlockAt(a_BlockX, a_BlockY, a_BlockZ, CmdBlockCB);
}
@@ -3548,7 +3618,7 @@ bool cWorld::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunk
-bool cWorld::ForEachLoadedChunk(const std::function<bool(int, int)> & a_Callback)
+bool cWorld::ForEachLoadedChunk(std::function<bool(int, int)> a_Callback)
{
return m_ChunkMap->ForEachLoadedChunk(a_Callback);
}
@@ -3579,7 +3649,7 @@ void cWorld::QueueSaveAllChunks(void)
void cWorld::QueueTask(std::function<void(cWorld &)> a_Task)
{
cCSLock Lock(m_CSTasks);
- m_Tasks.emplace_back(0, std::move(a_Task));
+ m_Tasks.emplace_back(0, a_Task);
}
@@ -3593,7 +3663,7 @@ void cWorld::ScheduleTask(int a_DelayTicks, std::function<void (cWorld &)> a_Tas
// Insert the task into the list of scheduled tasks
{
cCSLock Lock(m_CSTasks);
- m_Tasks.emplace_back(TargetTick, std::move(a_Task));
+ m_Tasks.emplace_back(TargetTick, a_Task);
}
}