summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2015-12-17 11:37:20 +0100
committerLukas Pioch <lukas@zgow.de>2015-12-17 11:37:20 +0100
commit1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb (patch)
treed589a1e5fb4813e100fd377bae9378c37a619370
parentMerge pull request #2753 from cuberite/pathFix (diff)
parentMoved variables into scope, removed unused variables and fixed variables (diff)
downloadcuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.tar
cuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.tar.gz
cuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.tar.bz2
cuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.tar.lz
cuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.tar.xz
cuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.tar.zst
cuberite-1395ff3ca4baf554f8b47a73ebd7bbf7635f59cb.zip
-rw-r--r--src/BlockEntities/BrewingstandEntity.cpp2
-rw-r--r--src/Blocks/BlockCrops.h9
-rw-r--r--src/Entities/Entity.cpp2
-rw-r--r--src/Generating/StructGen.cpp4
-rw-r--r--src/OSSupport/File.cpp2
-rw-r--r--src/PolarSSL++/BlockingSslClientSocket.cpp2
-rw-r--r--src/Protocol/MojangAPI.cpp3
-rw-r--r--src/Simulator/FloodyFluidSimulator.cpp2
-rw-r--r--src/UI/SlotArea.cpp3
9 files changed, 10 insertions, 19 deletions
diff --git a/src/BlockEntities/BrewingstandEntity.cpp b/src/BlockEntities/BrewingstandEntity.cpp
index 3c42bee0e..f202ab419 100644
--- a/src/BlockEntities/BrewingstandEntity.cpp
+++ b/src/BlockEntities/BrewingstandEntity.cpp
@@ -92,10 +92,10 @@ bool cBrewingstandEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
return false;
}
- const cBrewingRecipes::cRecipe * Recipe = nullptr;
// The necessary brewing time, has been reached
if (m_TimeBrewed >= m_NeedBrewingTime)
{
+ const cBrewingRecipes::cRecipe * Recipe = nullptr;
BroadcastProgress(0, 0);
m_IsBrewing = false;
m_TimeBrewed = 0;
diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h
index 9014f7046..0751d19f0 100644
--- a/src/Blocks/BlockCrops.h
+++ b/src/Blocks/BlockCrops.h
@@ -75,14 +75,7 @@ public:
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
- NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ);
- NIBBLETYPE Light = a_Chunk.GetBlockLight(a_RelX, a_RelY, a_RelZ);
- NIBBLETYPE SkyLight = a_Chunk.GetSkyLight (a_RelX, a_RelY, a_RelZ);
-
- if (SkyLight > Light)
- {
- Light = SkyLight;
- }
+ NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
// Check to see if the plant can grow
auto Action = CanGrow(a_Chunk, a_RelX, a_RelY, a_RelZ);
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 4c84df1f4..9f2d39de4 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -513,7 +513,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
RemovedDamage += CeilC(EPFProtection * 0.04 * a_TDI.FinalDamage);
}
- if ((a_TDI.DamageType == dtFalling) || (a_TDI.DamageType == dtFall) || (a_TDI.DamageType == dtEnderPearl))
+ if ((a_TDI.DamageType == dtFalling) || (a_TDI.DamageType == dtEnderPearl))
{
RemovedDamage += CeilC(EPFFeatherFalling * 0.04 * a_TDI.FinalDamage);
}
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index 29cab86f1..edd2f6b87 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -330,9 +330,9 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, int a_MaxLakeH
const int BubbleR = 2 + (BubbleRnd & 0x03); // 2 .. 5
const int Range = 16 - 2 * BubbleR;
const int BubbleX = BubbleR + (BubbleRnd % Range);
- Rnd >>= 4;
+ BubbleRnd >>= 4;
const int BubbleY = 4 + (BubbleRnd & 0x01); // 4 .. 5
- Rnd >>= 1;
+ BubbleRnd >>= 1;
const int BubbleZ = BubbleR + (BubbleRnd % Range);
const int HalfR = BubbleR / 2; // 1 .. 2
const int RSquared = BubbleR * BubbleR;
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp
index 0511c6083..d99892aae 100644
--- a/src/OSSupport/File.cpp
+++ b/src/OSSupport/File.cpp
@@ -532,7 +532,6 @@ AStringVector cFile::GetFolderContents(const AString & a_Folder)
#else // _WIN32
DIR * dp;
- struct dirent *dirp;
AString Folder = a_Folder;
if (Folder.empty())
{
@@ -544,6 +543,7 @@ AStringVector cFile::GetFolderContents(const AString & a_Folder)
}
else
{
+ struct dirent *dirp;
while ((dirp = readdir(dp)) != nullptr)
{
AllFiles.push_back(dirp->d_name);
diff --git a/src/PolarSSL++/BlockingSslClientSocket.cpp b/src/PolarSSL++/BlockingSslClientSocket.cpp
index a3c26f261..e789b5374 100644
--- a/src/PolarSSL++/BlockingSslClientSocket.cpp
+++ b/src/PolarSSL++/BlockingSslClientSocket.cpp
@@ -189,7 +189,7 @@ bool cBlockingSslClientSocket::Send(const void * a_Data, size_t a_NumBytes)
size_t NumBytes = a_NumBytes;
for (;;)
{
- int res = m_Ssl.WritePlain(a_Data, a_NumBytes);
+ int res = m_Ssl.WritePlain(Data, a_NumBytes);
if (res < 0)
{
ASSERT(res != POLARSSL_ERR_NET_WANT_READ); // This should never happen with callback-based SSL
diff --git a/src/Protocol/MojangAPI.cpp b/src/Protocol/MojangAPI.cpp
index 73b3bd8c0..9eb8122d3 100644
--- a/src/Protocol/MojangAPI.cpp
+++ b/src/Protocol/MojangAPI.cpp
@@ -429,12 +429,11 @@ bool cMojangAPI::SecureRequest(const AString & a_ServerName, const AString & a_R
}
// Read the HTTP response:
- int ret;
unsigned char buf[1024];
for (;;)
{
- ret = Socket.Receive(buf, sizeof(buf));
+ int ret = Socket.Receive(buf, sizeof(buf));
if ((ret == POLARSSL_ERR_NET_WANT_READ) || (ret == POLARSSL_ERR_NET_WANT_WRITE))
{
diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp
index 1e56f9528..45a34a8d9 100644
--- a/src/Simulator/FloodyFluidSimulator.cpp
+++ b/src/Simulator/FloodyFluidSimulator.cpp
@@ -88,9 +88,9 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re
// If this is a source block or was falling, the new meta is just the falloff
// Otherwise it is the current meta plus falloff (may be larger than max height, will be checked later)
NIBBLETYPE NewMeta = ((MyMeta == 0) || ((MyMeta & 0x08) != 0)) ? m_Falloff : (MyMeta + m_Falloff);
- bool SpreadFurther = true;
if (a_RelY > 0)
{
+ bool SpreadFurther = true;
BLOCKTYPE Below = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ);
if (IsPassableForFluid(Below) || IsBlockLava(Below) || IsBlockWater(Below))
{
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index c7b8d0987..dc89ff8d4 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1068,10 +1068,9 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
m_StackSizeToBeUsedInRepair = 0;
int RepairCost = Input.m_RepairCost;
int NeedExp = 0;
- bool IsEnchantBook = false;
if (!SecondInput.IsEmpty())
{
- IsEnchantBook = (SecondInput.m_ItemType == E_ITEM_ENCHANTED_BOOK);
+ bool IsEnchantBook = (SecondInput.m_ItemType == E_ITEM_ENCHANTED_BOOK);
RepairCost += SecondInput.m_RepairCost;
if (Input.IsDamageable() && cItemHandler::GetItemHandler(Input)->CanRepairWithRawMaterial(SecondInput.m_ItemType))