1
0

Moved variables into scope, removed unused variables and fixed variables

This commit is contained in:
Lukas Pioch 2015-12-16 19:31:57 +01:00
parent 3c1f9e8a3a
commit d620dcdd08
9 changed files with 10 additions and 19 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))