Made -Weverything an error.
This commit is contained in:
parent
81c0116cf1
commit
dae9e5792a
@ -248,7 +248,7 @@ macro(set_exe_flags)
|
||||
endif()
|
||||
# clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math
|
||||
add_flags_cxx("-D__extern_always_inline=inline")
|
||||
add_flags_cxx("-Werror -Weverything -Wno-c++98-compat-pedantic -Wno-string-conversion")
|
||||
add_flags_cxx("-Weverything -Werror -Wno-c++98-compat-pedantic -Wno-string-conversion")
|
||||
add_flags_cxx("-Wno-exit-time-destructors -Wno-padded -Wno-weak-vtables")
|
||||
if ("${CLANG_VERSION}" VERSION_GREATER 3.0)
|
||||
# flags that are not present in 3.0
|
||||
|
@ -146,7 +146,12 @@ set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS -Wno-error)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(DeprecatedBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(LuaState.cpp COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(LuaWindow.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(ManualBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ManualBindings_World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(PluginLua.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -41,7 +41,7 @@ bool cLuaChunkStay::AddChunks(int a_ChunkCoordTableStackPos)
|
||||
|
||||
// Add each set of coords:
|
||||
int NumChunks = luaL_getn(L, a_ChunkCoordTableStackPos);
|
||||
m_Chunks.reserve((size_t)NumChunks);
|
||||
m_Chunks.reserve(static_cast<size_t>(NumChunks));
|
||||
for (int idx = 1; idx <= NumChunks; idx++)
|
||||
{
|
||||
// Push the idx-th element of the array onto stack top, check that it's a table:
|
||||
@ -133,7 +133,7 @@ void cLuaChunkStay::OnChunkAvailable(int a_ChunkX, int a_ChunkZ)
|
||||
if (m_OnChunkAvailable.IsValid())
|
||||
{
|
||||
cPluginLua::cOperation Op(m_Plugin);
|
||||
Op().Call((int)m_OnChunkAvailable, a_ChunkX, a_ChunkZ);
|
||||
Op().Call(static_cast<int>(m_OnChunkAvailable), a_ChunkX, a_ChunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ bool cLuaChunkStay::OnAllChunksAvailable(void)
|
||||
{
|
||||
// Call the callback:
|
||||
cPluginLua::cOperation Op(m_Plugin);
|
||||
Op().Call((int)m_OnAllChunksAvailable);
|
||||
Op().Call(static_cast<int>(m_OnAllChunksAvailable));
|
||||
|
||||
// Remove the callback references - they won't be needed anymore
|
||||
m_OnChunkAvailable.UnRef();
|
||||
|
@ -393,7 +393,7 @@ protected:
|
||||
*/
|
||||
bool PushFunction(const cRef & a_FnRef)
|
||||
{
|
||||
return PushFunction((int)a_FnRef);
|
||||
return PushFunction(static_cast<int>(a_FnRef));
|
||||
}
|
||||
|
||||
/** Pushes a function that is stored in a referenced table by name
|
||||
|
@ -98,11 +98,11 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
|
||||
{
|
||||
if ((res >= biFirstBiome) && (res < biNumBiomes))
|
||||
{
|
||||
return (EMCSBiome)res;
|
||||
return static_cast<EMCSBiome>(res);
|
||||
}
|
||||
else if ((res >= biFirstVariantBiome) && (res < biNumVariantBiomes))
|
||||
{
|
||||
return (EMCSBiome)res;
|
||||
return static_cast<EMCSBiome>(res);
|
||||
}
|
||||
// It was an invalid number
|
||||
return biInvalidBiome;
|
||||
|
@ -60,7 +60,7 @@ void InternalMergeBlocks(
|
||||
else
|
||||
{
|
||||
NIBBLETYPE FakeDestMeta = 0;
|
||||
Combinator(a_DstTypes[DstIdx], a_SrcTypes[SrcIdx], FakeDestMeta, (NIBBLETYPE)0);
|
||||
Combinator(a_DstTypes[DstIdx], a_SrcTypes[SrcIdx], FakeDestMeta, static_cast<NIBBLETYPE>(0));
|
||||
}
|
||||
++DstIdx;
|
||||
++SrcIdx;
|
||||
@ -620,7 +620,7 @@ void cBlockArea::DumpToRawFile(const AString & a_FileName)
|
||||
f.Write(&SizeX, 4);
|
||||
f.Write(&SizeY, 4);
|
||||
f.Write(&SizeZ, 4);
|
||||
unsigned char DataTypes = (unsigned char)GetDataTypes();
|
||||
unsigned char DataTypes = static_cast<unsigned char>(GetDataTypes());
|
||||
f.Write(&DataTypes, 1);
|
||||
size_t NumBlocks = GetBlockCount();
|
||||
if (HasBlockTypes())
|
||||
@ -2157,7 +2157,7 @@ void cBlockArea::ExpandBlockTypes(int a_SubMinX, int a_AddMaxX, int a_SubMinY, i
|
||||
int NewSizeX = m_Size.x + a_SubMinX + a_AddMaxX;
|
||||
int NewSizeY = m_Size.y + a_SubMinY + a_AddMaxY;
|
||||
int NewSizeZ = m_Size.z + a_SubMinZ + a_AddMaxZ;
|
||||
size_t BlockCount = (size_t)(NewSizeX * NewSizeY * NewSizeZ);
|
||||
size_t BlockCount = static_cast<size_t>(NewSizeX * NewSizeY * NewSizeZ);
|
||||
BLOCKTYPE * NewBlockTypes = new BLOCKTYPE[BlockCount];
|
||||
memset(NewBlockTypes, 0, BlockCount * sizeof(BLOCKTYPE));
|
||||
int OldIndex = 0;
|
||||
@ -2187,7 +2187,7 @@ void cBlockArea::ExpandNibbles(NIBBLEARRAY & a_Array, int a_SubMinX, int a_AddMa
|
||||
int NewSizeX = m_Size.x + a_SubMinX + a_AddMaxX;
|
||||
int NewSizeY = m_Size.y + a_SubMinY + a_AddMaxY;
|
||||
int NewSizeZ = m_Size.z + a_SubMinZ + a_AddMaxZ;
|
||||
size_t BlockCount = (size_t)(NewSizeX * NewSizeY * NewSizeZ);
|
||||
size_t BlockCount = static_cast<size_t>(NewSizeX * NewSizeY * NewSizeZ);
|
||||
NIBBLETYPE * NewNibbles = new NIBBLETYPE[BlockCount];
|
||||
memset(NewNibbles, 0, BlockCount * sizeof(NIBBLETYPE));
|
||||
int OldIndex = 0;
|
||||
|
@ -321,7 +321,7 @@ public:
|
||||
NIBBLETYPE * GetBlockMetas (void) const { return m_BlockMetas; } // NOTE: one byte per block!
|
||||
NIBBLETYPE * GetBlockLight (void) const { return m_BlockLight; } // NOTE: one byte per block!
|
||||
NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight; } // NOTE: one byte per block!
|
||||
size_t GetBlockCount(void) const { return (size_t)(m_Size.x * m_Size.y * m_Size.z); }
|
||||
size_t GetBlockCount(void) const { return static_cast<size_t>(m_Size.x * m_Size.y * m_Size.z); }
|
||||
int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const;
|
||||
|
||||
protected:
|
||||
|
@ -77,7 +77,7 @@ bool cBeaconEntity::IsValidEffect(cEntityEffect::eType a_Effect, char a_BeaconLe
|
||||
|
||||
default:
|
||||
{
|
||||
LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, (int)a_Effect);
|
||||
LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, static_cast<int>(a_Effect));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -228,9 +228,9 @@ void cBeaconEntity::GiveEffects(void)
|
||||
virtual bool Item(cPlayer * a_Player)
|
||||
{
|
||||
Vector3d PlayerPosition = Vector3d(a_Player->GetPosition());
|
||||
if (PlayerPosition.y > (double)m_PosY)
|
||||
if (PlayerPosition.y > static_cast<double>(m_PosY))
|
||||
{
|
||||
PlayerPosition.y = (double)m_PosY;
|
||||
PlayerPosition.y = static_cast<double>(m_PosY);
|
||||
}
|
||||
|
||||
// TODO: Vanilla minecraft uses an AABB check instead of a radius one
|
||||
|
@ -145,9 +145,9 @@ void cMobSpawnerEntity::SpawnEntity(void)
|
||||
break;
|
||||
}
|
||||
|
||||
int RelX = (int) (m_RelX + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0);
|
||||
int RelX = static_cast<int>(m_RelX + static_cast<double>(Random.NextFloat() - Random.NextFloat()) * 4.0);
|
||||
int RelY = m_RelY + Random.NextInt(3) - 1;
|
||||
int RelZ = (int) (m_RelZ + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0);
|
||||
int RelZ = static_cast<int>(m_RelZ + static_cast<double>(Random.NextFloat() - Random.NextFloat()) * 4.0);
|
||||
|
||||
cChunk * Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(RelX, RelZ);
|
||||
if ((Chunk == nullptr) || !Chunk->IsValid())
|
||||
@ -172,7 +172,12 @@ void cMobSpawnerEntity::SpawnEntity(void)
|
||||
if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cEntity::INVALID_ID)
|
||||
{
|
||||
EntitiesSpawned = true;
|
||||
Chunk->BroadcastSoundParticleEffect(2004, (int)(PosX * 8.0), (int)(RelY * 8.0), (int)(PosZ * 8.0), 0);
|
||||
Chunk->BroadcastSoundParticleEffect(
|
||||
2004,
|
||||
static_cast<int>(PosX * 8.0),
|
||||
static_cast<int>(RelY * 8.0),
|
||||
static_cast<int>(PosZ * 8.0),
|
||||
0);
|
||||
m_NearbyEntitiesNum++;
|
||||
}
|
||||
}
|
||||
@ -260,7 +265,7 @@ int cMobSpawnerEntity::GetNearbyMonsterNum(eMonsterType a_EntityType)
|
||||
return;
|
||||
}
|
||||
|
||||
cMonster * Mob = (cMonster *)a_Entity;
|
||||
cMonster * Mob = static_cast<cMonster *>(a_Entity);
|
||||
if (Mob->GetMobType() != m_EntityType)
|
||||
{
|
||||
return;
|
||||
|
@ -90,8 +90,13 @@ void cNoteEntity::MakeSound(void)
|
||||
m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK);
|
||||
|
||||
// TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all
|
||||
float calcPitch = pow(2.0f, ((float)m_Pitch - 12.0f) / 12.0f);
|
||||
m_World->BroadcastSoundEffect(sampleName, (double)m_PosX, (double)m_PosY, (double)m_PosZ, 3.0f, calcPitch);
|
||||
float calcPitch = pow(2.0f, static_cast<float>(m_Pitch - 12.0f) / 12.0f);
|
||||
m_World->BroadcastSoundEffect(
|
||||
sampleName,
|
||||
static_cast<double>(m_PosX),
|
||||
static_cast<double>(m_PosY),
|
||||
static_cast<double>(m_PosZ),
|
||||
3.0f, calcPitch);
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,8 +96,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Not a resolvable string, try pure numbers: "45:6", "45^6" etc.
|
||||
a_Item.m_ItemType = (short)atoi(Split[0].c_str());
|
||||
if ((a_Item.m_ItemType == 0) && (Split[0] != "0"))
|
||||
if (!StringToInteger(Split[0], a_Item.m_ItemType))
|
||||
{
|
||||
// Parsing the number failed
|
||||
return false;
|
||||
@ -111,9 +110,8 @@ public:
|
||||
a_Item.m_ItemCount = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
a_Item.m_ItemDamage = (short)atoi(Split[1].c_str());
|
||||
if ((a_Item.m_ItemDamage == 0) && (Split[1] != "0"))
|
||||
|
||||
if (!StringToInteger(Split[1], a_Item.m_ItemDamage))
|
||||
{
|
||||
// Parsing the number failed
|
||||
return false;
|
||||
@ -175,8 +173,16 @@ protected:
|
||||
{
|
||||
return;
|
||||
}
|
||||
short ItemType = (short)atoi(Split[0].c_str());
|
||||
short ItemDamage = (Split.size() > 1) ? (short)atoi(Split[1].c_str()) : -1;
|
||||
short ItemType;
|
||||
if (!StringToInteger(Split[0], ItemType))
|
||||
{
|
||||
ASSERT(!"Invalid item type");
|
||||
}
|
||||
short ItemDamage = -1;
|
||||
if (Split.size() > 1 && !StringToInteger(Split[1], ItemDamage))
|
||||
{
|
||||
ASSERT(!"Invalid item damage");
|
||||
}
|
||||
m_Map[a_Name] = std::make_pair(ItemType, ItemDamage);
|
||||
}
|
||||
} ;
|
||||
@ -288,11 +294,11 @@ AString ItemToFullString(const cItem & a_Item)
|
||||
eDimension StringToDimension(const AString & a_DimensionString)
|
||||
{
|
||||
// First try decoding as a number
|
||||
int res = atoi(a_DimensionString.c_str());
|
||||
if ((res != 0) || (a_DimensionString == "0"))
|
||||
int res;
|
||||
if (!StringToInteger(a_DimensionString, res))
|
||||
{
|
||||
// It was a valid number
|
||||
return (eDimension)res;
|
||||
return static_cast<eDimension>(res);
|
||||
}
|
||||
|
||||
// Decode using a built-in map:
|
||||
@ -350,7 +356,7 @@ AString DimensionToString(eDimension a_Dimension)
|
||||
} // for i - DimensionMap[]
|
||||
|
||||
// Not found
|
||||
LOGWARNING("Unknown dimension: \"%i\". Setting to Overworld", (int)a_Dimension);
|
||||
LOGWARNING("Unknown dimension: \"%i\". Setting to Overworld", static_cast<int>(a_Dimension));
|
||||
return "Overworld";
|
||||
}
|
||||
|
||||
@ -386,7 +392,7 @@ AString DamageTypeToString(eDamageType a_DamageType)
|
||||
|
||||
// Unknown damage type:
|
||||
ASSERT(!"Unknown DamageType");
|
||||
return Printf("dtUnknown_%d", (int)a_DamageType);
|
||||
return Printf("dtUnknown_%d", static_cast<int>(a_DamageType));
|
||||
}
|
||||
|
||||
|
||||
@ -397,11 +403,11 @@ AString DamageTypeToString(eDamageType a_DamageType)
|
||||
eDamageType StringToDamageType(const AString & a_DamageTypeString)
|
||||
{
|
||||
// First try decoding as a number:
|
||||
int res = atoi(a_DamageTypeString.c_str());
|
||||
if ((res != 0) || (a_DamageTypeString == "0"))
|
||||
int res;
|
||||
if (!StringToInteger(a_DamageTypeString, res))
|
||||
{
|
||||
// It was a valid number
|
||||
return (eDamageType)res;
|
||||
return static_cast<eDamageType>(res);
|
||||
}
|
||||
|
||||
// Decode using a built-in map:
|
||||
@ -462,7 +468,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
|
||||
} // for i - DamageTypeMap[]
|
||||
|
||||
// Not found:
|
||||
return (eDamageType)-1;
|
||||
return static_cast<eDamageType>(-1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
|
||||
{
|
||||
if (a_Info[i].m_Handler == nullptr)
|
||||
{
|
||||
a_Info[i].m_Handler = cBlockHandler::CreateBlockHandler((BLOCKTYPE) i);
|
||||
a_Info[i].m_Handler = cBlockHandler::CreateBlockHandler(static_cast<BLOCKTYPE>(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
a_Rotation = (a_Rotation / 360) * 4;
|
||||
|
||||
return ((char)a_Rotation + 2) % 4;
|
||||
return (static_cast<NIBBLETYPE>(a_Rotation + 2)) % 4;
|
||||
}
|
||||
|
||||
static Vector3i MetaDataToDirection(NIBBLETYPE a_MetaData)
|
||||
|
@ -245,10 +245,10 @@ public:
|
||||
if (a_BlockX > 0)
|
||||
{
|
||||
NIBBLETYPE DownMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||
return (NIBBLETYPE) ((DownMeta & 0x07) | 0x08 | (Meta << 4));
|
||||
return static_cast<NIBBLETYPE>((DownMeta & 0x07) | 0x08 | (Meta << 4));
|
||||
}
|
||||
// This is the top part of the door at the bottommost layer of the world, there's no bottom:
|
||||
return (NIBBLETYPE) (0x08 | (Meta << 4));
|
||||
return static_cast<NIBBLETYPE>(0x08 | (Meta << 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -256,7 +256,7 @@ public:
|
||||
if (a_BlockY < cChunkDef::Height - 1)
|
||||
{
|
||||
NIBBLETYPE UpMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY + 1, a_BlockZ);
|
||||
return (NIBBLETYPE) (Meta | (UpMeta << 4));
|
||||
return static_cast<NIBBLETYPE>(Meta | (UpMeta << 4));
|
||||
}
|
||||
// This is the bottom part of the door at the topmost layer of the world, there's no top:
|
||||
return Meta;
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
) override
|
||||
{
|
||||
a_BlockType = m_BlockType;
|
||||
NIBBLETYPE Meta = (NIBBLETYPE) a_Player->GetEquippedItem().m_ItemDamage;
|
||||
NIBBLETYPE Meta = static_cast<NIBBLETYPE>(a_Player->GetEquippedItem().m_ItemDamage);
|
||||
|
||||
// Set the correct metadata based on player equipped item (i.e. a_BlockMeta not initialised yet)
|
||||
switch (a_BlockFace)
|
||||
@ -104,7 +104,7 @@ public:
|
||||
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
{
|
||||
if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != (short)m_BlockType))
|
||||
if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != static_cast<short>(m_BlockType)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -95,6 +95,10 @@ SET (HDRS
|
||||
MetaRotator.h
|
||||
WorldInterface.h)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(BlockHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(BlockPiston.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
add_library(Blocks ${SRCS} ${HDRS})
|
||||
|
@ -155,24 +155,29 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(BiomeDef.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(BlockArea.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(BlockID.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(ByteBuffer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(ChunkData.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(ChunkMap.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=sign-conversion")
|
||||
set_source_files_properties(ClientHandle.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion -Wno-error=global-constructors")
|
||||
set_source_files_properties(IniFile.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(ByteBuffer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Chunk.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ChunkData.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ChunkMap.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=sign-conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ClientHandle.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Enchantments.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(IniFile.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Inventory.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
|
||||
set_source_files_properties(Item.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
|
||||
set_source_files_properties(Item.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ItemGrid.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
|
||||
set_source_files_properties(LightingThread.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion")
|
||||
set_source_files_properties(Map.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
|
||||
set_source_files_properties(LinearInterpolation.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Map.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(MobProximityCounter.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal")
|
||||
set_source_files_properties(MobSpawner.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(RCONServer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(Root.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shadow")
|
||||
set_source_files_properties(Root.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shadow -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Server.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Statistics.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(StringUtils.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
|
||||
set_source_files_properties(StringCompression.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(StringUtils.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Tracer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=missing-variable-declarations -Wno-error=missing-prototypes")
|
||||
endif()
|
||||
|
||||
|
@ -338,7 +338,7 @@ void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
|
||||
if ((*a_BiomeMap)[i] < 255)
|
||||
{
|
||||
// Normal MC biome, copy as-is:
|
||||
m_BiomeMap[i] = (unsigned char)((*a_BiomeMap)[i]);
|
||||
m_BiomeMap[i] = static_cast<unsigned char>((*a_BiomeMap)[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -342,7 +342,7 @@ AString cCompositeChat::ExtractText(void) const
|
||||
}
|
||||
case ptUrl:
|
||||
{
|
||||
Msg.append(((cUrlPart *)(*itr))->m_Url);
|
||||
Msg.append((static_cast<cUrlPart *>(*itr))->m_Url);
|
||||
break;
|
||||
}
|
||||
case ptShowAchievement:
|
||||
@ -423,7 +423,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
|
||||
|
||||
case cCompositeChat::ptClientTranslated:
|
||||
{
|
||||
const cCompositeChat::cClientTranslatedPart & p = (const cCompositeChat::cClientTranslatedPart &)**itr;
|
||||
const cCompositeChat::cClientTranslatedPart & p = static_cast<const cCompositeChat::cClientTranslatedPart &>(**itr);
|
||||
Part["translate"] = p.m_Text;
|
||||
Json::Value With;
|
||||
for (AStringVector::const_iterator itrW = p.m_Parameters.begin(), endW = p.m_Parameters.end(); itrW != endW; ++itr)
|
||||
@ -440,7 +440,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
|
||||
|
||||
case cCompositeChat::ptUrl:
|
||||
{
|
||||
const cCompositeChat::cUrlPart & p = (const cCompositeChat::cUrlPart &)**itr;
|
||||
const cCompositeChat::cUrlPart & p = static_cast<const cCompositeChat::cUrlPart &>(**itr);
|
||||
Part["text"] = p.m_Text;
|
||||
Json::Value Url;
|
||||
Url["action"] = "open_url";
|
||||
@ -453,7 +453,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
|
||||
case cCompositeChat::ptSuggestCommand:
|
||||
case cCompositeChat::ptRunCommand:
|
||||
{
|
||||
const cCompositeChat::cCommandPart & p = (const cCompositeChat::cCommandPart &)**itr;
|
||||
const cCompositeChat::cCommandPart & p = static_cast<const cCompositeChat::cCommandPart &>(**itr);
|
||||
Part["text"] = p.m_Text;
|
||||
Json::Value Cmd;
|
||||
Cmd["action"] = (p.m_PartType == cCompositeChat::ptRunCommand) ? "run_command" : "suggest_command";
|
||||
@ -465,7 +465,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
|
||||
|
||||
case cCompositeChat::ptShowAchievement:
|
||||
{
|
||||
const cCompositeChat::cShowAchievementPart & p = (const cCompositeChat::cShowAchievementPart &)**itr;
|
||||
const cCompositeChat::cShowAchievementPart & p = static_cast<const cCompositeChat::cShowAchievementPart &>(**itr);
|
||||
Part["translate"] = "chat.type.achievement";
|
||||
|
||||
Json::Value Ach;
|
||||
|
@ -373,7 +373,7 @@ void cCraftingRecipes::AddRecipeLine(int a_LineNum, const AString & a_RecipeLine
|
||||
AStringVector Sides = StringSplit(RecipeLine, "=");
|
||||
if (Sides.size() != 2)
|
||||
{
|
||||
LOGWARNING("crafting.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);
|
||||
LOGWARNING("crafting.txt: line %d: A single '=' was expected, got " SIZE_T_FMT, a_LineNum, Sides.size() - 1);
|
||||
LOGINFO("Offending line: \"%s\"", a_RecipeLine.c_str());
|
||||
return;
|
||||
}
|
||||
@ -833,7 +833,7 @@ void cCraftingRecipes::HandleFireworks(const cItem * a_CraftingGrid, cCraftingRe
|
||||
case E_ITEM_DYE:
|
||||
{
|
||||
int GridID = (itr->x + a_OffsetX) + a_GridStride * (itr->y + a_OffsetY);
|
||||
DyeColours.push_back(cFireworkItem::GetVanillaColourCodeFromDye((NIBBLETYPE)(a_CraftingGrid[GridID].m_ItemDamage & 0x0f)));
|
||||
DyeColours.push_back(cFireworkItem::GetVanillaColourCodeFromDye(static_cast<NIBBLETYPE>(a_CraftingGrid[GridID].m_ItemDamage & 0x0f)));
|
||||
break;
|
||||
}
|
||||
case E_ITEM_GUNPOWDER: break;
|
||||
|
@ -61,10 +61,11 @@ SET (HDRS
|
||||
WitherSkullEntity.h)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=switch-enum")
|
||||
set_source_files_properties(EntityEffect.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(Floater.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(Player.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=switch-enum -Wno-error=conversion")
|
||||
set_source_files_properties(ArrowEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(EntityEffect.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Floater.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Player.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=switch-enum -Wno-error=conversion -Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -22,7 +22,7 @@ cEnderCrystal::cEnderCrystal(double a_X, double a_Y, double a_Z)
|
||||
|
||||
void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle)
|
||||
{
|
||||
a_ClientHandle.SendSpawnObject(*this, 51, 0, (Byte)GetYaw(), (Byte)GetPitch());
|
||||
a_ClientHandle.SendSpawnObject(*this, 51, 0, static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,8 +205,8 @@ public:
|
||||
double GetSpeedZ (void) const { return m_Speed.z; }
|
||||
double GetWidth (void) const { return m_Width; }
|
||||
|
||||
int GetChunkX(void) const {return (int)floor(m_Pos.x / cChunkDef::Width); }
|
||||
int GetChunkZ(void) const {return (int)floor(m_Pos.z / cChunkDef::Width); }
|
||||
int GetChunkX(void) const {return static_cast<int>(floor(m_Pos.x / cChunkDef::Width)); }
|
||||
int GetChunkZ(void) const {return static_cast<int>(floor(m_Pos.z / cChunkDef::Width)); }
|
||||
|
||||
void SetHeadYaw (double a_HeadYaw);
|
||||
void SetHeight (double a_Height);
|
||||
|
@ -56,12 +56,12 @@ void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward);
|
||||
a_ClosestPlayer->DeltaExperience(m_Reward);
|
||||
|
||||
m_World->BroadcastSoundEffect("random.orb", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
|
||||
m_World->BroadcastSoundEffect("random.orb", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
|
||||
|
||||
Destroy();
|
||||
}
|
||||
a_Distance.Normalize();
|
||||
a_Distance *= ((float) (5.5 - Distance));
|
||||
a_Distance *= (static_cast<float>(5.5 - Distance));
|
||||
SetSpeedX( a_Distance.x);
|
||||
SetSpeedY( a_Distance.y);
|
||||
SetSpeedZ( a_Distance.z);
|
||||
|
@ -38,7 +38,7 @@ void cFallingBlock::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
// GetWorld()->BroadcastTeleportEntity(*this); // Test position
|
||||
|
||||
int BlockX = POSX_TOINT;
|
||||
int BlockY = (int)(GetPosY() - 0.5);
|
||||
int BlockY = static_cast<int>(GetPosY() - 0.5);
|
||||
int BlockZ = POSZ_TOINT;
|
||||
|
||||
if (BlockY < 0)
|
||||
|
@ -19,11 +19,11 @@ cFireChargeEntity::cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y
|
||||
|
||||
|
||||
|
||||
void cFireChargeEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cFireChargeEntity::Explode(Vector3i a_Block)
|
||||
{
|
||||
if (m_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
|
||||
if (m_World->GetBlock(a_Block) == E_BLOCK_AIR)
|
||||
{
|
||||
m_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 1);
|
||||
m_World->SetBlock(a_Block.x, a_Block.y, a_Block.z, E_BLOCK_FIRE, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ void cFireChargeEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cFireChargeEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
|
||||
{
|
||||
Destroy();
|
||||
Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
|
||||
Explode(a_HitPos.Floor());
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ void cFireChargeEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_
|
||||
void cFireChargeEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
|
||||
{
|
||||
Destroy();
|
||||
Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
|
||||
Explode(a_HitPos.Floor());
|
||||
|
||||
// TODO: Some entities are immune to hits
|
||||
a_EntityHit.StartBurning(5 * 20); // 5 seconds of burning
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void Explode(int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
void Explode(Vector3i a_Block);
|
||||
|
||||
// cProjectileEntity overrides:
|
||||
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
|
||||
|
@ -19,9 +19,9 @@ cGhastFireballEntity::cGhastFireballEntity(cEntity * a_Creator, double a_X, doub
|
||||
|
||||
|
||||
|
||||
void cGhastFireballEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cGhastFireballEntity::Explode(Vector3i a_Block)
|
||||
{
|
||||
m_World->DoExplosionAt(1, a_BlockX, a_BlockY, a_BlockZ, true, esGhastFireball, this);
|
||||
m_World->DoExplosionAt(1, a_Block.x, a_Block.y, a_Block.z, true, esGhastFireball, this);
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ void cGhastFireballEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cGhastFireballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
|
||||
{
|
||||
Destroy();
|
||||
Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
|
||||
Explode(a_HitPos.Floor());
|
||||
}
|
||||
|
||||
|
||||
@ -41,5 +41,5 @@ void cGhastFireballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace
|
||||
void cGhastFireballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
|
||||
{
|
||||
Destroy();
|
||||
Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
|
||||
Explode(a_HitPos.Floor());
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void Explode(int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
void Explode(Vector3i a_Block);
|
||||
|
||||
// cProjectileEntity overrides:
|
||||
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
|
||||
|
@ -62,7 +62,7 @@ void cItemFrame::KilledBy(TakeDamageInfo & a_TDI)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((a_TDI.Attacker != nullptr) && a_TDI.Attacker->IsPlayer() && !((cPlayer *)a_TDI.Attacker)->IsGameModeCreative())
|
||||
if ((a_TDI.Attacker != nullptr) && a_TDI.Attacker->IsPlayer() && !static_cast<cPlayer *>(a_TDI.Attacker)->IsGameModeCreative())
|
||||
{
|
||||
cItems Item;
|
||||
Item.push_back(m_Item);
|
||||
@ -83,7 +83,7 @@ void cItemFrame::KilledBy(TakeDamageInfo & a_TDI)
|
||||
|
||||
void cItemFrame::GetDrops(cItems & a_Items, cEntity * a_Killer)
|
||||
{
|
||||
if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !((cPlayer *)a_Killer)->IsGameModeCreative())
|
||||
if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !static_cast<cPlayer *>(a_Killer)->IsGameModeCreative())
|
||||
{
|
||||
a_Items.push_back(cItem(E_ITEM_ITEM_FRAME));
|
||||
}
|
||||
@ -96,7 +96,7 @@ void cItemFrame::GetDrops(cItems & a_Items, cEntity * a_Killer)
|
||||
void cItemFrame::SpawnOn(cClientHandle & a_ClientHandle)
|
||||
{
|
||||
super::SpawnOn(a_ClientHandle);
|
||||
a_ClientHandle.SendSpawnObject(*this, 71, GetProtocolFacing(), (Byte)GetYaw(), (Byte)GetPitch());
|
||||
a_ClientHandle.SendSpawnObject(*this, 71, GetProtocolFacing(), static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
|
||||
a_ClientHandle.SendEntityMetadata(*this);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
|
||||
|
||||
void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
|
||||
{
|
||||
a_ClientHandle.SendSpawnVehicle(*this, 10, (char)m_Payload); // 10 = Minecarts
|
||||
a_ClientHandle.SendSpawnVehicle(*this, 10, static_cast<char>(m_Payload)); // 10 = Minecarts
|
||||
a_ClientHandle.SendEntityMetadata(*this);
|
||||
}
|
||||
|
||||
@ -725,11 +725,11 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
|
||||
{
|
||||
if (GetSpeedZ() > 0)
|
||||
{
|
||||
BLOCKTYPE Block = m_World->GetBlock(POSX_TOINT, POSY_TOINT, (int)ceil(GetPosZ()));
|
||||
BLOCKTYPE Block = m_World->GetBlock(POSX_TOINT, POSY_TOINT, static_cast<int>(ceil(GetPosZ())));
|
||||
if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
|
||||
{
|
||||
// We could try to detect a block in front based purely on coordinates, but xoft made a bounding box system - why not use? :P
|
||||
cBoundingBox bbBlock(Vector3d(POSX_TOINT, POSY_TOINT, (int)ceil(GetPosZ())), 0.5, 1);
|
||||
cBoundingBox bbBlock(Vector3d(POSX_TOINT, POSY_TOINT, static_cast<int>(ceil(GetPosZ()))), 0.5, 1);
|
||||
cBoundingBox bbMinecart(Vector3d(GetPosX(), floor(GetPosY()), GetPosZ()), GetWidth() / 2, GetHeight());
|
||||
|
||||
if (bbBlock.DoesIntersect(bbMinecart))
|
||||
@ -762,10 +762,10 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
|
||||
{
|
||||
if (GetSpeedX() > 0)
|
||||
{
|
||||
BLOCKTYPE Block = m_World->GetBlock((int)ceil(GetPosX()), POSY_TOINT, POSZ_TOINT);
|
||||
BLOCKTYPE Block = m_World->GetBlock(static_cast<int>(ceil(GetPosX())), POSY_TOINT, POSZ_TOINT);
|
||||
if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
|
||||
{
|
||||
cBoundingBox bbBlock(Vector3d((int)ceil(GetPosX()), POSY_TOINT, POSZ_TOINT), 0.5, 1);
|
||||
cBoundingBox bbBlock(Vector3d(static_cast<int>(ceil(GetPosX())), POSY_TOINT, POSZ_TOINT), 0.5, 1);
|
||||
cBoundingBox bbMinecart(Vector3d(GetPosX(), floor(GetPosY()), GetPosZ()), GetWidth() / 2, GetHeight());
|
||||
|
||||
if (bbBlock.DoesIntersect(bbMinecart))
|
||||
@ -1003,7 +1003,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
|
||||
|
||||
bool cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
|
||||
{
|
||||
if ((TDI.Attacker != nullptr) && TDI.Attacker->IsPlayer() && ((cPlayer *)TDI.Attacker)->IsGameModeCreative())
|
||||
if ((TDI.Attacker != nullptr) && TDI.Attacker->IsPlayer() && static_cast<cPlayer *>(TDI.Attacker)->IsGameModeCreative())
|
||||
{
|
||||
Destroy();
|
||||
TDI.FinalDamage = GetMaxHealth(); // Instant hit for creative
|
||||
|
@ -33,7 +33,7 @@ void cPainting::SpawnOn(cClientHandle & a_Client)
|
||||
|
||||
void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
|
||||
{
|
||||
if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !((cPlayer *)a_Killer)->IsGameModeCreative())
|
||||
if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !static_cast<cPlayer *>(a_Killer)->IsGameModeCreative())
|
||||
{
|
||||
a_Items.push_back(cItem(E_ITEM_PAINTING));
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, s
|
||||
{
|
||||
return;
|
||||
}
|
||||
a_Duration = (int)(a_Duration * a_DistanceModifier);
|
||||
a_Duration = static_cast<int>(a_Duration * a_DistanceModifier);
|
||||
|
||||
m_EntityEffects[a_EffectType] = cEntityEffect::CreateEntityEffect(a_EffectType, a_Duration, a_Intensity, a_DistanceModifier);
|
||||
m_World->BroadcastEntityEffect(*this, a_EffectType, a_Intensity, static_cast<short>(a_Duration));
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
Vector3d EntityPos = a_Entity->GetPosition();
|
||||
double Distance = (EntityPos - m_Position).Length();
|
||||
|
||||
cItem & Item = ((cPickup *)a_Entity)->GetItem();
|
||||
cItem & Item = static_cast<cPickup *>(a_Entity)->GetItem();
|
||||
if ((Distance < 1.2) && Item.IsEqual(m_Pickup->GetItem()))
|
||||
{
|
||||
short CombineCount = Item.m_ItemCount;
|
||||
@ -52,7 +52,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Pickup->GetItem().AddCount((char)CombineCount);
|
||||
m_Pickup->GetItem().AddCount(static_cast<char>(CombineCount));
|
||||
Item.m_ItemCount -= CombineCount;
|
||||
|
||||
if (Item.m_ItemCount <= 0)
|
||||
@ -229,7 +229,7 @@ bool cPickup::CollectedBy(cPlayer & a_Dest)
|
||||
m_Item.m_ItemCount -= NumAdded;
|
||||
m_World->BroadcastCollectEntity(*this, a_Dest);
|
||||
// Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;)
|
||||
m_World->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
|
||||
m_World->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
|
||||
if (m_Item.m_ItemCount <= 0)
|
||||
{
|
||||
// All of the pickup has been collected, schedule the pickup for destroying
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
/// Converts an angle in radians into a byte representation used by the network protocol
|
||||
#define ANGLE_TO_PROTO(X) (Byte)(X * 255 / 360)
|
||||
#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
|
||||
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a
|
||||
m_ProjectileKind(a_Kind),
|
||||
m_CreatorData(
|
||||
((a_Creator != nullptr) ? a_Creator->GetUniqueID() : cEntity::INVALID_ID),
|
||||
((a_Creator != nullptr) ? (a_Creator->IsPlayer() ? ((cPlayer *)a_Creator)->GetName() : "") : ""),
|
||||
((a_Creator != nullptr) ? (a_Creator->IsPlayer() ? static_cast<cPlayer *>(a_Creator)->GetName() : "") : ""),
|
||||
((a_Creator != nullptr) ? a_Creator->GetEquippedWeapon().m_Enchantments : cEnchantments())
|
||||
),
|
||||
m_IsInGround(false)
|
||||
@ -238,7 +238,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a
|
||||
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height) :
|
||||
super(etProjectile, a_Pos.x, a_Pos.y, a_Pos.z, a_Width, a_Height),
|
||||
m_ProjectileKind(a_Kind),
|
||||
m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? ((cPlayer *)a_Creator)->GetName() : "", a_Creator->GetEquippedWeapon().m_Enchantments),
|
||||
m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? static_cast<cPlayer *>(a_Creator)->GetName() : "", a_Creator->GetEquippedWeapon().m_Enchantments),
|
||||
m_IsInGround(false)
|
||||
{
|
||||
SetSpeed(a_Speed);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
/// Converts an angle in radians into a byte representation used by the network protocol
|
||||
#define ANGLE_TO_PROTO(X) (Byte)(X * 255 / 360)
|
||||
#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cSplashPotionEntityCallback:
|
||||
@ -51,7 +51,7 @@ public:
|
||||
double Reduction = -0.25 * SplashDistance + 1.0;
|
||||
Reduction = std::max(Reduction, 0.0);
|
||||
|
||||
((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction);
|
||||
static_cast<cPawn *>(a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -116,7 +116,12 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
|
||||
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
|
||||
m_World->ForEachEntity(Callback);
|
||||
|
||||
m_World->BroadcastSoundParticleEffect(2002, (int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z), m_PotionColor);
|
||||
m_World->BroadcastSoundParticleEffect(
|
||||
2002,
|
||||
static_cast<int>(floor(a_HitPos.x)),
|
||||
static_cast<int>(floor(a_HitPos.y)),
|
||||
static_cast<int>(floor(a_HitPos.z)),
|
||||
m_PotionColor);
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d &
|
||||
int TotalDamage = 0;
|
||||
if (a_EntityHit.IsMob())
|
||||
{
|
||||
eMonsterType MobType = ((cMonster &) a_EntityHit).GetMobType();
|
||||
eMonsterType MobType = static_cast<cMonster &>(a_EntityHit).GetMobType();
|
||||
if (MobType == mtBlaze)
|
||||
{
|
||||
TotalDamage = 3;
|
||||
|
@ -77,7 +77,7 @@ void cFurnaceRecipe::ReloadRecipes(void)
|
||||
size_t FirstCommentSymbol = ParsingLine.find('#');
|
||||
if ((FirstCommentSymbol != AString::npos) && (FirstCommentSymbol != 0))
|
||||
{
|
||||
ParsingLine.erase(ParsingLine.begin() + (const long)FirstCommentSymbol, ParsingLine.end());
|
||||
ParsingLine.erase(ParsingLine.begin() + static_cast<const long>(FirstCommentSymbol), ParsingLine.end());
|
||||
}
|
||||
|
||||
switch (ParsingLine[0])
|
||||
@ -121,7 +121,7 @@ void cFurnaceRecipe::AddFuelFromLine(const AString & a_Line, unsigned int a_Line
|
||||
const AStringVector & Sides = StringSplit(Line, "=");
|
||||
if (Sides.size() != 2)
|
||||
{
|
||||
LOGWARNING("furnace.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);
|
||||
LOGWARNING("furnace.txt: line %d: A single '=' was expected, got " SIZE_T_FMT, a_LineNum, Sides.size() - 1);
|
||||
LOGINFO("Offending line: \"%s\"", a_Line.c_str());
|
||||
return;
|
||||
}
|
||||
@ -163,7 +163,7 @@ void cFurnaceRecipe::AddRecipeFromLine(const AString & a_Line, unsigned int a_Li
|
||||
const AStringVector & Sides = StringSplit(Line, "=");
|
||||
if (Sides.size() != 2)
|
||||
{
|
||||
LOGWARNING("furnace.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);
|
||||
LOGWARNING("furnace.txt: line %d: A single '=' was expected, got " SIZE_T_FMT, a_LineNum, Sides.size() - 1);
|
||||
LOGINFO("Offending line: \"%s\"", a_Line.c_str());
|
||||
return;
|
||||
}
|
||||
|
@ -73,17 +73,27 @@ SET (HDRS
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(ComposableGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Caves.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ChunkGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(CompoGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ComposableGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(DistortedHeightmap.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(EndGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(FinishGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch")
|
||||
set_source_files_properties(HeiGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(NetherFortGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(Noise3DGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(PieceGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(Prefab.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(RainbowRoadsGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(RoughRavines.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal")
|
||||
set_source_files_properties(StructGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch")
|
||||
set_source_files_properties(Ravines.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(RoughRavines.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal -Wno-error=old-style-cast")
|
||||
set_source_files_properties(StructGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ShapeGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(TestRailsGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(TwoHeights.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(UnderwaterBaseGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=switch-enum")
|
||||
set_source_files_properties(VillageGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=switch-enum")
|
||||
endif()
|
||||
|
@ -204,10 +204,10 @@ public:
|
||||
|
||||
// Accessors used by cChunkGenerator::Generator descendants:
|
||||
inline cChunkDef::BiomeMap & GetBiomeMap (void) { return m_BiomeMap; }
|
||||
inline cChunkDef::BlockTypes & GetBlockTypes (void) { return *((cChunkDef::BlockTypes *)m_BlockArea.GetBlockTypes()); }
|
||||
inline cChunkDef::BlockTypes & GetBlockTypes (void) { return *(reinterpret_cast<cChunkDef::BlockTypes *>(m_BlockArea.GetBlockTypes())); }
|
||||
// CANNOT, different compression!
|
||||
// inline cChunkDef::BlockNibbles & GetBlockMetas (void) { return *((cChunkDef::BlockNibbles *)m_BlockArea.GetBlockMetas()); }
|
||||
inline BlockNibbleBytes & GetBlockMetasUncompressed(void) { return *((BlockNibbleBytes *)m_BlockArea.GetBlockMetas()); }
|
||||
inline BlockNibbleBytes & GetBlockMetasUncompressed(void) { return *(reinterpret_cast<BlockNibbleBytes *>(m_BlockArea.GetBlockMetas())); }
|
||||
inline cChunkDef::HeightMap & GetHeightMap (void) { return m_HeightMap; }
|
||||
inline cEntityList & GetEntities (void) { return m_Entities; }
|
||||
inline cBlockEntityList & GetBlockEntities (void) { return m_BlockEntities; }
|
||||
|
@ -194,7 +194,7 @@ protected:
|
||||
{
|
||||
return;
|
||||
}
|
||||
a_ChunkDesc.SetBlockTypeMeta(RelX, m_FloorHeight + 1, RelZ, E_BLOCK_CHEST, (NIBBLETYPE)a_Chest.y);
|
||||
a_ChunkDesc.SetBlockTypeMeta(RelX, m_FloorHeight + 1, RelZ, E_BLOCK_CHEST, static_cast<NIBBLETYPE>(a_Chest.y));
|
||||
|
||||
// Fill the chest with random loot
|
||||
static const cLootProbab LootProbab[] =
|
||||
@ -217,7 +217,7 @@ protected:
|
||||
{ cItem(E_ITEM_NAME_TAG), 1, 1, 10 },
|
||||
} ;
|
||||
|
||||
cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(RelX, m_FloorHeight + 1, RelZ);
|
||||
cChestEntity * ChestEntity = static_cast<cChestEntity *>(a_ChunkDesc.GetBlockEntity(RelX, m_FloorHeight + 1, RelZ));
|
||||
ASSERT((ChestEntity != nullptr) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
|
||||
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
|
||||
int NumSlots = 3 + ((Noise.IntNoise3DInt(a_Chest.x, a_Chest.y, a_Chest.z) / 11) % 4);
|
||||
|
@ -69,7 +69,7 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
}
|
||||
|
||||
// Choose what block to use.
|
||||
NOISE_DATATYPE BlockType = m_Noise.IntNoise3D((int) ChunkX, y, (int) ChunkZ);
|
||||
NOISE_DATATYPE BlockType = m_Noise.IntNoise3D(static_cast<int>(ChunkX), y, static_cast<int>(ChunkZ));
|
||||
if (BlockType < -0.7)
|
||||
{
|
||||
TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM);
|
||||
@ -507,7 +507,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
for (int z = 0; z < cChunkDef::Width; z++)
|
||||
{
|
||||
int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
|
||||
const float zz = (float)BlockZ;
|
||||
const float zz = static_cast<float>(BlockZ);
|
||||
for (int x = 0; x < cChunkDef::Width; x++)
|
||||
{
|
||||
int BlockX = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
|
||||
@ -528,7 +528,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
continue;
|
||||
}
|
||||
|
||||
const float xx = (float)BlockX;
|
||||
const float xx = static_cast<float>(BlockX);
|
||||
float val1 = m_Noise.CubicNoise2D(xx * 0.1f, zz * 0.1f);
|
||||
float val2 = m_Noise.CubicNoise2D(xx * 0.01f, zz * 0.01f);
|
||||
switch (a_ChunkDesc.GetBlockType(x, Top, z))
|
||||
@ -563,7 +563,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
}
|
||||
else if ((val1 > 0.5) && (val2 < -0.5))
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, ++Top, z, E_BLOCK_PUMPKIN, (int)(val3 * 8) % 4);
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, ++Top, z, E_BLOCK_PUMPKIN, static_cast<int>(val3 * 8) % 4);
|
||||
}
|
||||
break;
|
||||
} // case E_BLOCK_GRASS
|
||||
@ -650,9 +650,9 @@ void cFinishGenSoulsandRims::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
continue;
|
||||
}
|
||||
|
||||
NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(xx)) / 32;
|
||||
NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(zz)) / 32;
|
||||
NOISE_DATATYPE CompBlock = m_Noise.CubicNoise3D(NoiseX, (float) (y) / 4, NoiseY);
|
||||
NOISE_DATATYPE NoiseX = (static_cast<NOISE_DATATYPE>(xx)) / 32;
|
||||
NOISE_DATATYPE NoiseY = (static_cast<NOISE_DATATYPE>(zz)) / 32;
|
||||
NOISE_DATATYPE CompBlock = m_Noise.CubicNoise3D(NoiseX, static_cast<float>(y) / 4, NoiseY);
|
||||
if (CompBlock < 0)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SOULSAND);
|
||||
|
@ -64,13 +64,13 @@ cGridStructGen::cGridStructGen(
|
||||
LOG("Grid Size cannot be zero, setting to 1");
|
||||
m_GridSizeZ = 1;
|
||||
}
|
||||
size_t NumStructuresPerQuery = (size_t)(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
|
||||
size_t NumStructuresPerQuery = static_cast<size_t>(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
|
||||
if (NumStructuresPerQuery > m_MaxCacheSize)
|
||||
{
|
||||
m_MaxCacheSize = NumStructuresPerQuery * 4;
|
||||
LOGINFO(
|
||||
"cGridStructGen: The cache size is too small (%u), increasing the cache size to %u to avoid inefficiency.",
|
||||
(unsigned)a_MaxCacheSize, (unsigned)m_MaxCacheSize
|
||||
static_cast<unsigned>(a_MaxCacheSize), static_cast<unsigned>(m_MaxCacheSize)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ cMineShaft * cMineShaftCorridor::CreateAndFit(
|
||||
{
|
||||
cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ);
|
||||
BoundingBox.p2.y += 3;
|
||||
int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7;
|
||||
int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + static_cast<int>(a_ParentSystem.m_MineShafts.size()), a_PivotZ) / 7;
|
||||
int NumSegments = 2 + (rnd) % (MAX_SEGMENTS - 1); // 2 .. MAX_SEGMENTS
|
||||
switch (a_Direction)
|
||||
{
|
||||
@ -795,7 +795,7 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
|
||||
)
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, m_BoundingBox.p1.y + 1, z, E_BLOCK_CHEST, Meta);
|
||||
cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(x, m_BoundingBox.p1.y + 1, z);
|
||||
cChestEntity * ChestEntity = static_cast<cChestEntity *>(a_ChunkDesc.GetBlockEntity(x, m_BoundingBox.p1.y + 1, z));
|
||||
ASSERT((ChestEntity != nullptr) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
|
||||
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
|
||||
int NumSlots = 3 + ((Noise.IntNoise3DInt(x, m_BoundingBox.p1.y, z) / 11) % 4);
|
||||
@ -985,7 +985,7 @@ cMineShaft * cMineShaftCrossing::CreateAndFit(
|
||||
)
|
||||
{
|
||||
cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ);
|
||||
int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7;
|
||||
int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + static_cast<int>(a_ParentSystem.m_MineShafts.size()), a_PivotZ) / 7;
|
||||
BoundingBox.p2.y += 3;
|
||||
if ((rnd % 4) < 2)
|
||||
{
|
||||
@ -1126,7 +1126,7 @@ cMineShaft * cMineShaftStaircase::CreateAndFit(
|
||||
cNoise & a_Noise
|
||||
)
|
||||
{
|
||||
int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7;
|
||||
int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + static_cast<int>(a_ParentSystem.m_MineShafts.size()), a_PivotZ) / 7;
|
||||
cCuboid Box;
|
||||
switch (a_Direction)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
int BlockY = 64;
|
||||
|
||||
// Generate pieces:
|
||||
for (int i = 0; m_Pieces.size() < (size_t)(a_MaxDepth * a_MaxDepth / 8 + a_MaxDepth); i++)
|
||||
for (int i = 0; m_Pieces.size() < static_cast<size_t>(a_MaxDepth * a_MaxDepth / 8 + a_MaxDepth); i++)
|
||||
{
|
||||
cBFSPieceGenerator pg(cNetherFortGen::m_PiecePool, a_Seed + i);
|
||||
pg.PlacePieces(a_OriginX, BlockY, a_OriginZ, a_MaxDepth, m_Pieces);
|
||||
@ -55,7 +55,7 @@ public:
|
||||
{
|
||||
for (cPlacedPieces::const_iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
|
||||
{
|
||||
const cPrefab & Prefab = (const cPrefab &)((*itr)->GetPiece());
|
||||
const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
|
||||
Prefab.Draw(a_Chunk, *itr);
|
||||
} // for itr - m_PlacedPieces[]
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
|
||||
/** Imprints the piece in the specified chunk. Assumes they intersect. */
|
||||
void ImprintInChunk(cChunkDesc & a_ChunkDesc, const Vector3i & a_Pos, int a_NumCCWRotations)
|
||||
void ImprintInChunk(cChunkDesc & a_ChunkDesc, const Vector3i & a_Pos, int a_NumCCWRotations) const
|
||||
{
|
||||
int BlockX = a_ChunkDesc.GetChunkX() * cChunkDef::Width;
|
||||
int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
|
||||
@ -227,7 +227,7 @@ void cPOCPieceGenerator::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
continue;
|
||||
}
|
||||
|
||||
((cPOCPiece &)(*itr)->GetPiece()).ImprintInChunk(a_ChunkDesc, Pos, (*itr)->GetNumCCWRotations());
|
||||
(static_cast<const cPOCPiece &>((*itr)->GetPiece())).ImprintInChunk(a_ChunkDesc, Pos, (*itr)->GetNumCCWRotations());
|
||||
} // for itr - m_Pieces[]
|
||||
a_ChunkDesc.UpdateHeightmap();
|
||||
}
|
||||
|
@ -394,9 +394,9 @@ cPlacedPiece * cPieceGenerator::PlaceStartingPiece(int a_BlockX, int a_BlockY, i
|
||||
int NumRotations = 1;
|
||||
for (size_t i = 1; i < ARRAYCOUNT(Rotations); i++)
|
||||
{
|
||||
if (StartingPiece->CanRotateCCW((int)i))
|
||||
if (StartingPiece->CanRotateCCW(static_cast<int>(i)))
|
||||
{
|
||||
Rotations[NumRotations] = (int)i;
|
||||
Rotations[NumRotations] = static_cast<int>(i);
|
||||
NumRotations += 1;
|
||||
}
|
||||
}
|
||||
|
@ -348,13 +348,13 @@ void cPrefab::ParseCharMap(CharMap & a_CharMapOut, const char * a_CharMapDef)
|
||||
LOGWARNING("Bad prefab CharMap definition line: \"%s\", skipping.", itr->c_str());
|
||||
continue;
|
||||
}
|
||||
unsigned char Src = (unsigned char)CharDef[0][0];
|
||||
unsigned char Src = static_cast<unsigned char>(CharDef[0][0]);
|
||||
ASSERT(a_CharMapOut[Src].m_BlockMeta == 16); // This letter has not been assigned yet?
|
||||
a_CharMapOut[Src].m_BlockType = (BLOCKTYPE)atoi(CharDef[1].c_str());
|
||||
a_CharMapOut[Src].m_BlockType = static_cast<BLOCKTYPE>(atoi(CharDef[1].c_str()));
|
||||
NIBBLETYPE BlockMeta = 0;
|
||||
if ((NumElements >= 3) && !CharDef[2].empty())
|
||||
{
|
||||
BlockMeta = (NIBBLETYPE)atoi(CharDef[2].c_str());
|
||||
BlockMeta = static_cast<NIBBLETYPE>(atoi(CharDef[2].c_str()));
|
||||
ASSERT((BlockMeta <= 15));
|
||||
}
|
||||
a_CharMapOut[Src].m_BlockMeta = BlockMeta;
|
||||
@ -372,7 +372,7 @@ void cPrefab::ParseBlockImage(const CharMap & a_CharMap, const char * a_BlockIma
|
||||
{
|
||||
for (int z = 0; z < m_Size.z; z++)
|
||||
{
|
||||
const unsigned char * BlockImage = (const unsigned char *)a_BlockImage + y * m_Size.x * m_Size.z + z * m_Size.x;
|
||||
const unsigned char * BlockImage = reinterpret_cast<const unsigned char *>(a_BlockImage + y * m_Size.x * m_Size.z + z * m_Size.x);
|
||||
for (int x = 0; x < m_Size.x; x++)
|
||||
{
|
||||
const sBlockTypeDef & MappedValue = a_CharMap[BlockImage[x]];
|
||||
@ -424,7 +424,7 @@ void cPrefab::ParseConnectors(const char * a_ConnectorsDef)
|
||||
m_Connectors.push_back(cPiece::cConnector(
|
||||
atoi(Coords[0].c_str()), atoi(Coords[1].c_str()), atoi(Coords[2].c_str()), // Connector pos
|
||||
atoi(Defs[0].c_str()), // Connector type
|
||||
(eBlockFace)BlockFace
|
||||
static_cast<eBlockFace>(BlockFace)
|
||||
));
|
||||
} // for itr - Lines[]
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ void cPrefabPiecePool::AddStartingPieceDefs(const cPrefab::sDef * a_StartingPiec
|
||||
|
||||
void cPrefabPiecePool::AddToPerConnectorMap(cPrefab * a_Prefab)
|
||||
{
|
||||
cPiece::cConnectors Connectors = ((const cPiece *)a_Prefab)->GetConnectors();
|
||||
cPiece::cConnectors Connectors = (static_cast<const cPiece *>(a_Prefab))->GetConnectors();
|
||||
for (cPiece::cConnectors::const_iterator itr = Connectors.begin(), end = Connectors.end(); itr != end; ++itr)
|
||||
{
|
||||
m_PiecesByConnector[itr->m_Type].push_back(a_Prefab);
|
||||
@ -122,7 +122,7 @@ cPieces cPrefabPiecePool::GetStartingPieces(void)
|
||||
|
||||
int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece)
|
||||
{
|
||||
return ((const cPrefab &)a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
|
||||
return (static_cast<const cPrefab &>(a_NewPiece)).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const c
|
||||
|
||||
int cPrefabPiecePool::GetStartingPieceWeight(const cPiece & a_NewPiece)
|
||||
{
|
||||
return ((const cPrefab &)a_NewPiece).GetDefaultWeight();
|
||||
return (static_cast<const cPrefab &>(a_NewPiece)).GetDefaultWeight();
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
{
|
||||
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
|
||||
{
|
||||
cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
|
||||
const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
|
||||
Prefab.Draw(a_Chunk, *itr);
|
||||
} // for itr - m_PlacedPieces[]
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
{
|
||||
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
|
||||
{
|
||||
cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
|
||||
const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
|
||||
Prefab.Draw(a_Chunk, *itr);
|
||||
} // for itr - m_PlacedPieces[]
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ inline void PushSomeColumns(int a_BlockX, int a_Height, int a_BlockZ, int a_Colu
|
||||
{
|
||||
int x = a_BlockX + a_Coords[i].x;
|
||||
int z = a_BlockZ + a_Coords[i].z;
|
||||
if (a_Noise.IntNoise3DInt(x + 64 * a_Seq, a_Height + (int)i, z + 64 * a_Seq) <= a_Chance)
|
||||
if (a_Noise.IntNoise3DInt(x + 64 * a_Seq, a_Height + static_cast<int>(i), z + 64 * a_Seq) <= a_Chance)
|
||||
{
|
||||
for (int j = 0; j < a_ColumnHeight; j++)
|
||||
{
|
||||
@ -843,7 +843,7 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise
|
||||
{
|
||||
break;
|
||||
}
|
||||
ASSERT((size_t)LayerSize < ARRAYCOUNT(BigOs));
|
||||
ASSERT(static_cast<size_t>(LayerSize) < ARRAYCOUNT(BigOs));
|
||||
PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigOs[LayerSize].Coords, BigOs[LayerSize].Count, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER);
|
||||
h--;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
{
|
||||
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
|
||||
{
|
||||
cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
|
||||
const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
|
||||
Prefab.Draw(a_Chunk, *itr);
|
||||
} // for itr - m_PlacedPieces[]
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((const cPrefab &)a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
|
||||
return static_cast<const cPrefab &>(a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
|
||||
}
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ public:
|
||||
|
||||
// If the central piece should be moved to ground, move it, and
|
||||
// check all of its dependents and move those that are strictly connector-driven based on its new Y coord:
|
||||
if (((cPrefab &)m_Pieces[0]->GetPiece()).ShouldMoveToGround())
|
||||
if (static_cast<const cPrefab &>(m_Pieces[0]->GetPiece()).ShouldMoveToGround())
|
||||
{
|
||||
int OrigPosY = m_Pieces[0]->GetCoords().y;
|
||||
PlacePieceOnGround(*m_Pieces[0]);
|
||||
@ -197,7 +197,7 @@ protected:
|
||||
m_HeightGen->GenHeightMap(a_Chunk.GetChunkX(), a_Chunk.GetChunkZ(), HeightMap);
|
||||
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
|
||||
{
|
||||
cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
|
||||
const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
|
||||
if ((*itr)->GetPiece().GetSize().y == 1)
|
||||
{
|
||||
// It's a road, special handling (change top terrain blocks to m_RoadBlock)
|
||||
@ -319,7 +319,7 @@ protected:
|
||||
{
|
||||
if (
|
||||
(a_PlacedPieces[i]->GetParent() == Pivot) && // It is a direct dependant of the pivot
|
||||
!((const cPrefab &)a_PlacedPieces[i]->GetPiece()).ShouldMoveToGround() // It attaches strictly by connectors
|
||||
!(static_cast<const cPrefab &>(a_PlacedPieces[i]->GetPiece())).ShouldMoveToGround() // It attaches strictly by connectors
|
||||
)
|
||||
{
|
||||
a_PlacedPieces[i]->MoveToGroundBy(a_HeightDifference);
|
||||
|
@ -25,7 +25,7 @@ SET (HDRS
|
||||
SslHTTPConnection.h)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(HTTPServer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||
set_source_files_properties(HTTPServer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=old-style-cast")
|
||||
set_source_files_properties(HTTPConnection.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
endif()
|
||||
|
||||
|
@ -213,7 +213,7 @@ void cHTTPConnection::OnReceivedData(const char * a_Data, size_t a_Size)
|
||||
ASSERT(m_CurrentRequest != nullptr);
|
||||
if (m_CurrentRequestBodyRemaining > 0)
|
||||
{
|
||||
size_t BytesToConsume = std::min(m_CurrentRequestBodyRemaining, (size_t)a_Size);
|
||||
size_t BytesToConsume = std::min(m_CurrentRequestBodyRemaining, static_cast<size_t>(a_Size));
|
||||
m_HTTPServer.RequestBody(*this, *m_CurrentRequest, a_Data, BytesToConsume);
|
||||
m_CurrentRequestBodyRemaining -= BytesToConsume;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void cSslHTTPConnection::OnReceivedData(const char * a_Data, size_t a_Size)
|
||||
int NumRead = m_Ssl.ReadPlain(Buffer, sizeof(Buffer));
|
||||
if (NumRead > 0)
|
||||
{
|
||||
super::OnReceivedData(Buffer, (size_t)NumRead);
|
||||
super::OnReceivedData(Buffer, static_cast<size_t>(NumRead));
|
||||
}
|
||||
else if (NumRead == POLARSSL_ERR_NET_WANT_READ)
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ int cIniFile::FindKey(const AString & a_KeyName) const
|
||||
{
|
||||
if (CheckCase(names[keyID]) == CaseKeyName)
|
||||
{
|
||||
return (int)keyID;
|
||||
return static_cast<int>(keyID);
|
||||
}
|
||||
}
|
||||
return noID;
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
int FindValue(const int keyID, const AString & valuename) const;
|
||||
|
||||
/// Returns number of keys currently in the ini
|
||||
int GetNumKeys(void) const { return (int)keys.size(); }
|
||||
int GetNumKeys(void) const { return static_cast<int>(keys.size()); }
|
||||
|
||||
/// Add a key name
|
||||
int AddKeyName(const AString & keyname) override;
|
||||
@ -173,7 +173,7 @@ public:
|
||||
// Header comments are those comments before the first key.
|
||||
|
||||
/// Returns the number of header comments
|
||||
int GetNumHeaderComments(void) {return (int)comments.size();}
|
||||
int GetNumHeaderComments(void) {return static_cast<int>(comments.size());}
|
||||
|
||||
/// Adds a header comment
|
||||
void AddHeaderComment(const AString & comment);
|
||||
|
@ -358,7 +358,7 @@ int cItemGrid::RemoveItem(const cItem & a_ItemStack)
|
||||
|
||||
if (m_Slots[i].IsEqual(a_ItemStack))
|
||||
{
|
||||
int NumToRemove = std::min(NumLeft, (int)m_Slots[i].m_ItemCount);
|
||||
int NumToRemove = std::min(NumLeft, static_cast<int>(m_Slots[i].m_ItemCount));
|
||||
NumLeft -= NumToRemove;
|
||||
m_Slots[i].m_ItemCount -= NumToRemove;
|
||||
|
||||
|
@ -57,7 +57,7 @@ SET (HDRS
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(ItemHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum")
|
||||
set_source_files_properties(ItemHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=old-style-cast -Wno-error=switch-enum")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
ASSERT(a_Player != nullptr);
|
||||
|
||||
int BowCharge = a_Player->FinishChargingBow();
|
||||
double Force = (double)BowCharge / 20.0;
|
||||
double Force = static_cast<double>(BowCharge) / 20.0;
|
||||
Force = (Force * Force + 2.0 * Force) / 3.0; // This formula is used by the 1.6.2 client
|
||||
if (Force < 0.1)
|
||||
{
|
||||
@ -80,7 +80,14 @@ public:
|
||||
Arrow = nullptr;
|
||||
return;
|
||||
}
|
||||
a_Player->GetWorld()->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY(), a_Player->GetPosZ(), 0.5, (float)Force);
|
||||
a_Player->GetWorld()->BroadcastSoundEffect(
|
||||
"random.bow",
|
||||
a_Player->GetPosX(),
|
||||
a_Player->GetPosY(),
|
||||
a_Player->GetPosZ(),
|
||||
0.5,
|
||||
static_cast<float>(Force)
|
||||
);
|
||||
if (!a_Player->IsGameModeCreative())
|
||||
{
|
||||
if (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchInfinity) == 0)
|
||||
|
@ -236,7 +236,7 @@ public:
|
||||
m_EntryFace = static_cast<eBlockFace>(a_CBEntryFace);
|
||||
if (!cFluidSimulator::CanWashAway(a_CBBlockType) && !IsBlockLiquid(a_CBBlockType))
|
||||
{
|
||||
AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, (eBlockFace)a_CBEntryFace); // Was an unwashawayable block, can't overwrite it!
|
||||
AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, static_cast<eBlockFace>(a_CBEntryFace)); // Was an unwashawayable block, can't overwrite it!
|
||||
}
|
||||
m_Pos.Set(a_CBBlockX, a_CBBlockY, a_CBBlockZ); // (Block could be washed away, replace it)
|
||||
return true; // Abort tracing
|
||||
|
@ -43,8 +43,8 @@ class cReader :
|
||||
{
|
||||
// Copy the entire heightmap, distribute it into the 3x3 chunk blob:
|
||||
typedef struct {HEIGHTTYPE m_Row[16]; } ROW;
|
||||
ROW * InputRows = (ROW *)a_Heightmap;
|
||||
ROW * OutputRows = (ROW *)m_HeightMap;
|
||||
const ROW * InputRows = reinterpret_cast<const ROW *>(a_Heightmap);
|
||||
ROW * OutputRows = reinterpret_cast<ROW *>(m_HeightMap);
|
||||
int InputIdx = 0;
|
||||
int OutputIdx = m_ReadingChunkX + m_ReadingChunkZ * cChunkDef::Width * 3;
|
||||
for (int z = 0; z < cChunkDef::Width; z++)
|
||||
@ -217,7 +217,7 @@ void cLightingThread::Execute(void)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Item = (cLightingChunkStay *)m_Queue.front();
|
||||
Item = static_cast<cLightingChunkStay *>(m_Queue.front());
|
||||
m_Queue.pop_front();
|
||||
if (m_Queue.empty())
|
||||
{
|
||||
|
@ -96,17 +96,17 @@ bool cLineBlockTracer::Trace(double a_StartX, double a_StartY, double a_StartZ,
|
||||
m_Callbacks->OnIntoWorld(m_StartX, m_StartY, m_StartZ);
|
||||
}
|
||||
|
||||
m_CurrentX = (int)floor(m_StartX);
|
||||
m_CurrentY = (int)floor(m_StartY);
|
||||
m_CurrentZ = (int)floor(m_StartZ);
|
||||
m_CurrentX = static_cast<int>(floor(m_StartX));
|
||||
m_CurrentY = static_cast<int>(floor(m_StartY));
|
||||
m_CurrentZ = static_cast<int>(floor(m_StartZ));
|
||||
|
||||
m_DiffX = m_EndX - m_StartX;
|
||||
m_DiffY = m_EndY - m_StartY;
|
||||
m_DiffZ = m_EndZ - m_StartZ;
|
||||
|
||||
// The actual trace is handled with ChunkMapCS locked by calling our Item() for the specified chunk
|
||||
int BlockX = (int)floor(m_StartX);
|
||||
int BlockZ = (int)floor(m_StartZ);
|
||||
int BlockX = static_cast<int>(floor(m_StartX));
|
||||
int BlockZ = static_cast<int>(floor(m_StartZ));
|
||||
int ChunkX, ChunkZ;
|
||||
cChunkDef::BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ);
|
||||
return m_World->DoWithChunk(ChunkX, ChunkZ, *this);
|
||||
@ -120,7 +120,7 @@ void cLineBlockTracer::FixStartAboveWorld(void)
|
||||
{
|
||||
// We must set the start Y to less than cChunkDef::Height so that it is considered inside the world later on
|
||||
// Therefore we use an EPS-offset from the height, as small as reasonably possible.
|
||||
const double Height = (double)cChunkDef::Height - 0.00001;
|
||||
const double Height = static_cast<double>(cChunkDef::Height) - 0.00001;
|
||||
CalcXZIntersection(Height, m_StartX, m_StartZ);
|
||||
m_StartY = Height;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "LoggerListeners.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <io.h> // Needed for _isatty(), not available on Linux
|
||||
#include <time.h>
|
||||
@ -280,7 +282,9 @@ cFileListener::cFileListener(void)
|
||||
{
|
||||
cFile::CreateFolder(FILE_IO_PREFIX + AString("logs"));
|
||||
AString FileName;
|
||||
FileName = Printf("%s%sLOG_%d.txt", FILE_IO_PREFIX, "logs/", (int)time(nullptr));
|
||||
auto time = std::chrono::system_clock::now();
|
||||
FileName = Printf("%s%sLOG_%d.txt", FILE_IO_PREFIX, "logs/",
|
||||
std::chrono::duration_cast<std::chrono::duration<int, std::milli>>(time.time_since_epoch()).count());
|
||||
m_File.Open(FileName, cFile::fmAppend);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ cMap * cMapManager::CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cMap Map((unsigned)m_MapData.size(), a_CenterX, a_CenterY, m_World, a_Scale);
|
||||
cMap Map(static_cast<unsigned>(m_MapData.size()), a_CenterX, a_CenterY, m_World, a_Scale);
|
||||
|
||||
m_MapData.push_back(Map);
|
||||
|
||||
@ -151,7 +151,7 @@ void cMapManager::SaveMapData(void)
|
||||
|
||||
cIDCountSerializer IDSerializer(m_World->GetName());
|
||||
|
||||
IDSerializer.SetMapCount((unsigned)m_MapData.size());
|
||||
IDSerializer.SetMapCount(static_cast<unsigned>(m_MapData.size()));
|
||||
|
||||
if (!IDSerializer.Save())
|
||||
{
|
||||
|
@ -76,8 +76,8 @@ public:
|
||||
|
||||
inline void RotateX(T a_RX)
|
||||
{
|
||||
T sx = (T) sin(a_RX * M_PI / 180);
|
||||
T cx = (T) cos(a_RX * M_PI / 180);
|
||||
T sx = static_cast<T>(sin(a_RX * M_PI / 180));
|
||||
T cx = static_cast<T>(cos(a_RX * M_PI / 180));
|
||||
|
||||
Identity();
|
||||
|
||||
@ -87,8 +87,8 @@ public:
|
||||
|
||||
inline void RotateY(T a_RY)
|
||||
{
|
||||
T sy = (T) sin(a_RY * M_PI / 180);
|
||||
T cy = (T) cos(a_RY * M_PI / 180);
|
||||
T sy = static_cast<T>(sin(a_RY * M_PI / 180));
|
||||
T cy = static_cast<T>(cos(a_RY * M_PI / 180));
|
||||
|
||||
Identity();
|
||||
|
||||
|
@ -65,7 +65,7 @@ void cMobCensus::CollectSpawnableChunk(cChunk & a_Chunk)
|
||||
|
||||
int cMobCensus::GetNumChunks(void)
|
||||
{
|
||||
return (int)m_EligibleForSpawnChunks.size();
|
||||
return static_cast<int>(m_EligibleForSpawnChunks.size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ void cMobFamilyCollecter::CollectMob(cMonster & a_Monster)
|
||||
|
||||
int cMobFamilyCollecter::GetNumberOfCollectedMobs(cMonster::eFamily a_Family)
|
||||
{
|
||||
return (int)m_Mobs[a_Family].size();
|
||||
return static_cast<int>(m_Mobs[a_Family].size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
|
||||
if (allowedMobsSize > 0)
|
||||
{
|
||||
std::set<eMonsterType>::iterator itr = allowedMobs.begin();
|
||||
int iRandom = m_Random.NextInt((int)allowedMobsSize);
|
||||
int iRandom = m_Random.NextInt(static_cast<int>(allowedMobsSize));
|
||||
|
||||
for (int i = 0; i < iRandom; i++)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
|
||||
{
|
||||
if (m_Target->IsPlayer())
|
||||
{
|
||||
if (((cPlayer *)m_Target)->IsGameModeCreative())
|
||||
if (static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
|
||||
{
|
||||
m_EMState = IDLE;
|
||||
return;
|
||||
@ -46,7 +46,7 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
|
||||
|
||||
void cAggressiveMonster::EventSeePlayer(cEntity * a_Entity)
|
||||
{
|
||||
if (!((cPlayer *)a_Entity)->IsGameModeCreative())
|
||||
if (!static_cast<cPlayer *>(a_Entity)->IsGameModeCreative())
|
||||
{
|
||||
super::EventSeePlayer(a_Entity);
|
||||
m_EMState = CHASING;
|
||||
@ -110,12 +110,12 @@ void cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
|
||||
bool cAggressiveMonster::IsMovingToTargetPosition()
|
||||
{
|
||||
// Difference between destination x and target x is negligible (to 10^-12 precision)
|
||||
if (fabsf((float)m_FinalDestination.x - (float)m_Target->GetPosX()) < std::numeric_limits<float>::epsilon())
|
||||
if (fabsf(static_cast<float>(m_FinalDestination.x) - static_cast<float>(m_Target->GetPosX())) < std::numeric_limits<float>::epsilon())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Difference between destination z and target z is negligible (to 10^-12 precision)
|
||||
else if (fabsf((float)m_FinalDestination.z - (float)m_Target->GetPosZ()) > std::numeric_limits<float>::epsilon())
|
||||
else if (fabsf(static_cast<float>(m_FinalDestination.z) - static_cast<float>(m_Target->GetPosZ())) > std::numeric_limits<float>::epsilon())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -81,7 +81,9 @@ SET (HDRS
|
||||
ZombiePigman.h)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(Monster.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch -Wno-error=switch-enum -Wno-error=float-equal")
|
||||
set_source_files_properties(Monster.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch -Wno-error=switch-enum -Wno-error=float-equal -Wno-error=old-style-cast")
|
||||
set_source_files_properties(SnowGolem.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Villager.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -34,7 +34,7 @@ void cCaveSpider::Attack(std::chrono::milliseconds a_Dt)
|
||||
if (m_Target->IsPawn())
|
||||
{
|
||||
// TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds
|
||||
((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0);
|
||||
static_cast<cPawn *>(m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void cCreeper::Attack(std::chrono::milliseconds a_Dt)
|
||||
|
||||
if (!m_bIsBlowing)
|
||||
{
|
||||
m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
|
||||
m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
|
||||
m_bIsBlowing = true;
|
||||
m_World->BroadcastEntityMetadata(*this);
|
||||
}
|
||||
@ -142,7 +142,7 @@ void cCreeper::OnRightClicked(cPlayer & a_Player)
|
||||
{
|
||||
a_Player.UseEquippedItem();
|
||||
}
|
||||
m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
|
||||
m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
|
||||
m_bIsBlowing = true;
|
||||
m_World->BroadcastEntityMetadata(*this);
|
||||
m_BurnedWithFlintAndSteel = true;
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
}
|
||||
|
||||
cTracer LineOfSight(a_Player->GetWorld());
|
||||
if (LineOfSight.Trace(m_EndermanPos, Direction, (int)Direction.Length()))
|
||||
if (LineOfSight.Trace(m_EndermanPos, Direction, static_cast<int>(Direction.Length())))
|
||||
{
|
||||
// No direct line of sight
|
||||
return false;
|
||||
|
@ -43,13 +43,13 @@ void cGuardian::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
Vector3d Pos = GetPosition();
|
||||
|
||||
// TODO: Not a real behavior, but cool :D
|
||||
int RelY = (int)floor(Pos.y);
|
||||
int RelY = static_cast<int>(floor(Pos.y));
|
||||
if ((RelY < 0) || (RelY >= cChunkDef::Height))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
int RelX = static_cast<int>(floor(Pos.x)) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = static_cast<int>(floor(Pos.z)) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
BLOCKTYPE BlockType;
|
||||
if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire())
|
||||
{
|
||||
|
@ -55,10 +55,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
if (m_World->GetTickRandomNumber(50) == 25)
|
||||
{
|
||||
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 0);
|
||||
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 2);
|
||||
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 6);
|
||||
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 8);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 0);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 2);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 6);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 8);
|
||||
|
||||
m_Attachee->Detach();
|
||||
m_bIsRearing = true;
|
||||
|
@ -28,7 +28,7 @@ bool cPassiveAggressiveMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
|
||||
|
||||
if ((m_Target != nullptr) && (m_Target->IsPlayer()))
|
||||
{
|
||||
if (!((cPlayer *)m_Target)->IsGameModeCreative())
|
||||
if (!static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
|
||||
{
|
||||
m_EMState = CHASING;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
|
||||
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), static_cast<float>(m_SightDistance));
|
||||
if (a_Closest_Player != nullptr)
|
||||
{
|
||||
if (a_Closest_Player->GetEquippedItem().IsEqual(FollowedItem))
|
||||
|
@ -128,13 +128,13 @@ public:
|
||||
{
|
||||
// Guaranteed to have no hash collisions for any 128x128x128 area. Suitable for pathfinding.
|
||||
int32_t t = 0;
|
||||
t += (int8_t)a_Vector.x;
|
||||
t += static_cast<int8_t>(a_Vector.x);
|
||||
t = t << 8;
|
||||
t += (int8_t)a_Vector.y;
|
||||
t += static_cast<int8_t>(a_Vector.y);
|
||||
t = t << 8;
|
||||
t += (int8_t)a_Vector.z;
|
||||
t += static_cast<int8_t>(a_Vector.z);
|
||||
t = t << 8;
|
||||
return (size_t)t;
|
||||
return static_cast<size_t>(t);
|
||||
}
|
||||
};
|
||||
private:
|
||||
|
@ -41,13 +41,13 @@ void cSquid::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
Vector3d Pos = GetPosition();
|
||||
|
||||
// TODO: Not a real behavior, but cool :D
|
||||
int RelY = (int)floor(Pos.y);
|
||||
int RelY = static_cast<int>(floor(Pos.y));
|
||||
if ((RelY < 0) || (RelY >= cChunkDef::Height))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
int RelX = static_cast<int>(floor(Pos.x)) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = static_cast<int>(floor(Pos.z)) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
BLOCKTYPE BlockType;
|
||||
if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire())
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ void cWolf::Attack(std::chrono::milliseconds a_Dt)
|
||||
|
||||
if ((m_Target != nullptr) && (m_Target->IsPlayer()))
|
||||
{
|
||||
if (((cPlayer *)m_Target)->GetName() != m_OwnerName)
|
||||
if (static_cast<cPlayer *>(m_Target)->GetName() != m_OwnerName)
|
||||
{
|
||||
super::Attack(a_Dt);
|
||||
}
|
||||
@ -157,7 +157,7 @@ void cWolf::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
|
||||
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
|
||||
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), static_cast<float>(m_SightDistance));
|
||||
if (a_Closest_Player != nullptr)
|
||||
{
|
||||
switch (a_Closest_Player->GetEquippedItem().m_ItemType)
|
||||
|
@ -64,7 +64,7 @@ void cMonsterConfig::Initialize()
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--)
|
||||
for (int i = static_cast<int>(MonstersIniFile.GetNumKeys()); i >= 0; i--)
|
||||
{
|
||||
sAttributesStruct Attributes;
|
||||
AString Name = MonstersIniFile.GetKeyName(i);
|
||||
@ -93,7 +93,7 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na
|
||||
a_Monster->SetAttackDamage (itr->m_AttackDamage);
|
||||
a_Monster->SetAttackRange (itr->m_AttackRange);
|
||||
a_Monster->SetSightDistance(itr->m_SightDistance);
|
||||
a_Monster->SetAttackRate ((float)itr->m_AttackRate);
|
||||
a_Monster->SetAttackRate (static_cast<float>(itr->m_AttackRate));
|
||||
a_Monster->SetMaxHealth (itr->m_MaxHealth);
|
||||
a_Monster->SetIsFireproof (itr->m_IsFireproof);
|
||||
return;
|
||||
|
@ -14,6 +14,10 @@ SET (HDRS
|
||||
RidgedNoise.h
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(Noise.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
add_library(Noise ${SRCS} ${HDRS})
|
||||
|
||||
|
@ -185,7 +185,7 @@ typedef cOctavedNoise<cRidgedNoise<cCubicNoise>> cRidgedMultiNoise;
|
||||
NOISE_DATATYPE cNoise::IntNoise1D(int a_X) const
|
||||
{
|
||||
int x = ((a_X * m_Seed) << 13) ^ a_X;
|
||||
return (1 - (NOISE_DATATYPE)((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
|
||||
return (1 - static_cast<NOISE_DATATYPE>((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
|
||||
// returns a float number in the range of [-1, 1]
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ NOISE_DATATYPE cNoise::IntNoise2D(int a_X, int a_Y) const
|
||||
{
|
||||
int n = a_X + a_Y * 57 + m_Seed * 57 * 57;
|
||||
n = (n << 13) ^ n;
|
||||
return (1 - (NOISE_DATATYPE)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
|
||||
return (1 - static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
|
||||
// returns a float number in the range of [-1, 1]
|
||||
}
|
||||
|
||||
@ -209,7 +209,8 @@ NOISE_DATATYPE cNoise::IntNoise3D(int a_X, int a_Y, int a_Z) const
|
||||
{
|
||||
int n = a_X + a_Y * 57 + a_Z * 57 * 57 + m_Seed * 57 * 57 * 57;
|
||||
n = (n << 13) ^ n;
|
||||
return ((NOISE_DATATYPE)1 - (NOISE_DATATYPE)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f);
|
||||
return (static_cast<NOISE_DATATYPE>(1) -
|
||||
static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f);
|
||||
// returns a float number in the range of [-1, 1]
|
||||
}
|
||||
|
||||
@ -265,8 +266,8 @@ NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B,
|
||||
|
||||
NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct)
|
||||
{
|
||||
const NOISE_DATATYPE ft = a_Pct * (NOISE_DATATYPE)3.1415927;
|
||||
const NOISE_DATATYPE f = (NOISE_DATATYPE)((NOISE_DATATYPE)(1 - cos(ft)) * (NOISE_DATATYPE)0.5);
|
||||
const NOISE_DATATYPE ft = a_Pct * static_cast<NOISE_DATATYPE>(3.1415927);
|
||||
const NOISE_DATATYPE f = static_cast<NOISE_DATATYPE>(static_cast<NOISE_DATATYPE>(1 - cos(ft)) * static_cast<NOISE_DATATYPE>(0.5));
|
||||
return a_A * (1 - f) + a_B * f;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ SET (HDRS
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
add_flags_cxx("-Wno-error=global-constructors")
|
||||
add_flags_cxx("-Wno-error=global-constructors -Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
int ReadRestOfFile(AString & a_Contents);
|
||||
|
||||
/// Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported.
|
||||
bool Write(const AString & a_Contents) { return Write(a_Contents.data(), (int)(a_Contents.size())); }
|
||||
bool Write(const AString & a_Contents) { return Write(a_Contents.data(), static_cast<int>(a_Contents.size())); }
|
||||
|
||||
bool Write(const char * a_Data, int a_Size);
|
||||
|
||||
|
@ -66,7 +66,7 @@ int cBufferedSslContext::ReceiveEncrypted(unsigned char * a_Buffer, size_t a_Num
|
||||
return POLARSSL_ERR_NET_RECV_FAILED;
|
||||
}
|
||||
m_IncomingData.CommitRead();
|
||||
return (int)NumBytes;
|
||||
return static_cast<int>(NumBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -81,11 +81,11 @@ int cBufferedSslContext::SendEncrypted(const unsigned char * a_Buffer, size_t a_
|
||||
{
|
||||
return POLARSSL_ERR_NET_WANT_WRITE;
|
||||
}
|
||||
if (!m_OutgoingData.Write((const char *)a_Buffer, a_NumBytes))
|
||||
if (!m_OutgoingData.Write(reinterpret_cast<const char *>(a_Buffer), a_NumBytes))
|
||||
{
|
||||
return POLARSSL_ERR_NET_SEND_FAILED;
|
||||
}
|
||||
return (int)a_NumBytes;
|
||||
return static_cast<int>(a_NumBytes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,6 +33,10 @@ set(HDRS
|
||||
X509Cert.h
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(RsaPrivateKey.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
add_library(PolarSSL++ ${SRCS} ${HDRS})
|
||||
|
||||
|
@ -77,7 +77,7 @@ int cCryptoKey::Decrypt(const Byte * a_EncryptedData, size_t a_EncryptedLength,
|
||||
{
|
||||
return res;
|
||||
}
|
||||
return (int)DecryptedLen;
|
||||
return static_cast<int>(DecryptedLen);
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ int cCryptoKey::Encrypt(const Byte * a_PlainData, size_t a_PlainLength, Byte * a
|
||||
{
|
||||
return res;
|
||||
}
|
||||
return (int)EncryptedLength;
|
||||
return static_cast<int>(EncryptedLength);
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ int cCryptoKey::ParsePublic(const void * a_Data, size_t a_NumBytes)
|
||||
{
|
||||
ASSERT(!IsValid()); // Cannot parse a second key
|
||||
|
||||
return pk_parse_public_key(&m_Pk, (const unsigned char *)a_Data, a_NumBytes);
|
||||
return pk_parse_public_key(&m_Pk, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -123,14 +123,14 @@ int cCryptoKey::ParsePrivate(const void * a_Data, size_t a_NumBytes, const AStri
|
||||
|
||||
if (a_Password.empty())
|
||||
{
|
||||
return pk_parse_key(&m_Pk, (const unsigned char *)a_Data, a_NumBytes, nullptr, 0);
|
||||
return pk_parse_key(&m_Pk, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes, nullptr, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return pk_parse_key(
|
||||
&m_Pk,
|
||||
(const unsigned char *)a_Data, a_NumBytes,
|
||||
(const unsigned char *)a_Password.c_str(), a_Password.size()
|
||||
reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes,
|
||||
reinterpret_cast<const unsigned char *>(a_Password.c_str()), a_Password.size()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ int cCtrDrbgContext::Initialize(const void * a_Custom, size_t a_CustomSize)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = ctr_drbg_init(&m_CtrDrbg, entropy_func, &(m_EntropyContext->m_Entropy), (const unsigned char *)a_Custom, a_CustomSize);
|
||||
int res = ctr_drbg_init(&m_CtrDrbg, entropy_func, &(m_EntropyContext->m_Entropy), reinterpret_cast<const unsigned char *>(a_Custom), a_CustomSize);
|
||||
m_IsValid = (res == 0);
|
||||
return res;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ int cSslContext::WritePlain(const void * a_Data, size_t a_NumBytes)
|
||||
}
|
||||
}
|
||||
|
||||
return ssl_write(&m_Ssl, (const unsigned char *)a_Data, a_NumBytes);
|
||||
return ssl_write(&m_Ssl, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ int cSslContext::ReadPlain(void * a_Data, size_t a_MaxBytes)
|
||||
}
|
||||
}
|
||||
|
||||
return ssl_read(&m_Ssl, (unsigned char *)a_Data, a_MaxBytes);
|
||||
return ssl_read(&m_Ssl, reinterpret_cast<unsigned char *>(a_Data), a_MaxBytes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,13 +127,13 @@ protected:
|
||||
/** The callback used by PolarSSL when it wants to read encrypted data. */
|
||||
static int ReceiveEncrypted(void * a_This, unsigned char * a_Buffer, size_t a_NumBytes)
|
||||
{
|
||||
return ((cSslContext *)a_This)->ReceiveEncrypted(a_Buffer, a_NumBytes);
|
||||
return (static_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
|
||||
}
|
||||
|
||||
/** The callback used by PolarSSL when it wants to write encrypted data. */
|
||||
static int SendEncrypted(void * a_This, const unsigned char * a_Buffer, size_t a_NumBytes)
|
||||
{
|
||||
return ((cSslContext *)a_This)->SendEncrypted(a_Buffer, a_NumBytes);
|
||||
return (static_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -30,7 +30,7 @@ cX509Cert::~cX509Cert()
|
||||
|
||||
int cX509Cert::Parse(const void * a_CertContents, size_t a_Size)
|
||||
{
|
||||
return x509_crt_parse(&m_Cert, (const unsigned char *)a_CertContents, a_Size);
|
||||
return x509_crt_parse(&m_Cert, reinterpret_cast<const unsigned char *>(a_CertContents), a_Size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,8 +26,12 @@ SET (HDRS
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch")
|
||||
set_source_files_properties(Protocol17x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(ChunkDataSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(MojangAPI.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Packetizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Protocol17x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ProtocolRecognizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if (NOT MSVC)
|
||||
|
@ -276,7 +276,7 @@ size_t cTeam::GetNumPlayers(void) const
|
||||
|
||||
cScoreboard::cScoreboard(cWorld * a_World) : m_World(a_World)
|
||||
{
|
||||
for (int i = 0; i < (int) dsCount; ++i)
|
||||
for (int i = 0; i < static_cast<int>(dsCount); ++i)
|
||||
{
|
||||
m_Display[i] = nullptr;
|
||||
}
|
||||
@ -323,11 +323,11 @@ bool cScoreboard::RemoveObjective(const AString & a_Name)
|
||||
ASSERT(m_World != nullptr);
|
||||
m_World->BroadcastScoreboardObjective(it->second.GetName(), it->second.GetDisplayName(), 1);
|
||||
|
||||
for (unsigned int i = 0; i < (unsigned int) dsCount; ++i)
|
||||
for (unsigned int i = 0; i < static_cast<unsigned int>(dsCount); ++i)
|
||||
{
|
||||
if (m_Display[i] == &it->second)
|
||||
{
|
||||
SetDisplay(nullptr, (eDisplaySlot) i);
|
||||
SetDisplay(nullptr, static_cast<eDisplaySlot>(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,14 +557,14 @@ void cScoreboard::SendTo(cClientHandle & a_Client)
|
||||
it->second.SendTo(a_Client);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int) dsCount; ++i)
|
||||
for (int i = 0; i < static_cast<int>(dsCount); ++i)
|
||||
{
|
||||
// Avoid race conditions
|
||||
cObjective * Objective = m_Display[i];
|
||||
|
||||
if (Objective)
|
||||
{
|
||||
a_Client.SendDisplayObjective(Objective->GetName(), (eDisplaySlot) i);
|
||||
a_Client.SendDisplayObjective(Objective->GetName(), static_cast<eDisplaySlot>(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ SET (HDRS
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(FireSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
|
||||
set_source_files_properties(FluidSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shadow")
|
||||
set_source_files_properties(IncrementalRedstoneSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
|
||||
set_source_files_properties(IncrementalRedstoneSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -100,7 +100,7 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ,
|
||||
}
|
||||
|
||||
void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
|
||||
cDelayedFluidSimulatorChunkData * ChunkData = (cDelayedFluidSimulatorChunkData *)ChunkDataRaw;
|
||||
cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw);
|
||||
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_AddSlotNum];
|
||||
|
||||
// Add, if not already present:
|
||||
@ -133,7 +133,7 @@ void cDelayedFluidSimulator::Simulate(float a_Dt)
|
||||
void cDelayedFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
|
||||
{
|
||||
void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
|
||||
cDelayedFluidSimulatorChunkData * ChunkData = (cDelayedFluidSimulatorChunkData *)ChunkDataRaw;
|
||||
cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw);
|
||||
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum];
|
||||
|
||||
// Simulate all the blocks in the scheduled slot:
|
||||
@ -148,7 +148,7 @@ void cDelayedFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a
|
||||
{
|
||||
SimulateBlock(a_Chunk, itr->x, itr->y, itr->z);
|
||||
}
|
||||
m_TotalBlocks -= (int)Blocks.size();
|
||||
m_TotalBlocks -= static_cast<int>(Blocks.size());
|
||||
Blocks.clear();
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,12 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
|
||||
);
|
||||
a_NearChunk->SetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0);
|
||||
|
||||
a_NearChunk->BroadcastSoundEffect("random.fizz", (double)BlockX, (double)a_RelY, (double)BlockZ, 0.5f, 1.5f);
|
||||
a_NearChunk->BroadcastSoundEffect(
|
||||
"random.fizz",
|
||||
static_cast<double>(BlockX),
|
||||
static_cast<double>(a_RelY),
|
||||
static_cast<double>(BlockZ),
|
||||
0.5f, 1.5f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -270,7 +275,12 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
|
||||
);
|
||||
a_NearChunk->SetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0);
|
||||
|
||||
a_NearChunk->BroadcastSoundEffect("random.fizz", (double)BlockX, (double)a_RelY, (double)BlockZ, 0.5f, 1.5f);
|
||||
a_NearChunk->BroadcastSoundEffect(
|
||||
"random.fizz",
|
||||
static_cast<double>(BlockX),
|
||||
static_cast<double>(a_RelY),
|
||||
static_cast<double>(BlockZ),
|
||||
0.5f, 1.5f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user