From 803ea412361ee2f4b1d74a811ddbee05f50c9345 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 18 Feb 2014 13:06:18 +0100 Subject: Added cWorld:SetAreaBiome() API function. Fixes #675. --- src/World.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index d67ad36d1..c9d7f42be 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1487,6 +1487,33 @@ EMCSBiome cWorld::GetBiomeAt (int a_BlockX, int a_BlockZ) +bool cWorld::SetBiomeAt(int a_BlockX, int a_BlockZ, EMCSBiome a_Biome) +{ + return m_ChunkMap->SetBiomeAt(a_BlockX, a_BlockZ, a_Biome); +} + + + + + +bool cWorld::SetAreaBiome(int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBiome a_Biome) +{ + return m_ChunkMap->SetAreaBiome(a_MinX, a_MaxX, a_MinZ, a_MaxZ, a_Biome); +} + + + + + +bool cWorld::SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome) +{ + return SetAreaBiome(a_Area.p1.x, a_Area.p2.x, a_Area.p1.z, a_Area.p2.z, a_Biome); +} + + + + + void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); @@ -2490,6 +2517,16 @@ void cWorld::SendChunkTo(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +void cWorld::ForceSendChunkTo(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +{ + a_Client->AddWantedChunk(a_ChunkX, a_ChunkZ); + m_ChunkSender.QueueSendChunkTo(a_ChunkX, a_ChunkZ, a_Client); +} + + + + + void cWorld::RemoveClientFromChunkSender(cClientHandle * a_Client) { m_ChunkSender.RemoveClient(a_Client); -- cgit v1.2.3 From b1c6b4f5843d1f466cd12dd159bc717ae46059b5 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 18 Feb 2014 13:44:40 +0100 Subject: The cuboid for cWorld::SetAreaBiome() doesn't need sorting. --- src/World.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index c9d7f42be..e57675c44 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1507,7 +1507,11 @@ bool cWorld::SetAreaBiome(int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBi bool cWorld::SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome) { - return SetAreaBiome(a_Area.p1.x, a_Area.p2.x, a_Area.p1.z, a_Area.p2.z, a_Biome); + return SetAreaBiome( + std::min(a_Area.p1.x, a_Area.p2.x), std::max(a_Area.p1.x, a_Area.p2.x), + std::min(a_Area.p1.z, a_Area.p2.z), std::max(a_Area.p1.z, a_Area.p2.z), + a_Biome + ); } -- cgit v1.2.3