diff options
author | megamage <none@none> | 2009-03-28 22:44:09 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-28 22:44:09 -0600 |
commit | 783e4fd3ff077b3023046f407a99552c109ef486 (patch) | |
tree | f7f3c5c33ed75603e077e43ae9c3e9f56b5be4c0 /src/game/ObjectGridLoader.cpp | |
parent | 3a485c658d9003aaaa4bd8e99dfebb9e7f0ec862 (diff) |
*Add new creature_template column VehicleId
*Allow spawn vehicles
*Make vehicles grid objects.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectGridLoader.cpp')
-rw-r--r-- | src/game/ObjectGridLoader.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 9078dd4268d..7c3c88756af 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -22,6 +22,7 @@ #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Creature.h" +#include "Vehicle.h" #include "GameObject.h" #include "DynamicObject.h" #include "Corpse.h" @@ -58,7 +59,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) Creature * c = iter->getSource(); - assert((!c->isPet() || !c->isVehicle()) && "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(); @@ -134,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()) |