From 4f214f55d7930bc7cb0175c3d69509b42cda399f Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 30 May 2011 05:05:40 +0400 Subject: [PATCH] [11566] Fixed problem with reuse BG save data not only at first failed login to BG. Most visible problem result: infinity restart in taxi flight after join to BG from taxi if character logout in BG and BG finished before re-login. --- src/game/Player.cpp | 13 ++++++++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b954db9dc..78a1de3fc 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15487,7 +15487,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) _LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES)); - if(!IsPositionValid()) + if (!IsPositionValid()) { sLog.outError("%s have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid.GetString().c_str(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); @@ -15500,13 +15500,13 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) _LoadBGData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBGDATA)); - if(m_bgData.bgInstanceID) //saved in BattleGround + if (m_bgData.bgInstanceID) //saved in BattleGround { BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE); bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetObjectGuid()); - if(player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE) + if (player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE) { BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); AddBattleGroundQueueId(bgQueueTypeId); @@ -15532,6 +15532,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) // We are not in BG anymore SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); + // remove outdated DB data in DB + _SaveBGData(); } } else @@ -15544,6 +15546,11 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) const WorldLocation& _loc = GetBattleGroundEntryPoint(); SetLocationMapId(_loc.mapid); Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation); + + // We are not in BG anymore + SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); + // remove outdated DB data in DB + _SaveBGData(); } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f4b693437..4624dcd67 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11565" + #define REVISION_NR "11566" #endif // __REVISION_NR_H__