diff options
author | megamage <none@none> | 2009-04-21 13:49:39 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-21 13:49:39 -0500 |
commit | 787cd7fcb51df492769bd3594efb26891a4dbcd5 (patch) | |
tree | e6b3aed195ca75b9c9c1730bf6d4654c26aeb46a | |
parent | b154137401d49b66d585463226e62b31b3be9d80 (diff) |
*More work on vehicle.
--HG--
branch : trunk
-rw-r--r-- | src/game/Object.h | 4 | ||||
-rw-r--r-- | src/game/Vehicle.cpp | 11 | ||||
-rw-r--r-- | src/game/Vehicle.h | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/game/Object.h b/src/game/Object.h index 455484eea2d..eff964aba0f 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -518,8 +518,8 @@ class TRINITY_DLL_SPEC WorldObject : public Object Map * GetMap() const { return m_map ? m_map : const_cast<WorldObject*>(this)->_getMap(); } Map * FindMap() const { return m_map ? m_map : const_cast<WorldObject*>(this)->_findMap(); } Map const* GetBaseMap() const; - TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); - Vehicle* SummonVehicle(uint32 entry, float x, float y, float z, float ang); + TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0,TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN,uint32 despwtime = 0); + Vehicle* SummonVehicle(uint32 entry, float x, float y, float z, float ang = 0); GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime); Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL); bool isActiveObject() const { return m_isActive; } diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index 48edcdd9340..2be74bd628b 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -157,6 +157,17 @@ Vehicle* Vehicle::HasEmptySeat(int8 seatNum) const return NULL; } +void Vehicle::InstallAccessory(uint32 entry, int8 seatNum) +{ + Creature *accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ()); + if(!accessory) + return; + + accessory->m_Vehicle = this; + accessory->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); + AddPassenger(accessory, seatNum); +} + bool Vehicle::AddPassenger(Unit *unit, int8 seatNum) { if(unit->m_Vehicle != this) diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h index 401efd32d61..0ca76687716 100644 --- a/src/game/Vehicle.h +++ b/src/game/Vehicle.h @@ -55,6 +55,7 @@ class Vehicle : public Creature Vehicle* HasEmptySeat(int8 seatNum) const; bool AddPassenger(Unit *passenger, int8 seatNum = -1); void RemovePassenger(Unit *passenger); + void InstallAccessory(uint32 entry, int8 seatNum); void Dismiss(); bool LoadFromDB(uint32 guid, Map *map); |