From 3c1c073714e2b0542c9a79db962b6fc9e6ddd352 Mon Sep 17 00:00:00 2001 From: LO1ZB Date: Thu, 28 Aug 2014 11:36:35 +0200 Subject: remove y-coord from chunks --- src/World.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 69d1217f1..eba3a8357 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -442,7 +442,7 @@ void cWorld::InitializeSpawn(void) { for (int z = 0; z < ViewDist; z++) { - m_ChunkMap->TouchChunk(x + ChunkX-(ViewDist - 1) / 2, ZERO_CHUNK_Y, z + ChunkZ-(ViewDist - 1) / 2); // Queue the chunk in the generator / loader + m_ChunkMap->TouchChunk(x + ChunkX-(ViewDist - 1) / 2, z + ChunkZ-(ViewDist - 1) / 2); // Queue the chunk in the generator / loader } } @@ -2421,7 +2421,7 @@ void cWorld::SetChunkData(cSetChunkData & a_SetChunkData) // Save the chunk right after generating, so that we don't have to generate it again on next run if (a_SetChunkData.ShouldMarkDirty()) { - m_Storage.QueueSaveChunk(ChunkX, 0, ChunkZ); + m_Storage.QueueSaveChunk(ChunkX, ChunkZ); } } @@ -2766,18 +2766,18 @@ void cWorld::RemoveClientFromChunkSender(cClientHandle * a_Client) -void cWorld::TouchChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +void cWorld::TouchChunk(int a_ChunkX, int a_ChunkZ) { - m_ChunkMap->TouchChunk(a_ChunkX, a_ChunkY, a_ChunkZ); + m_ChunkMap->TouchChunk(a_ChunkX, a_ChunkZ); } -bool cWorld::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +bool cWorld::LoadChunk(int a_ChunkX, int a_ChunkZ) { - return m_ChunkMap->LoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ); + return m_ChunkMap->LoadChunk(a_ChunkX, a_ChunkZ); } @@ -2793,9 +2793,9 @@ void cWorld::LoadChunks(const cChunkCoordsList & a_Chunks) -void cWorld::ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +void cWorld::ChunkLoadFailed(int a_ChunkX, int a_ChunkZ) { - m_ChunkMap->ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ); + m_ChunkMap->ChunkLoadFailed(a_ChunkX, a_ChunkZ); } @@ -2900,8 +2900,7 @@ void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) { m_ChunkMap->MarkChunkRegenerating(a_ChunkX, a_ChunkZ); - // Trick: use Y=1 to force the chunk generation even though the chunk data is already present - m_Generator.QueueGenerateChunk(a_ChunkX, 1, a_ChunkZ); + m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ); } @@ -2910,7 +2909,7 @@ void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) { - m_Generator.QueueGenerateChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ); } -- cgit v1.2.3 From 75e131638616c68d126eb64abdf903a93dd7322f Mon Sep 17 00:00:00 2001 From: LO1ZB Date: Fri, 29 Aug 2014 20:19:45 +0200 Subject: fix chunk regenerating --- src/World.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index eba3a8357..aba5bd859 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2909,7 +2909,15 @@ void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) { + if (!(m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ))) + { + LOGD("Chunk [%d, %d] already generated, skipping generation", a_ChunkX, a_ChunkZ); + // Already generated, ignore reques + } + else + { m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ); + } } -- cgit v1.2.3 From e45a27add934dcdad8eadcea16ce647fb87fbf9d Mon Sep 17 00:00:00 2001 From: LO1ZB Date: Fri, 29 Aug 2014 20:26:19 +0200 Subject: add comments --- src/World.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index aba5bd859..7c6a1af2f 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2909,10 +2909,11 @@ void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) { + /** Add a chunk to the generation queue, if it's not already present. */ if (!(m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ))) { LOGD("Chunk [%d, %d] already generated, skipping generation", a_ChunkX, a_ChunkZ); - // Already generated, ignore reques + /** Already generated, ignore reques */ } else { -- cgit v1.2.3 From 5a6ef8b8e5887a13b252623a584ac05f0b2bd070 Mon Sep 17 00:00:00 2001 From: LO1ZB Date: Fri, 29 Aug 2014 20:27:58 +0200 Subject: me being stupid --- src/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 7c6a1af2f..f6fed53ee 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2913,7 +2913,7 @@ void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) if (!(m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ))) { LOGD("Chunk [%d, %d] already generated, skipping generation", a_ChunkX, a_ChunkZ); - /** Already generated, ignore reques */ + /** Already generated, ignore request */ } else { -- cgit v1.2.3 From a600e3bdfef5514d28475b6574f1c78ee74ed214 Mon Sep 17 00:00:00 2001 From: LO1ZB Date: Wed, 3 Sep 2014 00:14:51 +0200 Subject: hopefully the last commit for removing y-coord from chunks. :) --- src/World.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index f6fed53ee..2301cd8c6 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2900,7 +2900,7 @@ void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) { m_ChunkMap->MarkChunkRegenerating(a_ChunkX, a_ChunkZ); - m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ); + m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ, true); } @@ -2909,16 +2909,7 @@ void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) { - /** Add a chunk to the generation queue, if it's not already present. */ - if (!(m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ))) - { - LOGD("Chunk [%d, %d] already generated, skipping generation", a_ChunkX, a_ChunkZ); - /** Already generated, ignore request */ - } - else - { - m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ); - } + m_Generator.QueueGenerateChunk(a_ChunkX, a_ChunkZ, false); } -- cgit v1.2.3 From a51c1e0b73a83cddcce865671ca30240393e458f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 3 Sep 2014 17:00:26 +0200 Subject: Added cWorld::ForEachEntityInBox() --- src/World.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 99e09c658..d3751364f 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2696,6 +2696,15 @@ bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & +bool cWorld::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_Callback) +{ + return m_ChunkMap->ForEachEntityInBox(a_Box, a_Callback); +} + + + + + bool cWorld::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback) { return m_ChunkMap->DoWithEntityByID(a_UniqueID, a_Callback); -- cgit v1.2.3 From 137b021d26d47b11fc27df1c0b52f408f0ef5257 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Sep 2014 22:16:48 +0200 Subject: Rewritten chunk status to specify whether the chunk is in queue. This fixes #1370. --- src/World.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 2a3336dee..e669f6fa0 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2374,6 +2374,8 @@ void cWorld::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) void cWorld::QueueSetChunkData(const cSetChunkDataPtr & a_SetChunkData) { + ASSERT(IsChunkQueued(a_SetChunkData->GetChunkX(), a_SetChunkData->GetChunkZ())); + // Validate biomes, if needed: if (!a_SetChunkData->AreBiomesValid()) { @@ -2463,6 +2465,15 @@ bool cWorld::GetChunkBlockTypes(int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_BlockT +bool cWorld::IsChunkQueued(int a_ChunkX, int a_ChunkZ) const +{ + return m_ChunkMap->IsChunkQueued(a_ChunkX, a_ChunkZ); +} + + + + + bool cWorld::IsChunkValid(int a_ChunkX, int a_ChunkZ) const { return m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ); @@ -2787,24 +2798,6 @@ void cWorld::TouchChunk(int a_ChunkX, int a_ChunkZ) -bool cWorld::LoadChunk(int a_ChunkX, int a_ChunkZ) -{ - return m_ChunkMap->LoadChunk(a_ChunkX, a_ChunkZ); -} - - - - - -void cWorld::LoadChunks(const cChunkCoordsList & a_Chunks) -{ - m_ChunkMap->LoadChunks(a_Chunks); -} - - - - - void cWorld::ChunkLoadFailed(int a_ChunkX, int a_ChunkZ) { m_ChunkMap->ChunkLoadFailed(a_ChunkX, a_ChunkZ); @@ -3520,6 +3513,15 @@ bool cWorld::cChunkGeneratorCallbacks::IsChunkValid(int a_ChunkX, int a_ChunkZ) +bool cWorld::cChunkGeneratorCallbacks::IsChunkQueued(int a_ChunkX, int a_ChunkZ) +{ + return m_World->IsChunkQueued(a_ChunkX, a_ChunkZ); +} + + + + + bool cWorld::cChunkGeneratorCallbacks::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) { return m_World->HasChunkAnyClients(a_ChunkX, a_ChunkZ); -- cgit v1.2.3 From 4bdf9256f24448717dfbcc6c16186675a0bd54cf Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 8 Sep 2014 18:56:27 +0100 Subject: Fixed a few compile warnings --- src/World.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index e669f6fa0..319d5851f 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1592,9 +1592,9 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy MTRand r1; for (int i = 0; i < 60; i++) { - int OfsX = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; - int OfsY = r1.randInt(3) + r1.randInt(3) - 3; - int OfsZ = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; + int OfsX = static_cast(r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; + int OfsY = static_cast(r1.randInt(3) + r1.randInt(3)) - 3; + int OfsZ = static_cast(r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; BLOCKTYPE Ground = GetBlock(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ); if (Ground != E_BLOCK_GRASS) { @@ -2844,7 +2844,7 @@ bool cWorld::SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, co { AString m_Command; public: - cUpdateCommandBlock(const AString & a_Command) : m_Command(a_Command) {} + cUpdateCommandBlock(const AString & a_CallbackCommand) : m_Command(a_CallbackCommand) {} virtual bool Item(cCommandBlockEntity * a_CommandBlock) override { @@ -3319,20 +3319,25 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", IsWater ? 1 : 2); int TickDelay = a_IniFile.GetValueSetI(SimulatorSectionName, "TickDelay", IsWater ? 5 : 30); int NumNeighborsForSource = a_IniFile.GetValueSetI(SimulatorSectionName, "NumNeighborsForSource", IsWater ? 2 : -1); + + if ((Falloff > 15) || (Falloff < 0)) + { + LOGWARNING("Falloff for %s simulator is out of range, assuming default of %d", a_FluidName, IsWater ? 1 : 2); + } if (NoCaseCompare(SimulatorName, "floody") == 0) { - res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); + res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, static_cast(Falloff), TickDelay, NumNeighborsForSource); } else if (NoCaseCompare(SimulatorName, "vanilla") == 0) { - res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); + res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, static_cast(Falloff), TickDelay, NumNeighborsForSource); } else { // The simulator name doesn't match anything we have, issue a warning: LOGWARNING("%s [Physics]:%s specifies an unknown simulator, using the default \"Vanilla\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); - res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); + res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, static_cast(Falloff), TickDelay, NumNeighborsForSource); } } @@ -3442,9 +3447,9 @@ void cWorld::cTaskSendBlockToAllPlayers::Run(cWorld & a_World) public cPlayerListCallback { public: - cPlayerCallback(std::vector & a_SendQueue, cWorld & a_World) : + cPlayerCallback(std::vector & a_SendQueue, cWorld & a_CallbackWorld) : m_SendQueue(a_SendQueue), - m_World(a_World) + m_World(a_CallbackWorld) { } -- cgit v1.2.3 From 2c945c8818a19405c566be1fcb6367a69b0a60c8 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 8 Sep 2014 19:07:45 +0100 Subject: TimeOfDay does not need to be an Int64 --- src/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 319d5851f..e6f967a1b 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -876,7 +876,7 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec) m_TimeOfDaySecs -= 1200.0; } - m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0); + m_TimeOfDay = static_cast(m_TimeOfDaySecs * 20.0); // Updates the sky darkness based on current time of day UpdateSkyDarkness(); -- cgit v1.2.3 From fb20c2eb854799972822c702bc12fb5ca577897c Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 8 Sep 2014 19:15:29 +0100 Subject: FIxed a couple more warnings --- src/World.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index e6f967a1b..1d0969dfa 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -757,6 +757,11 @@ void cWorld::InitialiseGeneratorDefaults(cIniFile & a_IniFile) a_IniFile.GetValueSet("Generator", "BottomLavaHeight", "30"); break; } + case dimNotSet: + { + assert(!"Dimension not set"); + break; + } } } @@ -772,6 +777,7 @@ void cWorld::InitialiseAndLoadMobSpawningValues(cIniFile & a_IniFile) case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break; case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break; case dimEnd: DefaultMonsters = "enderman"; break; + case dimNotSet: assert(!"Dimension not set"); break; } m_bAnimals = a_IniFile.GetValueSetB("Monsters", "AnimalsOn", true); @@ -1130,7 +1136,7 @@ void cWorld::UpdateSkyDarkness(void) } else if (TempTime <= TIME_NIGHT_START) { - m_SkyDarkness = (TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR; + m_SkyDarkness = static_cast((TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR); } else if (TempTime <= TIME_NIGHT_END) { @@ -1138,7 +1144,7 @@ void cWorld::UpdateSkyDarkness(void) } else { - m_SkyDarkness = (TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR; + m_SkyDarkness = static_cast((TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR); } } -- cgit v1.2.3 From bd810b80a6df668cb6cb44519d8a533544163bfd Mon Sep 17 00:00:00 2001 From: worktycho Date: Mon, 8 Sep 2014 21:31:47 +0100 Subject: use the correct ASSERT --- src/World.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 1d0969dfa..b7045c7f4 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -759,7 +759,7 @@ void cWorld::InitialiseGeneratorDefaults(cIniFile & a_IniFile) } case dimNotSet: { - assert(!"Dimension not set"); + ASSERT(!"Dimension not set"); break; } } @@ -777,7 +777,7 @@ void cWorld::InitialiseAndLoadMobSpawningValues(cIniFile & a_IniFile) case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break; case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break; case dimEnd: DefaultMonsters = "enderman"; break; - case dimNotSet: assert(!"Dimension not set"); break; + case dimNotSet: ASSERT(!"Dimension not set"); break; } m_bAnimals = a_IniFile.GetValueSetB("Monsters", "AnimalsOn", true); -- cgit v1.2.3 From f94df06b6601f9dcecd383f5d093d225f41d1c65 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 9 Sep 2014 03:02:25 +0200 Subject: Added the player list to the 1.8 protocol. --- src/World.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index e669f6fa0..0e0846943 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2147,7 +2147,7 @@ void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_Src -void cWorld::BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude) +void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -2157,7 +2157,7 @@ void cWorld::BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, { continue; } - ch->SendPlayerListItem(a_Player, a_IsOnline); + ch->SendPlayerListItem(a_Player, a_Action); } } @@ -2680,7 +2680,7 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer) cClientHandle * ch = (*itr)->GetClientHandle(); if ((ch != NULL) && !ch->IsDestroyed()) { - a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), true); + a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), 0); } } } -- cgit v1.2.3 From 1f0b6eeaf3cfff3e6bc27bf5f3a83be60722a3de Mon Sep 17 00:00:00 2001 From: worktycho Date: Tue, 9 Sep 2014 12:18:20 +0100 Subject: Actually set default --- src/World.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index b7045c7f4..fdc0aebad 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -3329,6 +3329,7 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c if ((Falloff > 15) || (Falloff < 0)) { LOGWARNING("Falloff for %s simulator is out of range, assuming default of %d", a_FluidName, IsWater ? 1 : 2); + Falloff = IsWater ? 1 : 2; } if (NoCaseCompare(SimulatorName, "floody") == 0) -- cgit v1.2.3 From 3bd3ac2200392542b111d2bcd2951bd342edf721 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 11 Sep 2014 17:03:09 +0200 Subject: 1.8: Added ParticleEffect packet. --- src/World.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 0e0846943..351dded24 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2138,9 +2138,9 @@ void cWorld::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation -void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude) +void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude) { - m_ChunkMap->BroadcastParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmmount, a_Exclude); + m_ChunkMap->BroadcastParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount, a_Exclude); } -- cgit v1.2.3 From fcf558173e3bb9b2213c610815f82088e7541a1e Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 12 Sep 2014 19:07:20 +0200 Subject: Fixed farmland issues. --- src/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index fdc0aebad..fe0be00ae 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1727,7 +1727,7 @@ 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, bool a_SendToClients) { - m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_SendToClients); + m_ChunkMap->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_SendToClients); } -- cgit v1.2.3 From 43ed690520d3c3b47ed7ff6f48f868e8011565e0 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 18 Sep 2014 18:50:17 +0200 Subject: Exported player list states to extra functions. --- src/World.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 3 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 2d2137b3f..71ce7e680 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2153,7 +2153,7 @@ void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_Src -void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, const cClientHandle * a_Exclude) +void cWorld::BroadcastPlayerListAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -2163,7 +2163,79 @@ void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, co { continue; } - ch->SendPlayerListItem(a_Player, a_Action); + ch->SendPlayerListAddPlayer(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListRemovePlayer(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListUpdateGameMode(const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListUpdateGameMode(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListUpdatePing(const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListUpdatePing(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListUpdateDisplayName(a_Player, a_OldListName); } } @@ -2686,7 +2758,7 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer) cClientHandle * ch = (*itr)->GetClientHandle(); if ((ch != NULL) && !ch->IsDestroyed()) { - a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), 0); + a_DestPlayer->GetClientHandle()->SendPlayerListAddPlayer(*(*itr)); } } } -- cgit v1.2.3