mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[12106] Add a TransportInfo class to WorldObjects
Note: For the moment this coexists with other transports implementations
This commit is contained in:
parent
c00c314639
commit
068f352c53
4 changed files with 24 additions and 2 deletions
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12105"
|
||||
#define REVISION_NR "12106"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue