1
0

Cosmetic touchups.

Removed trailing whitespace, added cast to remove warning, added file seeking in case of corrupt files.
This commit is contained in:
Mattes D 2014-12-11 14:34:09 +01:00
parent 1b1f971752
commit 33c6ff872e
5 changed files with 11 additions and 10 deletions

View File

@ -1800,7 +1800,7 @@ bool cClientHandle::CheckMultiLogin(const AString & a_Username)
{ {
return true; return true;
} }
} Callback; } Callback;
// Check if the player is in any World. // Check if the player is in any World.
if (cRoot::Get()->DoWithPlayer(a_Username, Callback)) if (cRoot::Get()->DoWithPlayer(a_Username, Callback))

View File

@ -280,8 +280,8 @@ public:
void HandleEntityLeaveBed (int a_EntityID); void HandleEntityLeaveBed (int a_EntityID);
void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting); void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting);
/** Kicks the current player if the same username is already logged in. /** Kicks the client if the same username is already logged in.
Returns false if a player has been kicked, true otherwise. */ Returns false if the client has been kicked, true otherwise. */
bool CheckMultiLogin(const AString & a_Username); bool CheckMultiLogin(const AString & a_Username);
/** Called when the protocol handshake has been received (for protocol versions that support it; /** Called when the protocol handshake has been received (for protocol versions that support it;

View File

@ -63,7 +63,7 @@ bool cEvent::Wait(unsigned a_TimeoutMSec)
} // switch (wait_until()) } // switch (wait_until())
} // while (m_ShouldWait && not timeout) } // while (m_ShouldWait && not timeout)
// The wait timed out in the while() condition: // The wait timed out in the while condition:
return false; return false;
} }

View File

@ -71,7 +71,7 @@ public: // tolua_export
Returns true is Player is found in queue. */ Returns true is Player is found in queue. */
bool IsPlayerInQueue(AString a_Username); 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. */ Returns false if it is not allowed, true otherwise. */
bool DoesAllowMultiLogin(void) { return m_bAllowMultiLogin; } bool DoesAllowMultiLogin(void) { return m_bAllowMultiLogin; }
@ -225,7 +225,7 @@ private:
bool m_bIsHardcore; bool m_bIsHardcore;
/** True - allow same username to login more than once False - only once */ /** True - allow same username to login more than once False - only once */
bool m_bAllowMultiLogin; bool m_bAllowMultiLogin;
cTickThread m_TickThread; cTickThread m_TickThread;
cEvent m_RestartEvent; cEvent m_RestartEvent;

View File

@ -2966,10 +2966,11 @@ bool cWSSAnvil::cMCAFile::OpenFile(bool a_IsForReading)
if (writeOutNeeded) if (writeOutNeeded)
{ {
m_File.Seek(0);
if ( if (
(m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Write chunk offsets (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_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()); LOGWARNING("Cannot process MCA header in file \"%s\", chunks in that file will be lost", m_FileName.c_str());
m_File.Close(); 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); m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize);
// Set the modification time // Set the modification time
m_TimeStamps[LocalX + 32 * LocalZ] = htonl(time(nullptr)); m_TimeStamps[LocalX + 32 * LocalZ] = htonl(static_cast<u_long>(time(nullptr)));
if (m_File.Seek(0) < 0) if (m_File.Seek(0) < 0)
{ {