summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-19 20:32:10 +0200
committertycho <work.tycho@gmail.com>2015-05-19 20:32:10 +0200
commit77f1f58c0a7eb55001b375f1945690ed5c1e87a2 (patch)
tree99e4b53b2966bd4d9bf545d18ddb7edb89472830
parentAdded LuaState support for all integral types (diff)
downloadcuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.tar
cuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.tar.gz
cuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.tar.bz2
cuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.tar.lz
cuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.tar.xz
cuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.tar.zst
cuberite-77f1f58c0a7eb55001b375f1945690ed5c1e87a2.zip
Diffstat (limited to '')
-rw-r--r--SetFlags.cmake34
-rw-r--r--src/AllocationPool.h6
-rw-r--r--src/Bindings/CMakeLists.txt4
-rw-r--r--src/BlockEntities/CMakeLists.txt5
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp4
-rw-r--r--src/Blocks/CMakeLists.txt1
-rw-r--r--src/CMakeLists.txt25
-rw-r--r--src/Chunk.cpp4
-rw-r--r--src/ChunkSender.cpp4
-rw-r--r--src/CompositeChat.cpp4
-rw-r--r--src/Enchantments.cpp10
-rw-r--r--src/Enchantments.h8
-rw-r--r--src/Entities/ArrowEntity.cpp4
-rw-r--r--src/Entities/CMakeLists.txt7
-rw-r--r--src/Entities/Entity.cpp2
-rw-r--r--src/Entities/HangingEntity.h4
-rw-r--r--src/Entities/Minecart.cpp5
-rw-r--r--src/Entities/Pawn.cpp2
-rw-r--r--src/Entities/ProjectileEntity.cpp1
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp4
-rw-r--r--src/Generating/CMakeLists.txt14
-rw-r--r--src/HTTPServer/CMakeLists.txt5
-rw-r--r--src/IniFile.cpp2
-rw-r--r--src/Inventory.cpp2
-rw-r--r--src/Items/CMakeLists.txt4
-rw-r--r--src/Map.cpp6
-rw-r--r--src/MapManager.cpp2
-rw-r--r--src/MapManager.h2
-rw-r--r--src/MobCensus.cpp3
-rw-r--r--src/Mobs/Blaze.cpp2
-rw-r--r--src/Mobs/CMakeLists.txt4
-rw-r--r--src/Mobs/CaveSpider.cpp2
-rw-r--r--src/Mobs/Chicken.cpp2
-rw-r--r--src/Mobs/Cow.cpp2
-rw-r--r--src/Mobs/Creeper.cpp2
-rw-r--r--src/Mobs/Enderman.cpp2
-rw-r--r--src/Mobs/Ghast.cpp2
-rw-r--r--src/Mobs/Guardian.cpp2
-rw-r--r--src/Mobs/Horse.cpp2
-rw-r--r--src/Mobs/Monster.cpp8
-rw-r--r--src/Mobs/Monster.h6
-rw-r--r--src/Mobs/Mooshroom.cpp2
-rw-r--r--src/Mobs/Path.h2
-rw-r--r--src/Mobs/Pig.cpp2
-rw-r--r--src/Mobs/Rabbit.cpp2
-rw-r--r--src/Mobs/Sheep.cpp6
-rw-r--r--src/Mobs/Skeleton.cpp2
-rw-r--r--src/Mobs/Slime.cpp2
-rw-r--r--src/Mobs/Spider.cpp2
-rw-r--r--src/Mobs/Squid.cpp2
-rw-r--r--src/Mobs/Witch.cpp2
-rw-r--r--src/Mobs/Zombie.cpp2
-rw-r--r--src/Mobs/ZombiePigman.cpp2
-rw-r--r--src/Protocol/CMakeLists.txt5
-rw-r--r--src/Simulator/CMakeLists.txt7
-rw-r--r--src/Simulator/VanillaFluidSimulator.cpp2
-rw-r--r--src/Tracer.cpp2
-rw-r--r--src/UI/CMakeLists.txt5
-rw-r--r--src/WorldStorage/CMakeLists.txt8
-rw-r--r--src/WorldStorage/EnchantmentSerializer.cpp6
-rw-r--r--src/WorldStorage/FastNBT.cpp6
-rw-r--r--src/WorldStorage/FireworksSerializer.cpp2
-rw-r--r--src/WorldStorage/MapSerializer.cpp12
63 files changed, 201 insertions, 96 deletions
diff --git a/SetFlags.cmake b/SetFlags.cmake
index 0d1bd99b3..b26796522 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -16,8 +16,8 @@ macro (add_flags_lnk FLAGS)
endmacro()
macro(add_flags_cxx FLAGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
+ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
+ #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAGS}")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} ${FLAGS}")
@@ -235,7 +235,7 @@ macro(set_exe_flags)
string(REPLACE "-w" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "-w" "" CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE}")
string(REPLACE "-w" "" CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}")
- add_flags_cxx("-Wall -Wextra -Wno-unused-parameter -Wno-error=switch")
+ add_flags_cxx("-Wall -Wextra -Wno-unused-parameter")
# we support non-IEEE 754 fpus so can make no guarentees about error
add_flags_cxx("-ffast-math")
@@ -248,16 +248,10 @@ macro(set_exe_flags)
# 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("-Wno-exit-time-destructors -Wno-padded")
- add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=deprecated")
- add_flags_cxx("-Wno-error=missing-prototypes")
- add_flags_cxx("-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=global-constructors")
- add_flags_cxx("-Wno-error=float-equal")
- add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum")
+ 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
- add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=missing-variable-declarations")
- add_flags_cxx("-Wno-implicit-fallthrough -Wno-error=extra-semi")
+ add_flags_cxx("-Wno-implicit-fallthrough")
endif()
if ("${CLANG_VERSION}" VERSION_GREATER 3.1)
# flags introduced in 3.2
@@ -267,3 +261,21 @@ macro(set_exe_flags)
endif()
endmacro()
+
+# if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+# foreach(FILENAME ${ARGN})
+# message("downgrade_warnings for ${FILENAME}")
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion")
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=missing-prototypes -Wno-error=deprecated")
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=switch-enum -Wno-error=switch")
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal -Wno-error=global-constructors")
+
+# if ("${CLANG_VERSION}" VERSION_GREATER 3.0)
+# # flags that are not present in 3.0
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=covered-switch-default ")
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-implicit-fallthrough -Wno-error=extra-semi")
+# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=missing-variable-declarations")
+# endif()
+# endforeach()
+# endif()
+
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index 7c358cc84..e82f9807e 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -39,8 +39,8 @@ class cListAllocationPool : public cAllocationPool<T>
{
public:
- cListAllocationPool(std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks) :
- m_Callbacks(a_Callbacks)
+ cListAllocationPool(std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks) :
+ m_Callbacks(std::move(a_Callbacks))
{
for (size_t i = 0; i < NumElementsInReserve; i++)
{
@@ -105,7 +105,7 @@ class cListAllocationPool : public cAllocationPool<T>
private:
std::list<void *> m_FreeList;
- std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
+ std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
};
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
index 133c2224d..e1ded8446 100644
--- a/src/Bindings/CMakeLists.txt
+++ b/src/Bindings/CMakeLists.txt
@@ -145,6 +145,10 @@ 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(LuaWindow.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+endif()
+
if(NOT MSVC)
add_library(Bindings ${SRCS} ${HDRS})
diff --git a/src/BlockEntities/CMakeLists.txt b/src/BlockEntities/CMakeLists.txt
index 5f4af288d..b0bfca5e4 100644
--- a/src/BlockEntities/CMakeLists.txt
+++ b/src/BlockEntities/CMakeLists.txt
@@ -41,6 +41,11 @@ SET (HDRS
NoteEntity.h
SignEntity.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(BeaconEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=switch-enum")
+ set_source_files_properties(NoteEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion")
+endif()
+
if(NOT MSVC)
add_library(BlockEntities ${SRCS} ${HDRS})
endif()
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index 764d7af84..f8222822c 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -246,9 +246,9 @@ int cMobSpawnerEntity::GetNearbyMonsterNum(eMonsterType a_EntityType)
class cCallback : public cChunkDataCallback
{
public:
- cCallback(Vector3d a_SpawnerPos, eMonsterType a_EntityType, int & a_NumEntities) :
+ cCallback(Vector3d a_SpawnerPos, eMonsterType a_CallbackEntityType, int & a_NumEntities) :
m_SpawnerPos(a_SpawnerPos),
- m_EntityType(a_EntityType),
+ m_EntityType(a_CallbackEntityType),
m_NumEntities(a_NumEntities)
{
}
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index ed3e321d4..d7ea6258f 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -95,6 +95,7 @@ SET (HDRS
MetaRotator.h
WorldInterface.h)
+
if(NOT MSVC)
add_library(Blocks ${SRCS} ${HDRS})
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 25de24c91..bcf634fd7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -151,6 +151,31 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/TCLAP/include")
configure_file("BuildInfo.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.h")
+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(Inventory.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
+ set_source_files_properties(Item.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
+ 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(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(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(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(main.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=missing-variable-declarations -Wno-error=missing-prototypes")
+endif()
+
if (NOT MSVC)
# Bindings need to reference other folders, so they are done here instead
# lib dependencies are not included
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 7d5f54373..7af669163 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -714,8 +714,8 @@ void cChunk::MoveEntityToNewChunk(cEntity * a_Entity)
cEntity * m_Entity;
public:
- cMover(cEntity * a_Entity) :
- m_Entity(a_Entity)
+ cMover(cEntity * a_CallbackEntity) :
+ m_Entity(a_CallbackEntity)
{}
} Mover(a_Entity);
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp
index 83d82884e..917ab198b 100644
--- a/src/ChunkSender.cpp
+++ b/src/ChunkSender.cpp
@@ -125,10 +125,6 @@ void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a
m_SendChunksHighPriority.push_back(Chunk);
break;
}
- default:
- {
- ASSERT(!"Unknown chunk priority!");
- }
}
}
m_evtQueue.Set();
diff --git a/src/CompositeChat.cpp b/src/CompositeChat.cpp
index d1eb0b852..c6b89324c 100644
--- a/src/CompositeChat.cpp
+++ b/src/CompositeChat.cpp
@@ -345,6 +345,10 @@ AString cCompositeChat::ExtractText(void) const
Msg.append(((cUrlPart *)(*itr))->m_Url);
break;
}
+ case ptShowAchievement:
+ {
+ break;
+ }
} // switch (PartType)
} // for itr - m_Parts[]
return Msg;
diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp
index 5ed18de6b..17c77dd93 100644
--- a/src/Enchantments.cpp
+++ b/src/Enchantments.cpp
@@ -69,8 +69,8 @@ void cEnchantments::AddFromString(const AString & a_StringSpec)
LOG("%s: Failed to parse enchantment \"%s\", skipping.", __FUNCTION__, Split[0].c_str());
continue;
}
- int lvl = atoi(Split[1].c_str());
- if ((lvl == 0) && (Split[1] != "0"))
+ unsigned int lvl;
+ if (!StringToInteger(Split[1], lvl))
{
// Level failed to parse
LOG("%s: Failed to parse enchantment level \"%s\", skipping.", __FUNCTION__, Split[1].c_str());
@@ -108,7 +108,7 @@ AString cEnchantments::ToString(void) const
-int cEnchantments::GetLevel(int a_EnchantmentID) const
+unsigned int cEnchantments::GetLevel(int a_EnchantmentID) const
{
// Return the level for the specified enchantment; 0 if not stored
cMap::const_iterator itr = m_Enchantments.find(a_EnchantmentID);
@@ -125,7 +125,7 @@ int cEnchantments::GetLevel(int a_EnchantmentID) const
-void cEnchantments::SetLevel(int a_EnchantmentID, int a_Level)
+void cEnchantments::SetLevel(int a_EnchantmentID, unsigned int a_Level)
{
// Sets the level for the specified enchantment, adding it if not stored before or removing it if level <= 0
if (a_Level == 0)
@@ -908,7 +908,7 @@ void cEnchantments::AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantm
-void cEnchantments::AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, int a_EnchantmentLevel)
+void cEnchantments::AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, unsigned int a_EnchantmentLevel)
{
cWeightedEnchantment weightedenchantment;
weightedenchantment.m_Weight = a_Weight;
diff --git a/src/Enchantments.h b/src/Enchantments.h
index 9d3f342d4..8c08e7a93 100644
--- a/src/Enchantments.h
+++ b/src/Enchantments.h
@@ -92,10 +92,10 @@ public:
AString ToString(void) const;
/** Returns the level for the specified enchantment; 0 if not stored */
- int GetLevel(int a_EnchantmentID) const;
+ unsigned int GetLevel(int a_EnchantmentID) const;
/** Sets the level for the specified enchantment, adding it if not stored before or removing it if level <= 0 */
- void SetLevel(int a_EnchantmentID, int a_Level);
+ void SetLevel(int a_EnchantmentID, unsigned int a_Level);
/** Removes all enchantments */
void Clear(void);
@@ -115,7 +115,7 @@ public:
static void AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantments, short a_ItemType, int a_EnchantmentLevel);
/** Add a enchantment with weight to the vector */
- static void AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, int a_EnchantmentLevel);
+ static void AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, unsigned int a_EnchantmentLevel);
/** Remove the entire enchantment (with weight) from the vector */
static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments & a_Enchantments, int a_EnchantmentID);
@@ -145,7 +145,7 @@ public:
protected:
/** Maps enchantment ID -> enchantment level */
- typedef std::map<int, int> cMap;
+ typedef std::map<int, unsigned int> cMap;
/** Currently stored enchantments */
cMap m_Enchantments;
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index 32952100c..0618ac2fc 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -108,7 +108,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
Damage += m_World->GetTickRandomNumber(Damage / 2 + 2);
}
- int PowerLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPower);
+ unsigned int PowerLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPower);
if (PowerLevel > 0)
{
int ExtraDamage = (int)ceil(0.25 * (PowerLevel + 1));
@@ -116,7 +116,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
}
int KnockbackAmount = 1;
- int PunchLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ unsigned int PunchLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPunch);
if (PunchLevel > 0)
{
Vector3d LookVector = GetLookVector();
diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt
index 5d10e1680..44257665e 100644
--- a/src/Entities/CMakeLists.txt
+++ b/src/Entities/CMakeLists.txt
@@ -60,6 +60,13 @@ SET (HDRS
ThrownSnowballEntity.h
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")
+endif()
+
if(NOT MSVC)
add_library(Entities ${SRCS} ${HDRS})
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index bc2b3e93e..941c4196c 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -396,7 +396,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
}
- int ThornsLevel = 0;
+ unsigned int ThornsLevel = 0;
const cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
{
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h
index 9d783006c..4d70cd1a0 100644
--- a/src/Entities/HangingEntity.h
+++ b/src/Entities/HangingEntity.h
@@ -89,7 +89,9 @@ protected:
case BLOCK_FACE_ZM: Dir = 2; break;
case BLOCK_FACE_XM: Dir = 1; break;
case BLOCK_FACE_XP: Dir = 3; break;
- default:
+ case BLOCK_FACE_YP:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_NONE:
{
// Uncomment when entities are initialised with their real data, instead of dummy values:
// LOGINFO("Invalid facing (%d) in a cHangingEntity, adjusting to BLOCK_FACE_XP.", a_BlockFace);
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index b80759d24..3adc63129 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -1051,11 +1051,6 @@ bool cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
Drops.push_back(cItem(E_ITEM_MINECART_WITH_HOPPER, 1, 0));
break;
}
- default:
- {
- ASSERT(!"Unhandled minecart type when spawning pickup!");
- return true;
- }
}
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ());
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index fcb686e28..9fdd7026b 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -78,7 +78,7 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, s
a_Duration = (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, a_Duration);
+ m_World->BroadcastEntityEffect(*this, a_EffectType, a_Intensity, static_cast<short>(a_Duration));
m_EntityEffects[a_EffectType]->OnActivate(*this);
}
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 05b7669cd..1f00533db 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -281,6 +281,7 @@ cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator,
return new cFireworkEntity(a_Creator, a_X, a_Y, a_Z, *a_Item);
}
+ case pkFishingFloat: break;
}
LOGWARNING("%s: Unknown projectile kind: %d", __FUNCTION__, a_Kind);
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index f01cdc18c..12d826042 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -77,9 +77,9 @@ void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
class cProjectileCreatorCallbackForPlayers : public cPlayerListCallback
{
public:
- cProjectileCreatorCallbackForPlayers(cEntity * a_Attacker, Vector3i a_HitPos) :
+ cProjectileCreatorCallbackForPlayers(cEntity * a_Attacker, Vector3i a_CallbackHitPos) :
m_Attacker(a_Attacker),
- m_HitPos(a_HitPos)
+ m_HitPos(a_CallbackHitPos)
{
}
diff --git a/src/Generating/CMakeLists.txt b/src/Generating/CMakeLists.txt
index a28510d40..42c9d14e0 100644
--- a/src/Generating/CMakeLists.txt
+++ b/src/Generating/CMakeLists.txt
@@ -72,6 +72,20 @@ SET (HDRS
VillageGen.h
)
+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(FinishGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch")
+ set_source_files_properties(NetherFortGen.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(TestRailsGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
+ 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()
+
if(NOT MSVC)
add_library(Generating ${SRCS} ${HDRS})
diff --git a/src/HTTPServer/CMakeLists.txt b/src/HTTPServer/CMakeLists.txt
index b0efc810d..f6ef96d20 100644
--- a/src/HTTPServer/CMakeLists.txt
+++ b/src/HTTPServer/CMakeLists.txt
@@ -24,6 +24,11 @@ SET (HDRS
NameValueParser.h
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(HTTPConnection.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+endif()
+
if(NOT MSVC)
add_library(HTTPServer ${SRCS} ${HDRS})
endif()
diff --git a/src/IniFile.cpp b/src/IniFile.cpp
index cd98cce57..b0b3d15ec 100644
--- a/src/IniFile.cpp
+++ b/src/IniFile.cpp
@@ -859,7 +859,7 @@ AString cIniFile::CheckCase(const AString & s) const
size_t len = res.length();
for (size_t i = 0; i < len; i++)
{
- res[i] = tolower(res[i]);
+ res[i] = static_cast<char>(tolower(res[i]));
}
return res;
}
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index c595da5b0..079743e90 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -117,7 +117,7 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
}
res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1);
- ToAdd.m_ItemCount = a_Item.m_ItemCount - res;
+ ToAdd.m_ItemCount = a_Item.m_ItemCount - static_cast<char>(res);
if (ToAdd.m_ItemCount == 0)
{
return res;
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index c50ddb372..46ff3b4a0 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -56,6 +56,10 @@ SET (HDRS
ItemThrowable.h
)
+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")
+endif()
+
if(NOT MSVC)
add_library(Items ${SRCS} ${HDRS})
endif()
diff --git a/src/Map.cpp b/src/Map.cpp
index 5f296a5b2..48d7fb0ca 100644
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -224,7 +224,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z)
return false;
}
- unsigned int PixelWidth = m_Map->GetPixelWidth();
+ unsigned int CallbackPixelWidth = m_Map->GetPixelWidth();
if (m_Map->GetDimension() == dimNether)
{
@@ -237,9 +237,9 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z)
ColorCountMap ColorCounts;
// Count surface blocks
- for (unsigned int X = m_RelX; X < m_RelX + PixelWidth; ++X)
+ for (unsigned int X = m_RelX; X < m_RelX + CallbackPixelWidth; ++X)
{
- for (unsigned int Z = m_RelZ; Z < m_RelZ + PixelWidth; ++Z)
+ for (unsigned int Z = m_RelZ; Z < m_RelZ + CallbackPixelWidth; ++Z)
{
// unsigned int WaterDepth = 0;
diff --git a/src/MapManager.cpp b/src/MapManager.cpp
index fc67bd901..0965544cc 100644
--- a/src/MapManager.cpp
+++ b/src/MapManager.cpp
@@ -76,7 +76,7 @@ cMap * cMapManager::GetMapData(unsigned int a_ID)
-cMap * cMapManager::CreateMap(int a_CenterX, int a_CenterY, int a_Scale)
+cMap * cMapManager::CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale)
{
cCSLock Lock(m_CS);
diff --git a/src/MapManager.h b/src/MapManager.h
index 1059773c3..cacc6d816 100644
--- a/src/MapManager.h
+++ b/src/MapManager.h
@@ -36,7 +36,7 @@ public:
cMap * GetMapData(unsigned int a_ID);
/** Creates a new map. Returns nullptr on error */
- cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
+ cMap * CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale = 3);
/** Calls the callback for the map with the specified ID.
Returns true if the map was found and the callback called, false if map not found.
diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp
index 1a69d8370..22c838c6b 100644
--- a/src/MobCensus.cpp
+++ b/src/MobCensus.cpp
@@ -41,7 +41,8 @@ int cMobCensus::GetCapMultiplier(cMonster::eFamily a_MobFamily)
case cMonster::mfPassive: return 11;
case cMonster::mfAmbient: return 16;
case cMonster::mfWater: return 5;
- default:
+ case cMonster::mfNoSpawn:
+ case cMonster::mfUnhandled:
{
ASSERT(!"Unhandled mob family");
return -1;
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index d4ad24166..731da6b18 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -23,7 +23,7 @@ void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if ((a_Killer != nullptr) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ unsigned int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD);
}
}
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index ffbcdf3ea..bd8fa76b1 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -80,6 +80,10 @@ SET (HDRS
Zombie.h
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")
+endif()
+
if(NOT MSVC)
add_library(Mobs ${SRCS} ${HDRS})
endif()
diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp
index fa530db82..8000f3f68 100644
--- a/src/Mobs/CaveSpider.cpp
+++ b/src/Mobs/CaveSpider.cpp
@@ -44,7 +44,7 @@ void cCaveSpider::Attack(std::chrono::milliseconds a_Dt)
void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp
index b2b21d4ae..a52d1a2da 100644
--- a/src/Mobs/Chicken.cpp
+++ b/src/Mobs/Chicken.cpp
@@ -48,7 +48,7 @@ void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp
index 7dc6f3f37..a45010201 100644
--- a/src/Mobs/Cow.cpp
+++ b/src/Mobs/Cow.cpp
@@ -21,7 +21,7 @@ cCow::cCow(void) :
void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index 41796402f..6968bed17 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -60,7 +60,7 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
return;
}
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 42c33884a..10cec9751 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -91,7 +91,7 @@ cEnderman::cEnderman(void) :
void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp
index d17047ab7..15bbe484b 100644
--- a/src/Mobs/Ghast.cpp
+++ b/src/Mobs/Ghast.cpp
@@ -19,7 +19,7 @@ cGhast::cGhast(void) :
void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Guardian.cpp b/src/Mobs/Guardian.cpp
index 5eb30785b..a81667445 100644
--- a/src/Mobs/Guardian.cpp
+++ b/src/Mobs/Guardian.cpp
@@ -21,7 +21,7 @@ cGuardian::cGuardian(void) :
void cGuardian::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index 5b4c78bfc..e33cc1b9d 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -140,7 +140,7 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 2b00f6959..619e20855 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -1137,10 +1137,10 @@ void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short
-void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel)
+void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel)
{
MTRand r1;
- int Count = r1.randInt() % 200;
+ unsigned int Count = r1.randInt() % 200;
if (Count < (5 + a_LootingLevel))
{
int Rare = r1.randInt() % a_Items.Size();
@@ -1152,7 +1152,7 @@ void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a
-void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
+void cMonster::AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel)
{
MTRand r1;
if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2)))
@@ -1192,7 +1192,7 @@ void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
-void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel)
+void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel)
{
MTRand r1;
if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2)))
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index c4043b0e5..50bc02558 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -274,13 +274,13 @@ protected:
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
/** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
- void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
+ void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel);
/** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
- void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel);
+ void AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
/** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
- void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel);
+ void AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
} ; // tolua_export
diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp
index ec533cfca..3b2fbad57 100644
--- a/src/Mobs/Mooshroom.cpp
+++ b/src/Mobs/Mooshroom.cpp
@@ -24,7 +24,7 @@ cMooshroom::cMooshroom(void) :
void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index 7a4182f17..31002fe7f 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -99,7 +99,7 @@ public:
return m_PathPoints[m_PathPoints.size() - 1 - a_index];
}
/** Returns the total number of points this path has. */
- inline int GetPointCount()
+ inline size_t GetPointCount()
{
if (m_Status != ePathFinderStatus::PATH_FOUND)
{
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index 56d6abfd5..efa779ac2 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -21,7 +21,7 @@ cPig::cPig(void) :
void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Rabbit.cpp b/src/Mobs/Rabbit.cpp
index cf49d2744..c7f3d58f0 100644
--- a/src/Mobs/Rabbit.cpp
+++ b/src/Mobs/Rabbit.cpp
@@ -20,7 +20,7 @@ cRabbit::cRabbit(void) :
void cRabbit::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp
index ec24f167e..dcfef8135 100644
--- a/src/Mobs/Sheep.cpp
+++ b/src/Mobs/Sheep.cpp
@@ -37,10 +37,10 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if (!m_IsSheared)
{
- a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, m_WoolColor));
+ a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, static_cast<short>(m_WoolColor)));
}
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
@@ -65,7 +65,7 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
cItems Drops;
int NumDrops = m_World->GetTickRandomNumber(2) + 1;
- Drops.push_back(cItem(E_BLOCK_WOOL, NumDrops, m_WoolColor));
+ Drops.push_back(cItem(E_BLOCK_WOOL, static_cast<char>(NumDrops), static_cast<short>(m_WoolColor)));
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
m_World->BroadcastSoundEffect("mob.sheep.shear", GetPosX(), GetPosY(), GetPosZ(), 1.0f, 1.0f);
}
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index f99404669..9a99a107c 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -22,7 +22,7 @@ cSkeleton::cSkeleton(bool IsWither) :
void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp
index 7fc4821d8..4988d1082 100644
--- a/src/Mobs/Slime.cpp
+++ b/src/Mobs/Slime.cpp
@@ -29,7 +29,7 @@ cSlime::cSlime(int a_Size) :
void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp
index deb263c41..184a1d912 100644
--- a/src/Mobs/Spider.cpp
+++ b/src/Mobs/Spider.cpp
@@ -18,7 +18,7 @@ cSpider::cSpider(void) :
void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp
index 3c508b65f..9affcd6e1 100644
--- a/src/Mobs/Squid.cpp
+++ b/src/Mobs/Squid.cpp
@@ -21,7 +21,7 @@ cSquid::cSquid(void) :
void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Witch.cpp b/src/Mobs/Witch.cpp
index a3cadbaa0..1f672b4f7 100644
--- a/src/Mobs/Witch.cpp
+++ b/src/Mobs/Witch.cpp
@@ -19,7 +19,7 @@ cWitch::cWitch(void) :
void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp
index fa4ac855d..a5b44e6c0 100644
--- a/src/Mobs/Zombie.cpp
+++ b/src/Mobs/Zombie.cpp
@@ -23,7 +23,7 @@ cZombie::cZombie(bool a_IsVillagerZombie) :
void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/ZombiePigman.cpp b/src/Mobs/ZombiePigman.cpp
index 8b415b0af..96d587287 100644
--- a/src/Mobs/ZombiePigman.cpp
+++ b/src/Mobs/ZombiePigman.cpp
@@ -18,7 +18,7 @@ cZombiePigman::cZombiePigman(void) :
void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt
index c3a45ca47..f6aa6fca5 100644
--- a/src/Protocol/CMakeLists.txt
+++ b/src/Protocol/CMakeLists.txt
@@ -25,6 +25,11 @@ SET (HDRS
ProtocolRecognizer.h
)
+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")
+endif()
+
if (NOT MSVC)
add_library(Protocol ${SRCS} ${HDRS})
endif()
diff --git a/src/Simulator/CMakeLists.txt b/src/Simulator/CMakeLists.txt
index 5aa406717..8e1344ff0 100644
--- a/src/Simulator/CMakeLists.txt
+++ b/src/Simulator/CMakeLists.txt
@@ -31,6 +31,13 @@ SET (HDRS
VanillaFluidSimulator.h
VaporizeFluidSimulator.h)
+
+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")
+endif()
+
if(NOT MSVC)
add_library(Simulator ${SRCS} ${HDRS})
endif()
diff --git a/src/Simulator/VanillaFluidSimulator.cpp b/src/Simulator/VanillaFluidSimulator.cpp
index 6df75eebb..f6fe1e9ec 100644
--- a/src/Simulator/VanillaFluidSimulator.cpp
+++ b/src/Simulator/VanillaFluidSimulator.cpp
@@ -105,7 +105,7 @@ int cVanillaFluidSimulator::CalculateFlowCost(cChunk * a_Chunk, int a_RelX, int
if (IsPassableForFluid(BlockType) || IsBlockLiquid(BlockType))
{
// Path found, exit
- return a_Iteration;
+ return static_cast<int>(a_Iteration);
}
// 5 blocks away, bail out
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index 5fdaff15d..b54a50798 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -277,7 +277,7 @@ bool cTracer::Trace(const Vector3f & a_Start, const Vector3f & a_Direction, int
// return 1 = hit, other is not hit
-int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
+static int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
{
// float linx, liny;
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
index ef4afc40a..e01a09bb8 100644
--- a/src/UI/CMakeLists.txt
+++ b/src/UI/CMakeLists.txt
@@ -34,6 +34,11 @@ SET (HDRS
MinecartWithChestWindow.h
WindowOwner.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(SlotArea.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=switch-enum -Wno-error=sign-conversion")
+ set_source_files_properties(Window.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=switch-enum -Wno-error=sign-conversion")
+endif()
+
if(NOT MSVC)
add_library(UI ${SRCS} ${HDRS})
endif()
diff --git a/src/WorldStorage/CMakeLists.txt b/src/WorldStorage/CMakeLists.txt
index 59193db2a..b511fc412 100644
--- a/src/WorldStorage/CMakeLists.txt
+++ b/src/WorldStorage/CMakeLists.txt
@@ -28,6 +28,14 @@ SET (HDRS
WSSAnvil.h
WorldStorage.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(FastNBT.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
+ set_source_files_properties(FireworksSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+ set_source_files_properties(NBTChunkSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=sign-conversion -Wno-error=conversion")
+ set_source_files_properties(SchematicFileSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=conversion")
+ set_source_files_properties(WSSAnvil.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shorten-64-to-32 -Wno-error=switch -Wno-error=switch-enum -Wno-error=conversion")
+endif()
+
if(NOT MSVC)
add_library(WorldStorage ${SRCS} ${HDRS})
diff --git a/src/WorldStorage/EnchantmentSerializer.cpp b/src/WorldStorage/EnchantmentSerializer.cpp
index a6e562956..b28e16b1d 100644
--- a/src/WorldStorage/EnchantmentSerializer.cpp
+++ b/src/WorldStorage/EnchantmentSerializer.cpp
@@ -14,8 +14,8 @@ void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantme
for (cEnchantments::cMap::const_iterator itr = a_Enchantments.m_Enchantments.begin(), end = a_Enchantments.m_Enchantments.end(); itr != end; ++itr)
{
a_Writer.BeginCompound("");
- a_Writer.AddShort("id", itr->first);
- a_Writer.AddShort("lvl", itr->second);
+ a_Writer.AddShort("id", static_cast<Int16>(itr->first));
+ a_Writer.AddShort("lvl", static_cast<Int16>(itr->second));
a_Writer.EndCompound();
} // for itr - m_Enchantments[]
a_Writer.EndList();
@@ -82,7 +82,7 @@ void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const c
}
// Store the enchantment:
- a_Enchantments.m_Enchantments[id] = lvl;
+ a_Enchantments.m_Enchantments[id] = static_cast<unsigned int>(lvl);
} // for tag - children of the ench list tag
}
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index 033a07601..f77197914 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -257,7 +257,7 @@ bool cParsedNBT::ReadTag(void)
return true;
}
- default:
+ case TAG_Min:
{
ASSERT(!"Unhandled NBT tag type");
return false;
@@ -503,7 +503,7 @@ void cFastNBTWriter::AddString(const AString & a_Name, const AString & a_Value)
void cFastNBTWriter::AddByteArray(const AString & a_Name, const char * a_Value, size_t a_NumElements)
{
TagCommon(a_Name, TAG_ByteArray);
- u_long len = htonl(static_cast<u_long>(a_NumElements));
+ u_int len = htonl(static_cast<u_int>(a_NumElements));
m_Result.append(reinterpret_cast<const char *>(&len), 4);
m_Result.append(a_Value, a_NumElements);
}
@@ -515,7 +515,7 @@ void cFastNBTWriter::AddByteArray(const AString & a_Name, const char * a_Value,
void cFastNBTWriter::AddIntArray(const AString & a_Name, const int * a_Value, size_t a_NumElements)
{
TagCommon(a_Name, TAG_IntArray);
- u_long len = htonl(static_cast<u_long>(a_NumElements));
+ u_int len = htonl(static_cast<u_int>(a_NumElements));
size_t cap = m_Result.capacity();
size_t size = m_Result.length();
if ((cap - size) < (4 + a_NumElements * 4))
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp
index 91a5b8b63..0398f4da8 100644
--- a/src/WorldStorage/FireworksSerializer.cpp
+++ b/src/WorldStorage/FireworksSerializer.cpp
@@ -14,7 +14,7 @@ void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFa
case E_ITEM_FIREWORK_ROCKET:
{
a_Writer.BeginCompound("Fireworks");
- a_Writer.AddByte("Flight", a_FireworkItem.m_FlightTimeInTicks / 20);
+ a_Writer.AddByte("Flight", static_cast<Byte>(a_FireworkItem.m_FlightTimeInTicks / 20));
a_Writer.BeginList("Explosions", TAG_Compound);
a_Writer.BeginCompound("");
a_Writer.AddByte("Flicker", a_FireworkItem.m_HasFlicker);
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index da7b9d929..d4925dcab 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -102,11 +102,11 @@ void cMapSerializer::SaveMapToNBT(cFastNBTWriter & a_Writer)
{
a_Writer.BeginCompound("data");
- a_Writer.AddByte("scale", m_Map->GetScale());
- a_Writer.AddByte("dimension", (int) m_Map->GetDimension());
+ a_Writer.AddByte("scale", static_cast<Byte>(m_Map->GetScale()));
+ a_Writer.AddByte("dimension", static_cast<Byte>(m_Map->GetDimension()));
- a_Writer.AddShort("width", m_Map->GetWidth());
- a_Writer.AddShort("height", m_Map->GetHeight());
+ a_Writer.AddShort("width", static_cast<Int16>(m_Map->GetWidth()));
+ a_Writer.AddShort("height", static_cast<Int16>(m_Map->GetHeight()));
a_Writer.AddInt("xCenter", m_Map->GetCenterX());
a_Writer.AddInt("zCenter", m_Map->GetCenterZ());
@@ -235,7 +235,7 @@ bool cIDCountSerializer::Load(void)
int CurrLine = NBT.FindChildByName(0, "map");
if (CurrLine >= 0)
{
- m_MapCount = (int)NBT.GetShort(CurrLine) + 1;
+ m_MapCount = static_cast<unsigned int>(NBT.GetShort(CurrLine) + 1);
}
else
{
@@ -255,7 +255,7 @@ bool cIDCountSerializer::Save(void)
if (m_MapCount > 0)
{
- Writer.AddShort("map", m_MapCount - 1);
+ Writer.AddShort("map", static_cast<Int16>(m_MapCount - 1));
}
Writer.Finish();