diff options
Diffstat (limited to 'src/crplayer.cc')
| -rw-r--r-- | src/crplayer.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/crplayer.cc b/src/crplayer.cc index 8878bda..86b0c47 100644 --- a/src/crplayer.cc +++ b/src/crplayer.cc @@ -205,7 +205,7 @@ TPlayer::TPlayer(TConnection *Connection, uint32 CharacterID): SendAmbiente(Connection); AnnounceChangedCreature(CharacterID, CREATURE_LIGHT_CHANGED); SendPlayerSkills(Connection); - this->CheckState(); + this->SyncState(); this->SendBuddies(); if(PlayerData->LastLoginTime != 0){ @@ -750,7 +750,6 @@ void TPlayer::TakeOver(TConnection *Connection){ strcpy(this->Guild, PlayerData->Guild); strcpy(this->Rank, PlayerData->Rank); strcpy(this->Title, PlayerData->Title); - this->OldState = 0; this->CheckOutfit(); this->ClearRequest(); @@ -770,7 +769,7 @@ void TPlayer::TakeOver(TConnection *Connection){ SendAmbiente(Connection); SendPlayerData(Connection); SendPlayerSkills(Connection); - this->CheckState(); + this->SyncState(); this->SendBuddies(); } @@ -1254,6 +1253,16 @@ void TPlayer::CheckState(void){ } } +void TPlayer::SyncState(void){ + // NOTE(fusion): This is only called after a new connection is established, + // when we know that the current client state is ZERO but `OldState` may not. + // It'll typically be the case in `TPlayer::TakeOver` but can also happen + // in the player constructor if `TPlayer::CheckState` is called from within + // any helper function before `TConnection::EnterGame` (see `BeginSendData`). + this->OldState = 0; + this->CheckState(); +} + void TPlayer::AddBuddy(const char *Name){ if(Name == NULL){ error("TPlayer::AddBuddy: Name ist NULL.\n"); |
