Core/Battlefields: Refactor Battlefield creation to be linked to host map creation instead of having globally accessible objects

This commit is contained in:
Shauren authored and Ovahlord committed 2022-12-26 13:24:59 +01:00
1 parent 28ad85c160
commit 265c2fa508
22 files changed
+253 -192

No files matched your search

+2 -2
View File
@@ -1573,10 +1573,10 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
return tmpscript->OnTrigger(player, trigger);
}
Battlefield* ScriptMgr::CreateBattlefield(uint32 scriptId)
Battlefield* ScriptMgr::CreateBattlefield(uint32 scriptId, Map* map)
{
GET_SCRIPT_RET(BattlefieldScript, scriptId, tmpscript, nullptr);
return tmpscript->GetBattlefield();
return tmpscript->GetBattlefield(map);
}
Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
+2 -2
View File
@@ -462,7 +462,7 @@ class TC_GAME_API BattlefieldScript : public ScriptObject
public:
virtual Battlefield* GetBattlefield() const = 0;
virtual Battlefield* GetBattlefield(Map* map) const = 0;
};
class TC_GAME_API BattlegroundScript : public ScriptObject
@@ -948,7 +948,7 @@ class TC_GAME_API ScriptMgr
public: /* BattlefieldScript */
Battlefield* CreateBattlefield(uint32 scriptId);
Battlefield* CreateBattlefield(uint32 scriptId, Map* map);
public: /* BattlegroundScript */