[12106] Add a TransportInfo class to WorldObjects

Note: For the moment this coexists with other transports implementations
This commit is contained in:
kid10 2012-08-21 02:22:21 +02:00 committed by Antz
parent c00c314639
commit 068f352c53
4 changed files with 24 additions and 2 deletions

View file

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

View file

@ -72,6 +72,7 @@ class Map;
class UpdateMask;
class InstanceData;
class TerrainInfo;
class TransportInfo;
typedef UNORDERED_MAP<Player*, UpdateData> 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

View file

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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12105"
#define REVISION_NR "12106"
#endif // __REVISION_NR_H__