diff options
| author | joschiwald <joschiwald.trinity@gmail.com> | 2014-08-29 17:46:55 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2014-08-29 17:46:55 +0200 |
| commit | 01380c66bfe3608196a898324cebf142c3ef2ae3 (patch) | |
| tree | d8361be934288c137a8486aea72602120871852f /src/server/game | |
| parent | 88809359e7fa84f808aabb528dca2a77a8eb9816 (diff) | |
Core/Misc: some random changes after recent pull requests
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Battlegrounds/Battleground.cpp | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 69f6666dff3..e95e135d8ce 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -712,24 +712,6 @@ void Battleground::EndBattleground(uint32 winner) int32 winmsg_id = 0; - PreparedStatement* stmt; - PreparedQueryResult result; - uint64 battleground_id = 1; - - if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID); - result = CharacterDatabase.Query(stmt); - - if (result) - { - Field* fields = result->Fetch(); - battleground_id = fields[0].GetUInt64() + 1; - } - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND); - } - if (winner == ALLIANCE) { winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; @@ -737,9 +719,6 @@ void Battleground::EndBattleground(uint32 winner) PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound SetWinner(BG_TEAM_ALLIANCE); - - if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) - stmt->setUInt8(1, BG_TEAM_ALLIANCE); } else if (winner == HORDE) { @@ -748,21 +727,28 @@ void Battleground::EndBattleground(uint32 winner) PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound SetWinner(BG_TEAM_HORDE); - - if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) - stmt->setUInt8(1, BG_TEAM_HORDE); } else { SetWinner(BG_TEAM_NEUTRAL); - - if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) - stmt->setUInt8(1, BG_TEAM_NEUTRAL); } + PreparedStatement* stmt = nullptr; + uint64 battlegroundId = 1; if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) { - stmt->setUInt64(0, battleground_id); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (result) + { + Field* fields = result->Fetch(); + battlegroundId = fields[0].GetUInt64() + 1; + } + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND); + stmt->setUInt64(0, battlegroundId); + stmt->setUInt8(1, GetWinner()); stmt->setUInt8(2, m_BracketId + 1); stmt->setUInt8(3, GetTypeID(true)); CharacterDatabase.Execute(stmt); @@ -810,7 +796,7 @@ void Battleground::EndBattleground(uint32 winner) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_PLAYER); BattlegroundScoreMap::const_iterator score = PlayerScores.find(player->GetGUIDLow()); - stmt->setUInt32(0, battleground_id); + stmt->setUInt32(0, battlegroundId); stmt->setUInt32(1, player->GetGUIDLow()); stmt->setUInt32(2, score->second->GetKillingBlows()); stmt->setUInt32(3, score->second->GetDeaths()); |
