diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 7b519a798..4c0dfa676 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -128,7 +128,7 @@ void cLuaState::Close(void) { LOGWARNING( "%s: Detected mis-use, calling Close() on an attached state (0x%p). Detaching instead.", - __FUNCTION__, m_LuaState + __FUNCTION__, static_cast(m_LuaState) ); Detach(); return; @@ -146,7 +146,7 @@ void cLuaState::Attach(lua_State * a_State) { if (m_LuaState != nullptr) { - LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, m_LuaState); + LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, static_cast(m_LuaState)); if (m_IsOwned) { Close(); @@ -174,7 +174,7 @@ void cLuaState::Detach(void) { LOGWARNING( "%s: Detected a mis-use, calling Detach() when the state is owned. Closing the owned state (0x%p).", - __FUNCTION__, m_LuaState + __FUNCTION__, static_cast(m_LuaState) ); Close(); return; diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 876d4e280..3fc5b477c 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1151,7 +1151,7 @@ static int tolua_cPlayer_GetPermissions(lua_State * tolua_S) cPlayer * self = reinterpret_cast(tolua_tousertype(tolua_S, 1, nullptr)); if (self == nullptr) { - LOGWARNING("%s: invalid self (%p)", __FUNCTION__, self); + LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast(self)); return 0; } @@ -1182,7 +1182,7 @@ static int tolua_cPlayer_GetRestrictions(lua_State * tolua_S) cPlayer * self = reinterpret_cast(tolua_tousertype(tolua_S, 1, nullptr)); if (self == nullptr) { - LOGWARNING("%s: invalid self (%p)", __FUNCTION__, self); + LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast(self)); return 0; } @@ -1211,7 +1211,7 @@ static int tolua_cPlayer_OpenWindow(lua_State * tolua_S) cWindow * wnd = reinterpret_cast(tolua_tousertype(tolua_S, 2, nullptr)); if ((self == nullptr) || (wnd == nullptr)) { - LOGWARNING("%s: invalid self (%p) or wnd (%p)", __FUNCTION__, self, wnd); + LOGWARNING("%s: invalid self (%p) or wnd (%p)", __FUNCTION__, static_cast(self), static_cast(wnd)); return 0; } @@ -1292,7 +1292,7 @@ static int tolua_SetObjectCallback(lua_State * tolua_S) OBJTYPE * self = reinterpret_cast(tolua_tousertype(tolua_S, 1, nullptr)); if (self == nullptr) { - LOGWARNING("%s: invalid self (%p)", __FUNCTION__, self); + LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast(self)); return 0; } int FnRef = luaL_ref(tolua_S, LUA_REGISTRYINDEX); // Store function reference for later retrieval diff --git a/src/Bindings/ManualBindings.h b/src/Bindings/ManualBindings.h index 38f7ac5f1..e2556bafd 100644 --- a/src/Bindings/ManualBindings.h +++ b/src/Bindings/ManualBindings.h @@ -400,7 +400,7 @@ public: L.GetStackValues(1, Self, Box, FnRef); if ((Self == nullptr) || (Box == nullptr)) { - LOGWARNING("Invalid world (%p) or boundingbox (%p)", Self, Box); + LOGWARNING("Invalid world (%p) or boundingbox (%p)", static_cast(Self), static_cast(Box)); L.LogStackTrace(); return 0; } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 7a6938b77..39a5a6053 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -490,7 +490,7 @@ void cChunk::CollectMobCensus(cMobCensus & toFill) { auto & Monster = reinterpret_cast(*entity); currentPosition = Monster.GetPosition(); - for (const auto PlayerPos : PlayerPositions) + for (const auto & PlayerPos : PlayerPositions) { toFill.CollectMob(Monster, *this, (currentPosition - PlayerPos).SqrLength()); } diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index a11ceb060..a4771ce52 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1723,7 +1723,7 @@ void cChunkMap::AddEntity(cEntity * a_Entity) ) { LOGWARNING("Entity at %p (%s, ID %d) spawning in a non-existent chunk, the entity is lost.", - a_Entity, a_Entity->GetClass(), a_Entity->GetUniqueID() + static_cast(a_Entity), a_Entity->GetClass(), a_Entity->GetUniqueID() ); return; } @@ -1744,7 +1744,7 @@ void cChunkMap::AddEntityIfNotPresent(cEntity * a_Entity) ) { LOGWARNING("Entity at %p (%s, ID %d) spawning in a non-existent chunk, the entity is lost.", - a_Entity, a_Entity->GetClass(), a_Entity->GetUniqueID() + static_cast(a_Entity), a_Entity->GetClass(), a_Entity->GetUniqueID() ); return; } diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 6c9e6a781..98005e934 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -95,7 +95,7 @@ cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) : m_UniqueID = s_ClientCount; m_PingStartTime = std::chrono::steady_clock::now(); - LOGD("New ClientHandle created at %p", this); + LOGD("New ClientHandle created at %p", static_cast(this)); } @@ -106,7 +106,7 @@ cClientHandle::~cClientHandle() { ASSERT(m_State == csDestroyed); // Has Destroy() been called? - LOGD("Deleting client \"%s\" at %p", GetUsername().c_str(), this); + LOGD("Deleting client \"%s\" at %p", GetUsername().c_str(), static_cast(this)); { cCSLock Lock(m_CSChunkLists); @@ -140,7 +140,7 @@ cClientHandle::~cClientHandle() delete m_Protocol; m_Protocol = nullptr; - LOGD("ClientHandle at %p deleted", this); + LOGD("ClientHandle at %p deleted", static_cast(this)); } @@ -164,7 +164,7 @@ void cClientHandle::Destroy(void) } // DEBUG: - LOGD("%s: client %p, \"%s\"", __FUNCTION__, this, m_Username.c_str()); + LOGD("%s: client %p, \"%s\"", __FUNCTION__, static_cast(this), m_Username.c_str()); if ((m_Player != nullptr) && (m_Player->GetWorld() != nullptr)) { @@ -2935,7 +2935,7 @@ void cClientHandle::AddWantedChunk(int a_ChunkX, int a_ChunkZ) return; } - LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, this); + LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, static_cast(this)); cCSLock Lock(m_CSChunkLists); if (m_ChunksToSend.find(cChunkCoords(a_ChunkX, a_ChunkZ)) == m_ChunksToSend.end()) { diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 910ad4c0e..d35b92296 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -150,7 +150,7 @@ cPlayer::~cPlayer(void) LOGINFO("Player %s has left the game", GetName().c_str()); } - LOGD("Deleting cPlayer \"%s\" at %p, ID %d", GetName().c_str(), this, GetUniqueID()); + LOGD("Deleting cPlayer \"%s\" at %p, ID %d", GetName().c_str(), static_cast(this), GetUniqueID()); // Notify the server that the player is being destroyed cRoot::Get()->GetServer()->PlayerDestroying(this); @@ -162,7 +162,7 @@ cPlayer::~cPlayer(void) delete m_InventoryWindow; m_InventoryWindow = nullptr; - LOGD("Player %p deleted", this); + LOGD("Player %p deleted", static_cast(this)); } diff --git a/src/main.cpp b/src/main.cpp index 6e7dc0aff..c26e7900f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -522,7 +522,7 @@ int main(int argc, char **argv) while (!cRoot::m_TerminateEventRaised) { - UniversalMain(std::move(ParseArguments(argc, argv))); + UniversalMain(ParseArguments(argc, argv)); } #endif } @@ -531,7 +531,7 @@ int main(int argc, char **argv) while (!cRoot::m_TerminateEventRaised) { // Not running as a service, do normal startup - UniversalMain(std::move(ParseArguments(argc, argv))); + UniversalMain(ParseArguments(argc, argv)); } }