aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorr00ty-tc <r00ty-tc@users.noreply.github.com>2017-10-05 00:39:43 +0100
committerShauren <shauren.trinity@gmail.com>2020-12-31 23:23:50 +0100
commit2a84b5ae1a571ebc6e8b697028d0e0155fe88a50 (patch)
treeabed0be823f5ea9aa24008d3015cf97c46409283 /src
parenta3acdb12cb0c94cec4ea10b4c1285fb0fd89f988 (diff)
Core/Spawns: Resolve crash in BattlegroundAV
- Correctly set spawngroup on spawned creatures in Alterac Valley BG - Sanity check on application of dynamic spawn rates (not for BG/Arena maps) - Check that spawndata exists before using it. Closes #20535 (cherry picked from commit 55b9a3f65faeefb1c361b74b7a424d53e2d4c72e)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp1
-rw-r--r--src/server/game/Maps/Map.cpp6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index f3684e7c037..63c57fb2873 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -306,6 +306,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
|| (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
{
CreatureData &data = sObjectMgr->NewOrExistCreatureData(creature->GetSpawnId());
+ data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup();
data.spawndist = 5;
}
//else spawndist will be 15, so creatures move maximum=10
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 5cee4bb478b..46113830f7f 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3577,6 +3577,10 @@ void Map::ApplyDynamicModeRespawnScaling(WorldObject const* obj, ObjectGuid::Low
{
ASSERT(mode == 1);
ASSERT(obj->GetMap() == this);
+
+ if (IsBattlegroundOrArena())
+ return;
+
SpawnObjectType type;
switch (obj->GetTypeId())
{
@@ -3591,7 +3595,7 @@ void Map::ApplyDynamicModeRespawnScaling(WorldObject const* obj, ObjectGuid::Low
}
SpawnData const* data = sObjectMgr->GetSpawnData(type, spawnId);
- if (!data || !(data->spawnGroupData->flags & SPAWNGROUP_FLAG_DYNAMIC_SPAWN_RATE))
+ if (!data || !data->spawnGroupData || !(data->spawnGroupData->flags & SPAWNGROUP_FLAG_DYNAMIC_SPAWN_RATE))
return;
auto it = _zonePlayerCountMap.find(obj->GetZoneId());