summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-02 20:49:14 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-02 20:49:14 +0200
commit5fc7592cba384f0bc89dca7f531f3e823224255b (patch)
treeb6a5d04f0ce4b2ec949ccc144513d969af3fdd04 /src/World.cpp
parentSmall tweak for mobs (diff)
parentSuggestions two (diff)
downloadcuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.tar
cuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.tar.gz
cuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.tar.bz2
cuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.tar.lz
cuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.tar.xz
cuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.tar.zst
cuberite-5fc7592cba384f0bc89dca7f531f3e823224255b.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 807065bfa..88e9c32e6 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1551,9 +1551,9 @@ bool cWorld::SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome)
-void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_SendToClients)
{
- m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
+ m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_SendToClients);
}
@@ -3128,6 +3128,49 @@ void cWorld::cTaskUnloadUnusedChunks::Run(cWorld & a_World)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cWorld::cTaskSendBlockTo
+
+cWorld::cTaskSendBlockToAllPlayers::cTaskSendBlockToAllPlayers(std::vector<Vector3i> & a_SendQueue) :
+ m_SendQueue(a_SendQueue)
+{
+}
+
+void cWorld::cTaskSendBlockToAllPlayers::Run(cWorld & a_World)
+{
+ class cPlayerCallback :
+ public cPlayerListCallback
+ {
+ public:
+ cPlayerCallback(std::vector<Vector3i> & a_SendQueue, cWorld & a_World) :
+ m_SendQueue(a_SendQueue),
+ m_World(a_World)
+ {
+ }
+
+ virtual bool Item(cPlayer * a_Player)
+ {
+ for (std::vector<Vector3i>::const_iterator itr = m_SendQueue.begin(); itr != m_SendQueue.end(); ++itr)
+ {
+ m_World.SendBlockTo(itr->x, itr->y, itr->z, a_Player);
+ }
+ return false;
+ }
+
+ private:
+
+ std::vector<Vector3i> m_SendQueue;
+ cWorld & m_World;
+
+ } PlayerCallback(m_SendQueue, a_World);
+
+ a_World.ForEachPlayer(PlayerCallback);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cWorld::cChunkGeneratorCallbacks:
cWorld::cChunkGeneratorCallbacks::cChunkGeneratorCallbacks(cWorld & a_World) :