From 993fd14ddfc881cf5be951df77da0338124d68cc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 16:33:09 +0200 Subject: Fixed basic whitespace problems. Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines. --- src/ChunkMap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index b9bb39aa8..a83828bed 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -2711,7 +2711,7 @@ void cChunkMap::SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTi // cChunkMap::cChunkLayer: cChunkMap::cChunkLayer::cChunkLayer( - int a_LayerX, int a_LayerZ, + int a_LayerX, int a_LayerZ, cChunkMap * a_Parent, cAllocationPool & a_Pool ) @@ -2923,7 +2923,7 @@ int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const NumChunks++; } } // for i - m_Chunks[] - return NumChunks; + return NumChunks; } @@ -2994,7 +2994,7 @@ void cChunkMap::cChunkLayer::UnloadUnusedChunks(void) void cChunkMap::FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { cCSLock Lock(m_CSFastSetBlock); - m_FastSetBlockQueue.push_back(sSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta)); + m_FastSetBlockQueue.push_back(sSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta)); } -- cgit v1.2.3 From 7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 19:13:23 +0200 Subject: Fixed spaces around single-line comments. There should be at least two spaces in front and one space after //-style comments. --- src/ChunkMap.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index a83828bed..de2016015 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -20,7 +20,7 @@ #include "Entities/Pickup.h" #ifndef _WIN32 - #include // abs + #include // abs #endif #include "zlib/zlib.h" @@ -33,14 +33,15 @@ //////////////////////////////////////////////////////////////////////////////// // cChunkMap: -cChunkMap::cChunkMap(cWorld * a_World ) - : m_World( a_World ), +cChunkMap::cChunkMap(cWorld * a_World) : + m_World(a_World), m_Pool( new cListAllocationPool( std::auto_ptr::cStarvationCallbacks>( - new cStarvationCallbacks()) + new cStarvationCallbacks() ) ) + ) { } @@ -1873,15 +1874,15 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ default: { - if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups + if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups { cItems Drops; cBlockHandler * Handler = BlockHandler(Block); - Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc. + Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc. m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z); } - else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around + else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around { if (!cBlockInfo::FullyOccupiesVoxel(Block)) { @@ -1921,7 +1922,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ { if (a_Entity->IsPickup()) { - if (((cPickup *)a_Entity)->GetAge() < 20) // If pickup age is smaller than one second, it is invincible (so we don't kill pickups that were just spawned) + if (((cPickup *)a_Entity)->GetAge() < 20) // If pickup age is smaller than one second, it is invincible (so we don't kill pickups that were just spawned) { return false; } @@ -1930,7 +1931,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ Vector3d EntityPos = a_Entity->GetPosition(); cBoundingBox bbEntity(EntityPos, a_Entity->GetWidth() / 2, a_Entity->GetHeight()); - if (!m_bbTNT.IsInside(bbEntity)) // IsInside actually acts like DoesSurround + if (!m_bbTNT.IsInside(bbEntity)) // IsInside actually acts like DoesSurround { return false; } @@ -1953,7 +1954,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ else if (FinalDamage < 0) FinalDamage = 0; - if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible + if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible { a_Entity->TakeDamage(dtExplosion, NULL, (int)FinalDamage, 0); } @@ -2733,7 +2734,7 @@ cChunkMap::cChunkLayer::~cChunkLayer() for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i) { delete m_Chunks[i]; - m_Chunks[i] = NULL; // // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data + m_Chunks[i] = NULL; // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data } // for i - m_Chunks[] } -- cgit v1.2.3 From 2df5e26d3b7f08ef7d120511705fa0b75a44783e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 18 Jul 2014 09:57:34 +0200 Subject: Fixed spaces before commas. --- src/ChunkMap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 9f280f1c5..e91f77d27 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -2762,8 +2762,8 @@ cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_Ch { cChunk * neixm = (LocalX > 0) ? m_Chunks[Index - 1] : m_Parent->FindChunk(a_ChunkX - 1, a_ChunkZ); cChunk * neixp = (LocalX < LAYER_SIZE - 1) ? m_Chunks[Index + 1] : m_Parent->FindChunk(a_ChunkX + 1, a_ChunkZ); - cChunk * neizm = (LocalZ > 0) ? m_Chunks[Index - LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ - 1); - cChunk * neizp = (LocalZ < LAYER_SIZE - 1) ? m_Chunks[Index + LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ + 1); + cChunk * neizm = (LocalZ > 0) ? m_Chunks[Index - LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX, a_ChunkZ - 1); + cChunk * neizp = (LocalZ < LAYER_SIZE - 1) ? m_Chunks[Index + LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX, a_ChunkZ + 1); m_Chunks[Index] = new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld(), neixm, neixp, neizm, neizp, m_Pool); } return m_Chunks[Index]; -- cgit v1.2.3 From 041bfd5860cd8ef51db42eb6fb4b50b45549feba Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 19 Jul 2014 01:40:29 -0700 Subject: Fixed clamping issues --- src/ChunkMap.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index e91f77d27..49e9245d2 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1951,10 +1951,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ double FinalDamage = (((1 / AbsoluteEntityPos.x) + (1 / AbsoluteEntityPos.y) + (1 / AbsoluteEntityPos.z)) * 2) * m_ExplosionSize; // Clip damage values - if (FinalDamage > a_Entity->GetMaxHealth()) - FinalDamage = a_Entity->GetMaxHealth(); - else if (FinalDamage < 0) - FinalDamage = 0; + FinalDamage = Clamp(FinalDamage, 0.0, (double)a_Entity->GetMaxHealth()); if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible { -- cgit v1.2.3