From 5b78acc45efe8c2c81b1e312bac38fd1dc8f3143 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 10 Jan 2015 02:34:06 -0500 Subject: [PATCH] Make the AI stopping a little less silly on zone shutdown --- zone/entity.cpp | 7 +++++++ zone/entity.h | 2 ++ zone/zone.cpp | 10 +--------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index d5e5774ca..eaed09570 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4668,3 +4668,10 @@ Mob *EntityList::GetTargetForVirus(Mob *spreader, int range) return TargetsInRange[zone->random.Int(0, TargetsInRange.size() - 1)]; } +void EntityList::StopMobAI() +{ + for (auto &mob : mob_list) { + mob.second->AI_Stop(); + mob.second->AI_ShutDown(); + } +} diff --git a/zone/entity.h b/zone/entity.h index 88f5257f7..2b1678740 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -268,6 +268,8 @@ public: Entity *GetEntityMob(const char *name); Entity *GetEntityCorpse(const char *name); + void StopMobAI(); + void DescribeAggro(Client *towho, NPC *from_who, float dist, bool verbose); void Message(uint32 to_guilddbid, uint32 type, const char* message, ...); diff --git a/zone/zone.cpp b/zone/zone.cpp index fc134a735..3ee15be83 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -662,15 +662,7 @@ void Zone::Shutdown(bool quite) if (!ZoneLoaded) return; - std::list mob_list; - entity_list.GetMobList(mob_list); - std::list::iterator mob_itr = mob_list.begin(); - while (mob_itr != mob_list.end()) { - Mob* mob_inst = *mob_itr; - mob_inst->AI_Stop(); - mob_inst->AI_ShutDown(); - ++mob_itr; - } + entity_list.StopMobAI(); std::map::iterator itr; while(zone->npctable.size()) {