From 073a036d84365dae60a70064eb67e68f0447bd72 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 19 Jul 2022 23:18:19 +0200 Subject: Core/Battlefields: Refactor Battlefield creation to be linked to host map creation instead of having globally accessible objects --- src/server/scripts/Commands/cs_bf.cpp | 11 ++++++----- src/server/scripts/Commands/cs_debug.cpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 55d9ecc68d7..d883b5609bd 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "BattlefieldMgr.h" #include "Chat.h" #include "ChatCommand.h" +#include "Player.h" #include "RBAC.h" using namespace Trinity::ChatCommands; @@ -54,7 +55,7 @@ public: static bool HandleBattlefieldStart(ChatHandler* handler, uint32 battleId) { - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(handler->GetPlayer()->GetMap(), battleId); if (!bf) return false; @@ -69,7 +70,7 @@ public: static bool HandleBattlefieldEnd(ChatHandler* handler, uint32 battleId) { - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(handler->GetPlayer()->GetMap(), battleId); if (!bf) return false; @@ -84,7 +85,7 @@ public: static bool HandleBattlefieldEnable(ChatHandler* handler, uint32 battleId) { - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(handler->GetPlayer()->GetMap(), battleId); if (!bf) return false; @@ -107,7 +108,7 @@ public: static bool HandleBattlefieldSwitch(ChatHandler* handler, uint32 battleId) { - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(handler->GetPlayer()->GetMap(), battleId); if (!bf) return false; @@ -121,7 +122,7 @@ public: static bool HandleBattlefieldTimer(ChatHandler* handler, uint32 battleId, uint32 time) { - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(handler->GetPlayer()->GetMap(), battleId); if (!bf) return false; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 97b772f18c9..b3879bafd56 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1408,7 +1408,7 @@ public: nearestLoc = bg->GetClosestGraveyard(player); else { - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId())) + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetMap(), player->GetZoneId())) nearestLoc = bf->GetClosestGraveyard(player); else nearestLoc = sObjectMgr->GetClosestGraveyard(*player, player->GetTeam(), player); -- cgit v1.2.3