From 48d30d6ab4657e00c0c861d67285256daeff1142 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 1 Feb 2012 22:38:03 +0000 Subject: Rewritten cAuthenticator to make use of the new cIsThread architecture - now authentication runs in a single separate thread for all clients; Global player-kicking function (cServer, cRoot); More char * -> AString conversion git-svn-id: http://mc-server.googlecode.com/svn/trunk@221 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPlayer.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source/cPlayer.cpp') diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index 982427a86..44b27e14a 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -64,7 +64,7 @@ struct cPlayer::sPlayerState std::string LoadedWorldName; }; -cPlayer::cPlayer(cClientHandle* a_Client, const char* a_PlayerName) +cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) : m_GameMode( 0 ) , m_IP("") , m_LastBlockActionTime( 0 ) @@ -134,7 +134,7 @@ cPlayer::~cPlayer(void) void cPlayer::SpawnOn( cClientHandle* a_Target ) { if( a_Target == m_ClientHandle || !m_bVisible ) return; - LOG("cPlayer::SpawnOn -> Sending %s to %s", m_pState->PlayerName.c_str(), (a_Target)?a_Target->GetUsername():"Everybody" ); + LOG("cPlayer::SpawnOn -> Sending %s to %s", m_pState->PlayerName.c_str(), (a_Target) ? a_Target->GetUsername().c_str() : "Everybody" ); cPacket_NamedEntitySpawn SpawnPacket; SpawnPacket.m_UniqueID = m_UniqueID; SpawnPacket.m_PlayerName = m_pState->PlayerName; @@ -897,16 +897,24 @@ bool cPlayer::SaveToDisk() -const char* cPlayer::GetName() +const AString & cPlayer::GetName(void) const { - return m_pState->PlayerName.c_str(); + return m_pState->PlayerName; } -void cPlayer::SetName( const char* a_Name ) + + + + +void cPlayer::SetName(const AString & a_Name ) { m_pState->PlayerName = a_Name; } + + + + const cPlayer::GroupList & cPlayer::GetGroups() { return m_pState->Groups; @@ -935,7 +943,7 @@ void cPlayer::UseEquippedItem() if(GetGameMode() != 1) //No damage in creative if (GetInventory().GetEquippedItem().DamageItem()) { - LOG("Player %s Broke ID: %i", GetClientHandle()->GetUsername(), GetInventory().GetEquippedItem().m_ItemID); + LOG("Player %s Broke ID: %i", GetClientHandle()->GetUsername().c_str(), GetInventory().GetEquippedItem().m_ItemID); GetInventory().RemoveItem( GetInventory().GetEquippedItem()); } } \ No newline at end of file -- cgit v1.2.3