Skip to content

Commit

Permalink
Merge pull request #1619 from mc-server/WarningFixes
Browse files Browse the repository at this point in the history
Warning fixes
  • Loading branch information
madmaxoft committed Nov 28, 2014
2 parents a971dee + 1480cdb commit 883230a
Show file tree
Hide file tree
Showing 26 changed files with 68 additions and 63 deletions.
19 changes: 10 additions & 9 deletions src/BlockEntities/BeaconEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,16 @@ void cBeaconEntity::GiveEffects(void)
}

public:
cPlayerCallback(int a_Radius, int a_PosX, int a_PosY, int a_PosZ, cEntityEffect::eType a_PrimaryEffect, cEntityEffect::eType a_SecondaryEffect, short a_EffectLevel)
: m_Radius(a_Radius)
, m_PosX(a_PosX)
, m_PosY(a_PosY)
, m_PosZ(a_PosZ)
, m_PrimaryEffect(a_PrimaryEffect)
, m_SecondaryEffect(a_SecondaryEffect)
, m_EffectLevel(a_EffectLevel)
{};
cPlayerCallback(int a_Radius, int a_PosX, int a_PosY, int a_PosZ, cEntityEffect::eType a_PrimaryEffect, cEntityEffect::eType a_SecondaryEffect, short a_EffectLevel):
m_Radius(a_Radius),
m_PosX(a_PosX),
m_PosY(a_PosY),
m_PosZ(a_PosZ),
m_PrimaryEffect(a_PrimaryEffect),
m_SecondaryEffect(a_SecondaryEffect),
m_EffectLevel(a_EffectLevel)
{
}

} PlayerCallback(Radius, m_PosX, m_PosY, m_PosZ, m_PrimaryEffect, SecondaryEffect, EffectLevel);
GetWorld()->ForEachPlayer(PlayerCallback);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/BeaconEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class cBeaconEntity :
public:
// tolua_end

BLOCKENTITY_PROTODEF(cBeaconEntity);
BLOCKENTITY_PROTODEF(cBeaconEntity)

cBeaconEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);

Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/BlockEntityWithItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class cBlockEntityWithItems :
public:
// tolua_end

BLOCKENTITY_PROTODEF(cBlockEntityWithItems);
BLOCKENTITY_PROTODEF(cBlockEntityWithItems)

cBlockEntityWithItems(
BLOCKTYPE a_BlockType, // Type of the block that the entity represents
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/ChestEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class cChestEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cChestEntity);
BLOCKENTITY_PROTODEF(cChestEntity)

/** Constructor used for normal operation */
cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World, BLOCKTYPE a_Type);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/CommandBlockEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class cCommandBlockEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cCommandBlockEntity);
BLOCKENTITY_PROTODEF(cCommandBlockEntity)

/// Creates a new empty command block entity
cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/DispenserEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class cDispenserEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cDispenserEntity);
BLOCKENTITY_PROTODEF(cDispenserEntity)

/** Constructor used for normal operation */
cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/DropSpenserEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class cDropSpenserEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cDropSpenserEntity);
BLOCKENTITY_PROTODEF(cDropSpenserEntity)

cDropSpenserEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual ~cDropSpenserEntity();
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/DropperEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class cDropperEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cDropperEntity);
BLOCKENTITY_PROTODEF(cDropperEntity)

/// Constructor used for normal operation
cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/EnderChestEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class cEnderChestEntity :
public:
// tolua_end

BLOCKENTITY_PROTODEF(cEnderChestEntity);
BLOCKENTITY_PROTODEF(cEnderChestEntity)

cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual ~cEnderChestEntity();
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/FlowerPotEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class cFlowerPotEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cFlowerPotEntity);
BLOCKENTITY_PROTODEF(cFlowerPotEntity)

/** Creates a new flowerpot entity at the specified block coords. a_World may be nullptr */
cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/FurnaceEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class cFurnaceEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cFurnaceEntity);
BLOCKENTITY_PROTODEF(cFurnaceEntity)

/** Constructor used for normal operation */
cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/HopperEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class cHopperEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cHopperEntity);
BLOCKENTITY_PROTODEF(cHopperEntity)

/// Constructor used for normal operation
cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/JukeboxEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class cJukeboxEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cJukeboxEntity);
BLOCKENTITY_PROTODEF(cJukeboxEntity)

cJukeboxEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual ~cJukeboxEntity();
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/MobHeadEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class cMobHeadEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cMobHeadEntity);
BLOCKENTITY_PROTODEF(cMobHeadEntity)

/** Creates a new mob head entity at the specified block coords. a_World may be nullptr */
cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/NoteEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class cNoteEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cNoteEntity);
BLOCKENTITY_PROTODEF(cNoteEntity)

/// Creates a new note entity. a_World may be nullptr
cNoteEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockEntities/SignEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class cSignEntity :

// tolua_end

BLOCKENTITY_PROTODEF(cSignEntity);
BLOCKENTITY_PROTODEF(cSignEntity)

/// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
Expand Down
2 changes: 1 addition & 1 deletion src/BlockID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class Tester



BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString)
int BlockStringToType(const AString & a_BlockTypeString)
{
int res = atoi(a_BlockTypeString.c_str());
if ((res != 0) || (a_BlockTypeString.compare("0") == 0))
Expand Down
2 changes: 1 addition & 1 deletion src/BlockID.h
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ class cIniFile;
// tolua_begin

/// Translates a blocktype string into blocktype. Takes either a number or an items.ini alias as input. Returns -1 on failure.
extern BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString);
extern int BlockStringToType(const AString & a_BlockTypeString);

/// Translates an itemtype string into an item. Takes either a number, number^number, number:number or an items.ini alias as input. Returns true if successful.
extern bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item);
Expand Down
10 changes: 5 additions & 5 deletions src/Chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,18 +1869,18 @@ bool cChunk::AddClient(cClientHandle * a_Client)

void cChunk::RemoveClient(cClientHandle * a_Client)
{
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
for (cClientHandleList::iterator itrC = m_LoadedByClient.begin(); itrC != m_LoadedByClient.end(); ++itrC)
{
if (*itr != a_Client)
if (*itrC != a_Client)
{
continue;
}

m_LoadedByClient.erase(itr);
m_LoadedByClient.erase(itrC);

if (!a_Client->IsDestroyed())
{
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
for (cEntityList::iterator itrE = m_Entities.begin(); itrE != m_Entities.end(); ++itrE)
{
/*
// DEBUG:
Expand All @@ -1889,7 +1889,7 @@ void cChunk::RemoveClient(cClientHandle * a_Client)
(*itr)->GetUniqueID(), a_Client->GetUsername().c_str()
);
*/
a_Client->SendDestroyEntity(*(*itr));
a_Client->SendDestroyEntity(*(*itrE));
}
}
return;
Expand Down
6 changes: 3 additions & 3 deletions src/CraftingRecipes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void cCraftingRecipes::GetRecipe(cPlayer & a_Player, cCraftingGrid & a_CraftingG
}

// Built-in recipes:
std::auto_ptr<cRecipe> Recipe(FindRecipe(a_CraftingGrid.GetItems(), a_CraftingGrid.GetWidth(), a_CraftingGrid.GetHeight()));
std::unique_ptr<cRecipe> Recipe(FindRecipe(a_CraftingGrid.GetItems(), a_CraftingGrid.GetWidth(), a_CraftingGrid.GetHeight()));
a_Recipe.Clear();
if (Recipe.get() == nullptr)
{
Expand Down Expand Up @@ -377,7 +377,7 @@ void cCraftingRecipes::AddRecipeLine(int a_LineNum, const AString & a_RecipeLine
return;
}

std::auto_ptr<cCraftingRecipes::cRecipe> Recipe(new cCraftingRecipes::cRecipe);
std::unique_ptr<cCraftingRecipes::cRecipe> Recipe(new cCraftingRecipes::cRecipe);

// Parse the result:
AStringVector ResultSplit = StringSplit(Sides[0], ",");
Expand Down Expand Up @@ -758,7 +758,7 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::MatchRecipe(const cItem * a_Crafti
} // for y, for x

// The recipe has matched. Create a copy of the recipe and set its coords to match the crafting grid:
std::auto_ptr<cRecipe> Recipe(new cRecipe);
std::unique_ptr<cRecipe> Recipe(new cRecipe);
Recipe->m_Result = a_Recipe->m_Result;
Recipe->m_Width = a_Recipe->m_Width;
Recipe->m_Height = a_Recipe->m_Height;
Expand Down
2 changes: 1 addition & 1 deletion src/Entities/Minecart.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class cMinecartWithChest :
};

const cItem & GetSlot(int a_Idx) const { return m_Contents.GetSlot(a_Idx); }
void SetSlot(size_t a_Idx, const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); }
void SetSlot(size_t a_Idx, const cItem & a_Item) { m_Contents.SetSlot(static_cast<int>(a_Idx), a_Item); }

protected:
cItemGrid m_Contents;
Expand Down
6 changes: 3 additions & 3 deletions src/FurnaceRecipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void cFurnaceRecipe::AddFuelFromLine(const AString & a_Line, unsigned int a_Line
Line.erase(Line.begin()); // Remove the beginning "!"
Line.erase(std::remove_if(Line.begin(), Line.end(), isspace), Line.end());

std::auto_ptr<cItem> Item(new cItem);
std::unique_ptr<cItem> Item(new cItem);
int BurnTime;

const AStringVector & Sides = StringSplit(Line, "=");
Expand Down Expand Up @@ -157,8 +157,8 @@ void cFurnaceRecipe::AddRecipeFromLine(const AString & a_Line, unsigned int a_Li
Line.erase(std::remove_if(Line.begin(), Line.end(), isspace), Line.end());

int CookTime = 200;
std::auto_ptr<cItem> InputItem(new cItem());
std::auto_ptr<cItem> OutputItem(new cItem());
std::unique_ptr<cItem> InputItem(new cItem());
std::unique_ptr<cItem> OutputItem(new cItem());

const AStringVector & Sides = StringSplit(Line, "=");
if (Sides.size() != 2)
Expand Down
6 changes: 3 additions & 3 deletions src/Generating/ChunkGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ EMCSBiome cChunkGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ)
BLOCKTYPE cChunkGenerator::GetIniBlock(cIniFile & a_IniFile, const AString & a_SectionName, const AString & a_ValueName, const AString & a_Default)
{
AString BlockType = a_IniFile.GetValueSet(a_SectionName, a_ValueName, a_Default);
BLOCKTYPE Block = BlockStringToType(BlockType);
int Block = BlockStringToType(BlockType);
if (Block < 0)
{
LOGWARN("[%s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(), a_Default.c_str());
return BlockStringToType(a_Default);
return static_cast<BLOCKTYPE>(BlockStringToType(a_Default));
}
return Block;
return static_cast<BLOCKTYPE>(Block);
}


Expand Down
2 changes: 1 addition & 1 deletion src/Generating/CompoGenBiomal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class cPattern

// Fill the rest with stone:
static BlockInfo Stone = {E_BLOCK_STONE, 0};
for (size_t i = a_Count; i < cChunkDef::Height; i++)
for (int i = static_cast<int>(a_Count); i < cChunkDef::Height; i++)
{
m_Pattern[i] = Stone;
}
Expand Down
42 changes: 23 additions & 19 deletions src/Noise/OctavedNoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ class cOctavedNoise
}

// Generate the first octave directly into array:
const cOctave & FirstOctave = m_Octaves.front();
int ArrayCount = a_SizeX * a_SizeY;
FirstOctave.m_Noise.Generate2D(
a_Workspace, a_SizeX, a_SizeY,
a_StartX * FirstOctave.m_Frequency, a_EndX * FirstOctave.m_Frequency,
a_StartY * FirstOctave.m_Frequency, a_EndY * FirstOctave.m_Frequency
);
NOISE_DATATYPE Amplitude = FirstOctave.m_Amplitude;
for (int i = 0; i < ArrayCount; i++)
{
a_Array[i] = a_Workspace[i] * Amplitude;
const cOctave & FirstOctave = m_Octaves.front();
FirstOctave.m_Noise.Generate2D(
a_Workspace, a_SizeX, a_SizeY,
a_StartX * FirstOctave.m_Frequency, a_EndX * FirstOctave.m_Frequency,
a_StartY * FirstOctave.m_Frequency, a_EndY * FirstOctave.m_Frequency
);
NOISE_DATATYPE Amplitude = FirstOctave.m_Amplitude;
for (int i = 0; i < ArrayCount; i++)
{
a_Array[i] = a_Workspace[i] * Amplitude;
}
}

// Add each octave:
Expand Down Expand Up @@ -124,18 +126,20 @@ class cOctavedNoise
}

// Generate the first octave directly into array:
const cOctave & FirstOctave = m_Octaves.front();
int ArrayCount = a_SizeX * a_SizeY * a_SizeZ;
FirstOctave.m_Noise.Generate3D(
a_Workspace, a_SizeX, a_SizeY, a_SizeZ,
a_StartX * FirstOctave.m_Frequency, a_EndX * FirstOctave.m_Frequency,
a_StartY * FirstOctave.m_Frequency, a_EndY * FirstOctave.m_Frequency,
a_StartZ * FirstOctave.m_Frequency, a_EndZ * FirstOctave.m_Frequency
);
NOISE_DATATYPE Amplitude = FirstOctave.m_Amplitude;
for (int i = 0; i < ArrayCount; i++)
{
a_Array[i] = a_Workspace[i] * Amplitude;
const cOctave & FirstOctave = m_Octaves.front();
FirstOctave.m_Noise.Generate3D(
a_Workspace, a_SizeX, a_SizeY, a_SizeZ,
a_StartX * FirstOctave.m_Frequency, a_EndX * FirstOctave.m_Frequency,
a_StartY * FirstOctave.m_Frequency, a_EndY * FirstOctave.m_Frequency,
a_StartZ * FirstOctave.m_Frequency, a_EndZ * FirstOctave.m_Frequency
);
NOISE_DATATYPE Amplitude = FirstOctave.m_Amplitude;
for (int i = 0; i < ArrayCount; i++)
{
a_Array[i] = a_Workspace[i] * Amplitude;
}
}

// Add each octave:
Expand Down
4 changes: 2 additions & 2 deletions src/Noise/RidgedNoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class cRidgedNoise
);
for (int i = 0; i < ArrayCount; i++)
{
a_Array[i] = fabs(a_Array[i]);
a_Array[i] = std::abs(a_Array[i]);
}
}

Expand All @@ -77,7 +77,7 @@ class cRidgedNoise
);
for (int i = 0; i < ArrayCount; i++)
{
a_Array[i] = fabs(a_Array[i]);
a_Array[i] = std::abs(a_Array[i]);
}
}

Expand Down

0 comments on commit 883230a

Please sign in to comment.