diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-03-09 18:32:56 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-03-09 18:32:56 +0100 |
commit | 676dcfd1c74a36882b5b9bb75749e3bd86b75d9e (patch) | |
tree | 7b29fc2241f2059d54e28bed17a3f6aa47c42f35 | |
parent | Its a const not a macro (diff) | |
download | cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.tar cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.tar.gz cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.tar.bz2 cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.tar.lz cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.tar.xz cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.tar.zst cuberite-676dcfd1c74a36882b5b9bb75749e3bd86b75d9e.zip |
-rw-r--r-- | SetFlags.cmake | 2 | ||||
-rw-r--r-- | src/ChunkDef.h | 32 | ||||
-rw-r--r-- | src/Globals.h | 2 |
3 files changed, 25 insertions, 11 deletions
diff --git a/SetFlags.cmake b/SetFlags.cmake index ec2f6c556..82472f333 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -192,7 +192,7 @@ macro(set_exe_flags) add_flags_cxx("-D__extern_always_inline=inline") add_flags_cxx("-Weverything -Wno-c++98-compat-pedantic -Wno-string-conversion") add_flags_cxx("-Wno-extra-semi -Wno-error=switch-enum -Wno-documentation") - add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=padded") + add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-padded") add_flags_cxx("-Wno-error=deprecated -Wno-error=weak-vtables -Wno-error=float-equal") add_flags_cxx("-Wno-error=missing-prototypes -Wno-error=non-virtual-dtor") add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow") diff --git a/src/ChunkDef.h b/src/ChunkDef.h index 63431f211..a5059348c 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -124,7 +124,9 @@ public: (z < Width) && (z > -1) ) { - return MakeIndexNoCheck(x, y, z); + return MakeIndexNoCheck(static_cast<unsigned int>(x), + static_cast<unsigned int>(y), + static_cast<unsigned int>(z)); } LOGERROR("cChunkDef::MakeIndex(): coords out of range: {%d, %d, %d}; returning fake index 0", x, y, z); ASSERT(!"cChunkDef::MakeIndex(): coords out of chunk range!"); @@ -166,7 +168,9 @@ public: ASSERT((a_X >= 0) && (a_X < Width)); ASSERT((a_Y >= 0) && (a_Y < Height)); ASSERT((a_Z >= 0) && (a_Z < Width)); - a_BlockTypes[MakeIndexNoCheck(a_X, a_Y, a_Z)] = a_Type; + a_BlockTypes[MakeIndexNoCheck(static_cast<unsigned int>(a_X), + static_cast<unsigned int>(a_Y), + static_cast<unsigned int>(a_Z))] = a_Type; } @@ -182,7 +186,9 @@ public: ASSERT((a_X >= 0) && (a_X < Width)); ASSERT((a_Y >= 0) && (a_Y < Height)); ASSERT((a_Z >= 0) && (a_Z < Width)); - return a_BlockTypes[MakeIndexNoCheck(a_X, a_Y, a_Z)]; + return a_BlockTypes[MakeIndexNoCheck(static_cast<unsigned int>(a_X), + static_cast<unsigned int>(a_Y), + static_cast<unsigned int>(a_Z))]; } @@ -240,7 +246,9 @@ public: { if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1)) { - unsigned int Index = MakeIndexNoCheck(x, y, z); + unsigned int Index = MakeIndexNoCheck(static_cast<unsigned int>(x), + static_cast<unsigned int>(y), + static_cast<unsigned int>(z)); return (a_Buffer[Index / 2] >> ((Index & 1) * 4)) & 0x0f; } ASSERT(!"cChunkDef::GetNibble(): coords out of chunk range!"); @@ -255,8 +263,8 @@ public: ASSERT(!"cChunkDef::SetNibble(): index out of range!"); return; } - a_Buffer[a_BlockIdx / 2] = ( - (a_Buffer[a_BlockIdx / 2] & (0xf0 >> (static_cast<NIBBLETYPE>(a_BlockIdx & 1) * 4))) | // The untouched nibble + a_Buffer[a_BlockIdx / 2] = static_cast<NIBBLETYPE>( + (a_Buffer[a_BlockIdx / 2] & (0xf0 >> ((a_BlockIdx & 1) * 4))) | // The untouched nibble ((a_Nibble & 0x0f) << ((a_BlockIdx & 1) * 4)) // The nibble being set ); } @@ -274,8 +282,10 @@ public: return; } - int Index = MakeIndexNoCheck(x, y, z); - a_Buffer[Index / 2] = ( + unsigned int Index = MakeIndexNoCheck(static_cast<unsigned int>(x), + static_cast<unsigned int>(y), + static_cast<unsigned int>(z)); + a_Buffer[Index / 2] = static_cast<NIBBLETYPE>( (a_Buffer[Index / 2] & (0xf0 >> ((Index & 1) * 4))) | // The untouched nibble ((a_Nibble & 0x0f) << ((Index & 1) * 4)) // The nibble being set ); @@ -435,6 +445,9 @@ Used primarily for entity moving while both chunks are locked. class cClientDiffCallback { public: + + virtual ~cClientDiffCallback() {} + /// Called for clients that are in Chunk1 and not in Chunk2, virtual void Removed(cClientHandle * a_Client) = 0; @@ -495,6 +508,9 @@ typedef std::vector<cChunkCoords> cChunkCoordsVector; class cChunkCoordCallback { public: + + virtual ~cChunkCoordCallback() {} + virtual void Call(int a_ChunkX, int a_ChunkZ) = 0; } ; diff --git a/src/Globals.h b/src/Globals.h index 28805a83f..98611fc55 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -254,5 +254,3 @@ T Clamp(T a_Value, T a_Min, T a_Max) #include "Entities/Effects.h" - - |