*More work on vehicle.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-21 13:49:39 -05:00
parent b154137401
commit 787cd7fcb5
3 changed files with 14 additions and 2 deletions

View File

@@ -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; }

View File

@@ -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)

View File

@@ -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);