From 2a84b5ae1a571ebc6e8b697028d0e0155fe88a50 Mon Sep 17 00:00:00 2001 From: r00ty-tc Date: Thu, 5 Oct 2017 00:39:43 +0100 Subject: 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) --- src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp | 1 + src/server/game/Maps/Map.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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()); -- cgit v1.2.3