aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp13
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.h7
2 files changed, 12 insertions, 8 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 5ab5aea30c1..ce555b3c503 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -437,6 +437,13 @@ inline void Battleground::_ProcessJoin(uint32 diff)
{
m_Events |= BG_STARTING_EVENT_1;
+ if(!FindBgMap())
+ {
+ sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
+ EndNow();
+ return;
+ }
+
// Setup here, only when at least one player has ported to the map
if (!SetupBattleground())
{
@@ -1407,7 +1414,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
// If the assert is called, means that m_BgObjects must be resized!
ASSERT(type < m_BgObjects.size());
- Map* map = GetBgMap();
+ Map* map = FindBgMap();
if (!map)
return false;
// Must be created this way, adding to godatamap would add it to the base map of the instance
@@ -1504,7 +1511,7 @@ Creature* Battleground::GetBGCreature(uint32 type)
void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
{
- if (Map* map = GetBgMap())
+ if (Map* map = FindBgMap())
if (GameObject* obj = map->GetGameObject(m_BgObjects[type]))
{
if (respawntime)
@@ -1523,7 +1530,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
// If the assert is called, means that m_BgCreatures must be resized!
ASSERT(type < m_BgCreatures.size());
- Map* map = GetBgMap();
+ Map* map = FindBgMap();
if (!map)
return NULL;
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index bd83f2bcb48..d5921e4bf37 100755
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -431,11 +431,8 @@ class Battleground
// Map pointers
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
- BattlegroundMap* GetBgMap()
- {
- ASSERT(m_Map);
- return m_Map;
- }
+ BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
+ BattlegroundMap* FindBgMap() const { return m_Map; }
void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O);
void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const