From 33c6ff872e72563b6e888476b66c4e9c19f8c840 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 11 Dec 2014 14:34:09 +0100 Subject: Cosmetic touchups. Removed trailing whitespace, added cast to remove warning, added file seeking in case of corrupt files. --- src/ClientHandle.cpp | 2 +- src/ClientHandle.h | 4 ++-- src/OSSupport/Event.cpp | 2 +- src/Server.h | 4 ++-- src/WorldStorage/WSSAnvil.cpp | 9 +++++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index cc83bcab3..cb9d34c84 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1800,7 +1800,7 @@ bool cClientHandle::CheckMultiLogin(const AString & a_Username) { return true; } - } Callback; + } Callback; // Check if the player is in any World. if (cRoot::Get()->DoWithPlayer(a_Username, Callback)) diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 0e588d839..25dd250d9 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -280,8 +280,8 @@ public: void HandleEntityLeaveBed (int a_EntityID); void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting); - /** Kicks the current player if the same username is already logged in. - Returns false if a player has been kicked, true otherwise. */ + /** Kicks the client if the same username is already logged in. + Returns false if the client has been kicked, true otherwise. */ bool CheckMultiLogin(const AString & a_Username); /** Called when the protocol handshake has been received (for protocol versions that support it; diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index d6ba937f9..760e536a1 100644 --- a/src/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp @@ -63,7 +63,7 @@ bool cEvent::Wait(unsigned a_TimeoutMSec) } // switch (wait_until()) } // while (m_ShouldWait && not timeout) - // The wait timed out in the while() condition: + // The wait timed out in the while condition: return false; } diff --git a/src/Server.h b/src/Server.h index 39a5a1a71..aab47987f 100644 --- a/src/Server.h +++ b/src/Server.h @@ -71,7 +71,7 @@ public: // tolua_export Returns true is Player is found in queue. */ bool IsPlayerInQueue(AString a_Username); - /** Can login more than once with same username. + /** Can login more than once with same username. Returns false if it is not allowed, true otherwise. */ bool DoesAllowMultiLogin(void) { return m_bAllowMultiLogin; } @@ -225,7 +225,7 @@ private: bool m_bIsHardcore; /** True - allow same username to login more than once False - only once */ - bool m_bAllowMultiLogin; + bool m_bAllowMultiLogin; cTickThread m_TickThread; cEvent m_RestartEvent; diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index ad875b4cb..af65db700 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -2966,10 +2966,11 @@ bool cWSSAnvil::cMCAFile::OpenFile(bool a_IsForReading) if (writeOutNeeded) { + m_File.Seek(0); if ( - (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Write chunk offsets - (m_File.Write(m_TimeStamps, sizeof(m_TimeStamps)) != sizeof(m_TimeStamps)) // Write chunk timestamps - ) + (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Write chunk offsets + (m_File.Write(m_TimeStamps, sizeof(m_TimeStamps)) != sizeof(m_TimeStamps)) // Write chunk timestamps + ) { LOGWARNING("Cannot process MCA header in file \"%s\", chunks in that file will be lost", m_FileName.c_str()); m_File.Close(); @@ -3104,7 +3105,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize); // Set the modification time - m_TimeStamps[LocalX + 32 * LocalZ] = htonl(time(nullptr)); + m_TimeStamps[LocalX + 32 * LocalZ] = htonl(static_cast(time(nullptr))); if (m_File.Seek(0) < 0) { -- cgit v1.2.3