diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/BlockEntities/MobSpawnerEntity.cpp | 3 | ||||
-rw-r--r-- | src/BlockEntities/NoteEntity.cpp | 12 | ||||
-rw-r--r-- | src/Entities/SplashPotionEntity.cpp | 11 | ||||
-rw-r--r-- | src/Generating/ChunkDesc.cpp | 2 | ||||
-rw-r--r-- | src/LineBlockTracer.cpp | 10 | ||||
-rw-r--r-- | src/LoggerListeners.cpp | 8 | ||||
-rw-r--r-- | src/Mobs/Guardian.cpp | 6 | ||||
-rw-r--r-- | src/Mobs/Horse.cpp | 8 | ||||
-rw-r--r-- | src/Mobs/Path.cpp | 18 | ||||
-rw-r--r-- | src/Mobs/Squid.cpp | 6 | ||||
-rw-r--r-- | src/Noise/Noise.h | 3 | ||||
-rw-r--r-- | src/PolarSSL++/SslContext.h | 4 | ||||
-rw-r--r-- | src/Simulator/DelayedFluidSimulator.cpp | 4 | ||||
-rw-r--r-- | src/Simulator/FloodyFluidSimulator.cpp | 8 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.cpp | 9 | ||||
-rw-r--r-- | src/Simulator/VaporizeFluidSimulator.cpp | 4 | ||||
-rw-r--r-- | src/UI/EnderChestWindow.cpp | 15 | ||||
-rw-r--r-- | src/WebAdmin.cpp | 4 |
19 files changed, 82 insertions, 63 deletions
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt index b14576ea0..0a069ad85 100644 --- a/src/Bindings/CMakeLists.txt +++ b/src/Bindings/CMakeLists.txt @@ -146,12 +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(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") + 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) diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp index 4746bdd1b..1a0ce5b22 100644 --- a/src/BlockEntities/MobSpawnerEntity.cpp +++ b/src/BlockEntities/MobSpawnerEntity.cpp @@ -177,7 +177,8 @@ void cMobSpawnerEntity::SpawnEntity(void) static_cast<int>(PosX * 8.0), static_cast<int>(RelY * 8.0), static_cast<int>(PosZ * 8.0), - 0); + 0 + ); m_NearbyEntitiesNum++; } } diff --git a/src/BlockEntities/NoteEntity.cpp b/src/BlockEntities/NoteEntity.cpp index 48ca15d1f..29839bae1 100644 --- a/src/BlockEntities/NoteEntity.cpp +++ b/src/BlockEntities/NoteEntity.cpp @@ -92,11 +92,13 @@ void cNoteEntity::MakeSound(void) // 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, 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); + sampleName, + static_cast<double>(m_PosX), + static_cast<double>(m_PosY), + static_cast<double>(m_PosZ), + 3.0f, + calcPitch + ); } diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index a79ba92b0..926fd1abe 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -117,11 +117,12 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos) m_World->ForEachEntity(Callback); 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); + 2002, + FloorC(a_HitPos.x), + FloorC(a_HitPos.y), + FloorC(a_HitPos.z), + m_PotionColor + ); } diff --git a/src/Generating/ChunkDesc.cpp b/src/Generating/ChunkDesc.cpp index fe5182004..07855b1d0 100644 --- a/src/Generating/ChunkDesc.cpp +++ b/src/Generating/ChunkDesc.cpp @@ -158,7 +158,7 @@ void cChunkDesc::SetHeightFromShape(const Shape & a_Shape) { for (int x = 0; x < cChunkDef::Width; x++) { - for (unsigned char y = cChunkDef::Height - 1; y > 0; y--) + for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--) { if (a_Shape[y + x * 256 + z * 16 * 256] != 0) { diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp index ee28bef88..315e8d082 100644 --- a/src/LineBlockTracer.cpp +++ b/src/LineBlockTracer.cpp @@ -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 = static_cast<int>(floor(m_StartX)); - m_CurrentY = static_cast<int>(floor(m_StartY)); - m_CurrentZ = static_cast<int>(floor(m_StartZ)); + m_CurrentX = FloorC(m_StartX); + m_CurrentY = FloorC(m_StartY); + m_CurrentZ = FloorC(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 = static_cast<int>(floor(m_StartX)); - int BlockZ = static_cast<int>(floor(m_StartZ)); + int BlockX = FloorC(m_StartX); + int BlockZ = FloorC(m_StartZ); int ChunkX, ChunkZ; cChunkDef::BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ); return m_World->DoWithChunk(ChunkX, ChunkZ, *this); diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp index cc2f883d8..31b12af1e 100644 --- a/src/LoggerListeners.cpp +++ b/src/LoggerListeners.cpp @@ -283,8 +283,12 @@ cFileListener::cFileListener(void) cFile::CreateFolder(FILE_IO_PREFIX + AString("logs")); AString FileName; 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()); + 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); } diff --git a/src/Mobs/Guardian.cpp b/src/Mobs/Guardian.cpp index 6efd4a42b..cfe7861a6 100644 --- a/src/Mobs/Guardian.cpp +++ b/src/Mobs/Guardian.cpp @@ -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 = static_cast<int>(floor(Pos.y)); + int RelY = FloorC(Pos.y); if ((RelY < 0) || (RelY >= cChunkDef::Height)) { return; } - 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; + int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width; + int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width; BLOCKTYPE BlockType; if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire()) { diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index 4321fdc73..ce3bd65eb 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -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, 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_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 0); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 2); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 6); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 8); m_Attachee->Detach(); m_bIsRearing = true; diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp index 4d04d9861..1848e144e 100644 --- a/src/Mobs/Path.cpp +++ b/src/Mobs/Path.cpp @@ -46,18 +46,18 @@ cPath::cPath( a_BoundingBoxWidth = 1; // Until we improve physics, if ever. - m_BoundingBoxWidth = static_cast<int>(ceil(a_BoundingBoxWidth)); - m_BoundingBoxHeight = static_cast<int>(ceil(a_BoundingBoxHeight)); + m_BoundingBoxWidth = CeilC(a_BoundingBoxWidth); + m_BoundingBoxHeight = CeilC(a_BoundingBoxHeight); m_HalfWidth = a_BoundingBoxWidth / 2; - int HalfWidthInt = static_cast<int>(a_BoundingBoxWidth / 2); - m_Source.x = static_cast<int>(floor(a_StartingPoint.x - HalfWidthInt)); - m_Source.y = static_cast<int>(floor(a_StartingPoint.y)); - m_Source.z = static_cast<int>(floor(a_StartingPoint.z - HalfWidthInt)); + int HalfWidthInt = FloorC(a_BoundingBoxWidth / 2); + m_Source.x = FloorC(a_StartingPoint.x - HalfWidthInt); + m_Source.y = FloorC(a_StartingPoint.y); + m_Source.z = FloorC(a_StartingPoint.z - HalfWidthInt); - m_Destination.x = static_cast<int>(floor(a_EndingPoint.x - HalfWidthInt)); - m_Destination.y = static_cast<int>(floor(a_EndingPoint.y)); - m_Destination.z = static_cast<int>(floor(a_EndingPoint.z - HalfWidthInt)); + m_Destination.x = FloorC(a_EndingPoint.x - HalfWidthInt); + m_Destination.y = FloorC(a_EndingPoint.y); + m_Destination.z = FloorC(a_EndingPoint.z - HalfWidthInt); if (GetCell(m_Source)->m_IsSolid || GetCell(m_Destination)->m_IsSolid) { diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp index 7928f7dc8..d148d65f3 100644 --- a/src/Mobs/Squid.cpp +++ b/src/Mobs/Squid.cpp @@ -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 = static_cast<int>(floor(Pos.y)); + int RelY = FloorC(Pos.y); if ((RelY < 0) || (RelY >= cChunkDef::Height)) { return; } - 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; + int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width; + int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width; BLOCKTYPE BlockType; if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire()) { diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index be3b282ac..b08b96e24 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -210,7 +210,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 (static_cast<NOISE_DATATYPE>(1) - - static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); + static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f + ); // returns a float number in the range of [-1, 1] } diff --git a/src/PolarSSL++/SslContext.h b/src/PolarSSL++/SslContext.h index ce6a2e398..408fc7c56 100644 --- a/src/PolarSSL++/SslContext.h +++ b/src/PolarSSL++/SslContext.h @@ -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 (static_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes); + return (reinterpret_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 (static_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes); + return (reinterpret_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes); } #ifdef _DEBUG diff --git a/src/Simulator/DelayedFluidSimulator.cpp b/src/Simulator/DelayedFluidSimulator.cpp index cbf70bf05..e0da3ff61 100644 --- a/src/Simulator/DelayedFluidSimulator.cpp +++ b/src/Simulator/DelayedFluidSimulator.cpp @@ -99,7 +99,7 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, return; } - void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData(); + auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData(); cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw); cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_AddSlotNum]; @@ -132,7 +132,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(); + auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData(); cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw); cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum]; diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp index e7082d9ab..69c46f090 100644 --- a/src/Simulator/FloodyFluidSimulator.cpp +++ b/src/Simulator/FloodyFluidSimulator.cpp @@ -260,7 +260,9 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i static_cast<double>(BlockX), static_cast<double>(a_RelY), static_cast<double>(BlockZ), - 0.5f, 1.5f); + 0.5f, + 1.5f + ); return; } } @@ -280,7 +282,9 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i static_cast<double>(BlockX), static_cast<double>(a_RelY), static_cast<double>(BlockZ), - 0.5f, 1.5f); + 0.5f, + 1.5f + ); return; } } diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp index e11bc714a..70dde8cc0 100644 --- a/src/Simulator/SandSimulator.cpp +++ b/src/Simulator/SandSimulator.cpp @@ -267,10 +267,11 @@ void cSandSimulator::FinishFalling( cItems Pickups; Pickups.Add(static_cast<ENUM_ITEM_ID>(a_FallingBlockType), 1, a_FallingBlockMeta); a_World->SpawnItemPickups( - Pickups, - static_cast<double>(a_BlockX) + 0.5, - static_cast<double>(a_BlockY) + 0.5, - static_cast<double>(a_BlockZ) + 0.5); + Pickups, + static_cast<double>(a_BlockX) + 0.5, + static_cast<double>(a_BlockY) + 0.5, + static_cast<double>(a_BlockZ) + 0.5 + ); } diff --git a/src/Simulator/VaporizeFluidSimulator.cpp b/src/Simulator/VaporizeFluidSimulator.cpp index 7bca6c580..d766b069f 100644 --- a/src/Simulator/VaporizeFluidSimulator.cpp +++ b/src/Simulator/VaporizeFluidSimulator.cpp @@ -40,7 +40,9 @@ void cVaporizeFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, static_cast<double>(a_BlockX), static_cast<double>(a_BlockY), static_cast<double>(a_BlockZ), - 1.0f, 0.6f); + 1.0f, + 0.6f + ); } } diff --git a/src/UI/EnderChestWindow.cpp b/src/UI/EnderChestWindow.cpp index 9a4918aa4..c597f3a9b 100644 --- a/src/UI/EnderChestWindow.cpp +++ b/src/UI/EnderChestWindow.cpp @@ -29,7 +29,9 @@ cEnderChestWindow::cEnderChestWindow(cEnderChestEntity * a_EnderChest) : static_cast<double>(m_BlockX), static_cast<double>(m_BlockY), static_cast<double>(m_BlockZ), - 1, 1); + 1, + 1 + ); // Send out the chest-open packet: m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_ENDER_CHEST); @@ -46,11 +48,12 @@ cEnderChestWindow::~cEnderChestWindow() // Play the closing sound m_World->BroadcastSoundEffect( - "random.chestclosed", - static_cast<double>(m_BlockX), - static_cast<double>(m_BlockY), - static_cast<double>(m_BlockZ), - 1, 1); + "random.chestclosed", + static_cast<double>(m_BlockX), + static_cast<double>(m_BlockY), + static_cast<double>(m_BlockZ), + 1, 1 + ); } diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index 1295d90f7..91fad96c6 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -648,7 +648,7 @@ void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_ void cWebAdmin::OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) { UNUSED(a_Connection); - cRequestData * Data = static_cast<cRequestData *>(a_Request.GetUserData()); + cRequestData * Data = reinterpret_cast<cRequestData *>(a_Request.GetUserData()); if (Data == nullptr) { return; @@ -681,7 +681,7 @@ void cWebAdmin::OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & } // Delete any request data assigned to the request: - cRequestData * Data = static_cast<cRequestData *>(a_Request.GetUserData()); + cRequestData * Data = reinterpret_cast<cRequestData *>(a_Request.GetUserData()); delete Data; Data = nullptr; } |