diff --git a/src/game/Object.cpp b/src/game/Object.cpp index a0b4a329c..04c64a376 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1073,7 +1073,7 @@ void Object::MarkForClientUpdate() } WorldObject::WorldObject() - : m_isActiveObject(false), m_currMap(NULL), m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL) + : m_isActiveObject(false), m_currMap(NULL), m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_transportInfo(NULL) { } diff --git a/src/game/Object.h b/src/game/Object.h index 03bd8d9c7..079505300 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -72,6 +72,7 @@ class Map; class UpdateMask; class InstanceData; class TerrainInfo; +class TransportInfo; typedef UNORDERED_MAP UpdateDataMapType; @@ -440,6 +441,10 @@ class MANGOS_DLL_SPEC WorldObject : public Object void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask); + TransportInfo* GetTransportInfo() const { return m_transportInfo; } + bool IsBoarded() const { return m_transportInfo != NULL; } + void SetTransportInfo(TransportInfo* transportInfo) { m_transportInfo = transportInfo; } + void Relocate(float x, float y, float z, float orientation); void Relocate(float x, float y, float z); @@ -607,6 +612,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object std::string m_name; + TransportInfo* m_transportInfo; + private: Map* m_currMap; // current object's Map location diff --git a/src/game/movement/MoveSplineInit.cpp b/src/game/movement/MoveSplineInit.cpp index cdbb3e013..d84ca4648 100644 --- a/src/game/movement/MoveSplineInit.cpp +++ b/src/game/movement/MoveSplineInit.cpp @@ -20,6 +20,7 @@ #include "MoveSpline.h" #include "packet_builder.h" #include "../Unit.h" +#include "../TransportSystem.h" namespace Movement { @@ -53,8 +54,14 @@ namespace Movement int32 MoveSplineInit::Launch() { MoveSpline& move_spline = *unit.movespline; + TransportInfo* transportInfo = unit.GetTransportInfo(); Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation()); + + // If boarded use current local position + if (transportInfo) + transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation); + // there is a big chane that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals if (!move_spline.Finalized()) @@ -89,6 +96,14 @@ namespace Movement WorldPacket data(SMSG_MONSTER_MOVE, 64); data << unit.GetPackGUID(); + + if (transportInfo) + { + data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); + data << transportInfo->GetTransportGuid().WriteAsPacked(); + data << int8(transportInfo->GetTransportSeat()); + } + PacketBuilder::WriteMonsterMove(move_spline, data); unit.SendMessageToSet(&data, true); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ce288e37b..83f04dbd7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12105" + #define REVISION_NR "12106" #endif // __REVISION_NR_H__