diff options
author | megamage <none@none> | 2009-04-17 15:08:58 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-17 15:08:58 -0500 |
commit | c7d78b5ff930b433c7f09471e825b79e6d9bee4f (patch) | |
tree | 127c9aed7e8ac65d379ac4bcdd18fc73049e3e37 /src/game/Object.cpp | |
parent | af935468df3af499bcae5018845ea6609f026a5b (diff) |
*Some work on vehicles.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index c22d00628b2..3c776b6fdfa 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -277,7 +277,10 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2) case TYPEID_UNIT: { flags2 = ((Unit*)this)->GetUnitMovementFlags(); - flags2 &= ~MOVEMENTFLAG_ONTRANSPORT; + if(((Unit*)this)->m_Vehicle) + flags2 |= MOVEMENTFLAG_ONTRANSPORT; + else + flags2 &= ~MOVEMENTFLAG_ONTRANSPORT; flags2 &= ~MOVEMENTFLAG_SPLINE2; } break; @@ -285,7 +288,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2) { flags2 = ((Player*)this)->GetUnitMovementFlags(); - if(((Player*)this)->GetTransport() || ((Player*)this)->hasUnitState(UNIT_STAT_ONVEHICLE)) + if(((Player*)this)->GetTransport() || ((Player*)this)->m_Vehicle) flags2 |= MOVEMENTFLAG_ONTRANSPORT; else flags2 &= ~MOVEMENTFLAG_ONTRANSPORT; @@ -333,20 +336,16 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2) // 0x00000200 if(flags2 & MOVEMENTFLAG_ONTRANSPORT) { - if(GetTypeId() == TYPEID_PLAYER) - { - if(((Player*)this)->hasUnitState(UNIT_STAT_ONVEHICLE)) - *data << (uint64)((Player*)this)->GetCharmGUID(); - else - *data << (uint64)((Player*)this)->GetTransport()->GetGUID(); - *data << (float)((Player*)this)->GetTransOffsetX(); - *data << (float)((Player*)this)->GetTransOffsetY(); - *data << (float)((Player*)this)->GetTransOffsetZ(); - *data << (float)((Player*)this)->GetTransOffsetO(); - *data << (uint32)((Player*)this)->GetTransTime(); - *data << (int8)((Player*)this)->GetTransSeat(); - } - //TrinIty currently not have support for other than player on transport + if(((Unit*)this)->m_Vehicle) + *data << (uint64)((Unit*)this)->m_Vehicle->GetGUID(); + else + *data << (uint64)((Player*)this)->GetTransport()->GetGUID(); + *data << (float)((Unit*)this)->GetTransOffsetX(); + *data << (float)((Unit*)this)->GetTransOffsetY(); + *data << (float)((Unit*)this)->GetTransOffsetZ(); + *data << (float)((Unit*)this)->GetTransOffsetO(); + *data << (uint32)((Unit*)this)->GetTransTime(); + *data << (int8)((Unit*)this)->GetTransSeat(); } // 0x02200000 @@ -559,7 +558,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2) // 0x80 if(flags & UPDATEFLAG_VEHICLE) // unused for now { - *data << uint32(((Vehicle*)this)->GetVehicleId()); // vehicle id + *data << uint32(((Vehicle*)this)->GetVehicleInfo()->m_ID); // vehicle id *data << float(0); // facing adjustment } } @@ -1612,15 +1611,16 @@ void WorldObject::BuildHeartBeatMsg(WorldPacket *data) const *data << m_positionY; *data << m_positionZ; *data << m_orientation; - if(GetTypeId() == TYPEID_PLAYER && ((Unit*)this)->hasUnitState(UNIT_STAT_ONVEHICLE)) + if(((Unit*)this)->m_Vehicle) { - *data << uint64(((Unit*)this)->GetCharmGUID()); - *data << float(((Player*)this)->GetTransOffsetX()); - *data << float(((Player*)this)->GetTransOffsetY()); - *data << float(((Player*)this)->GetTransOffsetZ()); - *data << float(((Player*)this)->GetTransOffsetO()); - *data << uint32(((Player*)this)->GetTransTime()); - *data << uint8(((Player*)this)->GetTransSeat()); + *data << uint64(((Unit*)this)->m_Vehicle->GetGUID()); + *data << float (((Unit*)this)->GetTransOffsetX()); + *data << float (((Unit*)this)->GetTransOffsetY()); + *data << float (((Unit*)this)->GetTransOffsetZ()); + *data << float (((Unit*)this)->GetTransOffsetO()); + *data << uint32(((Unit*)this)->GetTransTime()); + *data << uint8 (((Unit*)this)->GetTransSeat()); + sLog.outError("heart seat is %u", ((Unit*)this)->GetTransTime()); } *data << uint32(0); //fall time } @@ -1641,15 +1641,16 @@ void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float *data << y; *data << z; *data << ang; - if(GetTypeId() == TYPEID_PLAYER && ((Unit*)this)->hasUnitState(UNIT_STAT_ONVEHICLE)) - { - *data << uint64(((Unit*)this)->GetCharmGUID()); - *data << float(((Player*)this)->GetTransOffsetX()); - *data << float(((Player*)this)->GetTransOffsetY()); - *data << float(((Player*)this)->GetTransOffsetZ()); - *data << float(((Player*)this)->GetTransOffsetO()); - *data << uint32(((Player*)this)->GetTransTime()); - *data << uint8(((Player*)this)->GetTransSeat()); + if(((Unit*)this)->m_Vehicle) + { + *data << uint64(((Unit*)this)->m_Vehicle->GetGUID()); + *data << float (((Unit*)this)->GetTransOffsetX()); + *data << float (((Unit*)this)->GetTransOffsetY()); + *data << float (((Unit*)this)->GetTransOffsetZ()); + *data << float (((Unit*)this)->GetTransOffsetO()); + *data << uint32(((Unit*)this)->GetTransTime()); + *data << uint8 (((Unit*)this)->GetTransSeat()); + sLog.outError("seat is %u", ((Unit*)this)->GetTransTime()); } *data << uint32(0); } |