diff options
Diffstat (limited to 'src/game/ObjectGridLoader.cpp')
-rw-r--r-- | src/game/ObjectGridLoader.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index b819182a50d..368edce0a53 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -22,11 +22,13 @@ #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Creature.h" +#include "Vehicle.h" #include "GameObject.h" #include "DynamicObject.h" #include "Corpse.h" #include "World.h" #include "CellImpl.h" +#include "CreatureAI.h" class TRINITY_DLL_DECL ObjectGridRespawnMover { @@ -57,7 +59,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) Creature * c = iter->getSource(); ++iter; - assert(!c->isPet() && "ObjectGridRespawnMover don't must be called for pets"); + assert(!c->isWorldCreature() && "ObjectGridRespawnMover don't must be called for pets"); Cell const& cur_cell = c->GetCurrentCell(); @@ -133,6 +135,36 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> & } } +void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, CreatureMapType &m, uint32 &count, Map* map) +{ + for(CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid) + { + Creature* obj = new Creature; + uint32 guid = *i_guid; + //sLog.outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading",table,guid); + if(!obj->LoadFromDB(guid, map)) + { + delete obj; + obj = new Vehicle; + if(!((Vehicle*)obj)->LoadFromDB(guid, map)) + { + delete (Vehicle*)obj; + continue; + } + } + + obj->GetGridRef().link(&m, obj); + + addUnitState(obj,cell); + obj->AddToWorld(); + if(obj->isActiveObject()) + map->AddToActive(obj); + + ++count; + + } +} + void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType &m, uint32 &count, Map* map) { if(cell_corpses.empty()) |