aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-05-16 22:16:21 +0200
committerShauren <shauren.trinity@gmail.com>2017-05-16 22:16:21 +0200
commita12a34b1dce93b17dcb2978937ac00288949ae13 (patch)
tree81dc0776fe697795169497ec213f3790459b6095
parentb421a5c0cbaf8acd8f1152c96ad7872cb8d7c9e3 (diff)
Core/Game: Include cleanup - removed G3D classes from packets
* Use our own Position class instead, with the coords written to packets being part of type
-rw-r--r--src/common/Collision/BoundingIntervalHierarchy.h6
-rw-r--r--src/common/Collision/BoundingIntervalHierarchyWrapper.h6
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp3
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp6
-rw-r--r--src/server/game/DataStores/M2Stores.cpp36
-rw-r--r--src/server/game/DataStores/M2Stores.h5
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.cpp4
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.h8
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp5
-rw-r--r--src/server/game/Entities/Object/Object.cpp10
-rw-r--r--src/server/game/Entities/Object/Position.cpp28
-rw-r--r--src/server/game/Entities/Object/Position.h79
-rw-r--r--src/server/game/Entities/Player/CinematicMgr.cpp12
-rw-r--r--src/server/game/Entities/Player/Player.cpp6
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp22
-rw-r--r--src/server/game/Entities/Unit/Unit.h4
-rw-r--r--src/server/game/Garrison/Garrison.cpp7
-rw-r--r--src/server/game/Garrison/GarrisonMap.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp7
-rw-r--r--src/server/game/Globals/ObjectMgr.h2
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp8
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/Handlers/PetHandler.cpp8
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp4
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp20
-rw-r--r--src/server/game/Maps/TransportMgr.cpp40
-rw-r--r--src/server/game/Maps/TransportMgr.h16
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp4
-rw-r--r--src/server/game/Server/Packets/AreaTriggerPackets.cpp2
-rw-r--r--src/server/game/Server/Packets/AreaTriggerPackets.h7
-rw-r--r--src/server/game/Server/Packets/BattlegroundPackets.h5
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.cpp6
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.h4
-rw-r--r--src/server/game/Server/Packets/GarrisonPackets.cpp4
-rw-r--r--src/server/game/Server/Packets/GarrisonPackets.h4
-rw-r--r--src/server/game/Server/Packets/MiscPackets.h9
-rw-r--r--src/server/game/Server/Packets/MovementPackets.cpp43
-rw-r--r--src/server/game/Server/Packets/MovementPackets.h27
-rw-r--r--src/server/game/Server/Packets/NPCPackets.cpp3
-rw-r--r--src/server/game/Server/Packets/NPCPackets.h4
-rw-r--r--src/server/game/Server/Packets/PacketUtilities.cpp26
-rw-r--r--src/server/game/Server/Packets/PacketUtilities.h12
-rw-r--r--src/server/game/Server/Packets/PetPackets.h2
-rw-r--r--src/server/game/Server/Packets/QueryPackets.cpp4
-rw-r--r--src/server/game/Server/Packets/QueryPackets.h5
-rw-r--r--src/server/game/Server/Packets/SpellPackets.h16
-rw-r--r--src/server/game/Server/Packets/TicketPackets.h4
-rw-r--r--src/server/game/Server/WorldSession.h3
-rw-r--r--src/server/game/Support/SupportMgr.cpp62
-rw-r--r--src/server/game/Support/SupportMgr.h12
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp2
-rw-r--r--src/tools/mmaps_generator/TerrainBuilder.h6
54 files changed, 288 insertions, 348 deletions
diff --git a/src/common/Collision/BoundingIntervalHierarchy.h b/src/common/Collision/BoundingIntervalHierarchy.h
index a80759f6cf7..0a2d2705b04 100644
--- a/src/common/Collision/BoundingIntervalHierarchy.h
+++ b/src/common/Collision/BoundingIntervalHierarchy.h
@@ -19,9 +19,9 @@
#ifndef _BIH_H
#define _BIH_H
-#include "G3D/Vector3.h"
-#include "G3D/Ray.h"
-#include "G3D/AABox.h"
+#include <G3D/Vector3.h>
+#include <G3D/Ray.h>
+#include <G3D/AABox.h>
#include "Define.h"
diff --git a/src/common/Collision/BoundingIntervalHierarchyWrapper.h b/src/common/Collision/BoundingIntervalHierarchyWrapper.h
index b7f78ea7baf..df46d79399d 100644
--- a/src/common/Collision/BoundingIntervalHierarchyWrapper.h
+++ b/src/common/Collision/BoundingIntervalHierarchyWrapper.h
@@ -19,10 +19,10 @@
#ifndef _BIH_WRAP
#define _BIH_WRAP
-#include "G3D/Table.h"
-#include "G3D/Array.h"
-#include "G3D/Set.h"
#include "BoundingIntervalHierarchy.h"
+#include <G3D/Table.h>
+#include <G3D/Array.h>
+#include <G3D/Set.h>
template<class T, class BoundsFunc = BoundsTrait<T> >
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 7a0eac02418..69b4b392735 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -123,8 +123,7 @@ void BattlegroundEY::GetPlayerPositionData(std::vector<WorldPackets::Battlegroun
{
WorldPackets::Battleground::BattlegroundPlayerPosition position;
position.Guid = player->GetGUID();
- position.Pos.x = player->GetPositionX();
- position.Pos.y = player->GetPositionY();
+ position.Pos = player->GetPosition();
position.IconID = player->GetTeam() == ALLIANCE ? PLAYER_POSITION_ICON_ALLIANCE_FLAG : PLAYER_POSITION_ICON_HORDE_FLAG;
position.ArenaSlot = PLAYER_POSITION_ARENA_SLOT_NONE;
positions->push_back(position);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 3e1438def65..bbf9fa5c077 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -197,8 +197,7 @@ void BattlegroundWS::GetPlayerPositionData(std::vector<WorldPackets::Battlegroun
{
WorldPackets::Battleground::BattlegroundPlayerPosition position;
position.Guid = player->GetGUID();
- position.Pos.x = player->GetPositionX();
- position.Pos.y = player->GetPositionY();
+ position.Pos = player->GetPosition();
position.IconID = PLAYER_POSITION_ICON_ALLIANCE_FLAG;
position.ArenaSlot = PLAYER_POSITION_ARENA_SLOT_NONE;
positions->push_back(position);
@@ -208,8 +207,7 @@ void BattlegroundWS::GetPlayerPositionData(std::vector<WorldPackets::Battlegroun
{
WorldPackets::Battleground::BattlegroundPlayerPosition position;
position.Guid = player->GetGUID();
- position.Pos.x = player->GetPositionX();
- position.Pos.y = player->GetPositionY();
+ position.Pos = player->GetPosition();
position.IconID = PLAYER_POSITION_ICON_HORDE_FLAG;
position.ArenaSlot = PLAYER_POSITION_ARENA_SLOT_NONE;
positions->push_back(position);
diff --git a/src/server/game/DataStores/M2Stores.cpp b/src/server/game/DataStores/M2Stores.cpp
index 9fb2f9fec2b..c431348ff7b 100644
--- a/src/server/game/DataStores/M2Stores.cpp
+++ b/src/server/game/DataStores/M2Stores.cpp
@@ -91,10 +91,7 @@ bool readCamera(M2Camera const* cam, uint32 buffSize, M2Header const* header, Ci
// Add to vector
FlyByCamera thisCam;
thisCam.timeStamp = targTimestamps[i];
- thisCam.locations.x = newPos.x;
- thisCam.locations.y = newPos.y;
- thisCam.locations.z = newPos.z;
- thisCam.locations.w = 0.0f;
+ thisCam.locations.Relocate(newPos.x, newPos.y, newPos.z, 0.0f);
targetcam.push_back(thisCam);
targPositions++;
currPos += sizeof(M2SplineKey<G3D::Vector3>);
@@ -128,9 +125,7 @@ bool readCamera(M2Camera const* cam, uint32 buffSize, M2Header const* header, Ci
// Add to vector
FlyByCamera thisCam;
thisCam.timeStamp = posTimestamps[i];
- thisCam.locations.x = newPos.x;
- thisCam.locations.y = newPos.y;
- thisCam.locations.z = newPos.z;
+ thisCam.locations.Relocate(newPos.x, newPos.y, newPos.z);
if (targetcam.size() > 0)
{
@@ -150,28 +145,25 @@ bool readCamera(M2Camera const* cam, uint32 buffSize, M2Header const* header, Ci
lastTarget = targetcam[j];
}
- float x = lastTarget.locations.x;
- float y = lastTarget.locations.y;
- float z = lastTarget.locations.z;
+ float x = lastTarget.locations.GetPositionX();
+ float y = lastTarget.locations.GetPositionY();
+ float z = lastTarget.locations.GetPositionZ();
// Now, the timestamps for target cam and position can be different. So, if they differ we interpolate
if (lastTarget.timeStamp != posTimestamps[i])
{
uint32 timeDiffTarget = nextTarget.timeStamp - lastTarget.timeStamp;
uint32 timeDiffThis = posTimestamps[i] - lastTarget.timeStamp;
- float xDiff = nextTarget.locations.x - lastTarget.locations.x;
- float yDiff = nextTarget.locations.y - lastTarget.locations.y;
- float zDiff = nextTarget.locations.z - lastTarget.locations.z;
- x = lastTarget.locations.x + (xDiff * (float(timeDiffThis) / float(timeDiffTarget)));
- y = lastTarget.locations.y + (yDiff * (float(timeDiffThis) / float(timeDiffTarget)));
- z = lastTarget.locations.z + (zDiff * (float(timeDiffThis) / float(timeDiffTarget)));
+ float xDiff = nextTarget.locations.GetPositionX() - lastTarget.locations.GetPositionX();
+ float yDiff = nextTarget.locations.GetPositionY() - lastTarget.locations.GetPositionY();
+ float zDiff = nextTarget.locations.GetPositionZ() - lastTarget.locations.GetPositionZ();
+ x = lastTarget.locations.GetPositionX() + (xDiff * (float(timeDiffThis) / float(timeDiffTarget)));
+ y = lastTarget.locations.GetPositionY() + (yDiff * (float(timeDiffThis) / float(timeDiffTarget)));
+ z = lastTarget.locations.GetPositionZ() + (zDiff * (float(timeDiffThis) / float(timeDiffTarget)));
}
- float xDiff = x - thisCam.locations.x;
- float yDiff = y - thisCam.locations.y;
- thisCam.locations.w = std::atan2(yDiff, xDiff);
-
- if (thisCam.locations.w < 0)
- thisCam.locations.w += 2 * float(M_PI);
+ float xDiff = x - thisCam.locations.GetPositionX();
+ float yDiff = y - thisCam.locations.GetPositionY();
+ thisCam.locations.SetOrientation(std::atan2(yDiff, xDiff));
}
cameras.push_back(thisCam);
diff --git a/src/server/game/DataStores/M2Stores.h b/src/server/game/DataStores/M2Stores.h
index 336269624a8..ab05aa9a29f 100644
--- a/src/server/game/DataStores/M2Stores.h
+++ b/src/server/game/DataStores/M2Stores.h
@@ -19,12 +19,13 @@
#define TRINITY_M2STORES_H
#include "Define.h"
-#include <G3D/Vector4.h>
+#include "Position.h"
+#include <vector>
struct FlyByCamera
{
uint32 timeStamp;
- G3D::Vector4 locations;
+ Position locations;
};
TC_GAME_API void LoadM2Cameras(std::string const& dataPath);
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
index 3ea350a583b..784a64a4a78 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
@@ -613,7 +613,9 @@ void AreaTrigger::InitSplines(std::vector<G3D::Vector3> const& splinePoints, uin
reshape.AreaTriggerSpline = boost::in_place();
reshape.AreaTriggerSpline->ElapsedTimeForMovement = GetElapsedTimeForMovement();
reshape.AreaTriggerSpline->TimeToTarget = timeToTarget;
- reshape.AreaTriggerSpline->Points = splinePoints;
+ for (G3D::Vector3 const& vec : splinePoints)
+ reshape.AreaTriggerSpline->Points.emplace_back(vec.x, vec.y, vec.z);
+
SendMessageToSet(reshape.Write(), true);
}
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h
index 77ee3eb9349..91d63520959 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h
@@ -68,8 +68,8 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge
Unit* GetCaster() const;
Unit* GetTarget() const;
- G3D::Vector3 const& GetRollPitchYaw() const { return _rollPitchYaw; }
- G3D::Vector3 const& GetTargetRollPitchYaw() const { return _targetRollPitchYaw; }
+ Position const& GetRollPitchYaw() const { return _rollPitchYaw; }
+ Position const& GetTargetRollPitchYaw() const { return _targetRollPitchYaw; }
void InitSplineOffsets(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget);
void InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget);
bool HasSplines() const { return !_spline.empty(); }
@@ -106,8 +106,8 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge
float _previousCheckOrientation;
bool _isRemoved;
- G3D::Vector3 _rollPitchYaw;
- G3D::Vector3 _targetRollPitchYaw;
+ Position _rollPitchYaw;
+ Position _targetRollPitchYaw;
std::vector<G3D::Vector2> _polygonVertices;
::Movement::Spline<int32> _spline;
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index cf9209699a9..dc749949fe9 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -393,7 +393,10 @@ void GameObject::Update(uint32 diff)
{
m_goValue.Transport.CurrentSeg = node->TimeSeg;
- G3D::Quat rotation = m_goValue.Transport.AnimationInfo->GetAnimRotation(timer);
+ G3D::Quat rotation;
+ if (TransportRotationEntry const* rot = m_goValue.Transport.AnimationInfo->GetAnimRotation(timer))
+ rotation = G3D::Quat(rot->X, rot->Y, rot->Z, rot->W);
+
G3D::Vector3 pos = rotation.toRotationMatrix()
* G3D::Matrix3::fromEulerAnglesZYX(GetOrientation(), 0.0f, 0.0f)
* G3D::Vector3(node->X, node->Y, node->Z);
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 333a6a3c5d0..c59ae332c9e 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -519,7 +519,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
*data << uint32(areaTrigger->GetTimeSinceCreated());
- *data << areaTrigger->GetRollPitchYaw();
+ *data << areaTrigger->GetRollPitchYaw().PositionXYZStream();
bool hasAbsoluteOrientation = areaTriggerTemplate->HasFlag(AREATRIGGER_FLAG_HAS_ABSOLUTE_ORIENTATION);
bool hasDynamicShape = areaTriggerTemplate->HasFlag(AREATRIGGER_FLAG_HAS_DYNAMIC_SHAPE);
@@ -578,11 +578,11 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
data->WriteBits(splinePoints.size(), 16);
for (G3D::Vector3 const& spline : splinePoints)
- *data << spline;
+ *data << spline.x << spline.y << spline.z;
}
if (hasTargetRollPitchYaw)
- *data << areaTrigger->GetTargetRollPitchYaw();
+ *data << areaTrigger->GetTargetRollPitchYaw().PositionXYZStream();
if (hasScaleCurveID)
*data << uint32(areaTriggerMiscTemplate->ScaleCurveId);
@@ -626,10 +626,10 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
*data << float(areaTriggerTemplate->PolygonDatas.HeightTarget);
for (G3D::Vector2 const& vertice : areaTriggerTemplate->PolygonVertices)
- *data << vertice;
+ *data << vertice.x << vertice.y;
for (G3D::Vector2 const& vertice : areaTriggerTemplate->PolygonVerticesTarget)
- *data << vertice;
+ *data << vertice.x << vertice.y;
}
if (hasAreaTriggerCylinder)
diff --git a/src/server/game/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp
index bbb6ee271cb..63120fff443 100644
--- a/src/server/game/Entities/Object/Position.cpp
+++ b/src/server/game/Entities/Object/Position.cpp
@@ -22,16 +22,6 @@
#include <G3D/g3dmath.h>
-Position::Position(G3D::Vector3 const& vect)
-{
- Relocate(vect.x, vect.y, vect.z, 0.f);
-}
-
-Position::operator G3D::Vector3() const
-{
- return { m_positionX, m_positionY, m_positionZ };
-}
-
bool Position::operator==(Position const &a)
{
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
@@ -175,14 +165,14 @@ std::string Position::ToString() const
return sstr.str();
}
-ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYStreamer const& streamer)
+ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XY> const& streamer)
{
buf << streamer.Pos->GetPositionX();
buf << streamer.Pos->GetPositionY();
return buf;
}
-ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYStreamer const& streamer)
+ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XY> const& streamer)
{
float x, y;
buf >> x >> y;
@@ -190,7 +180,7 @@ ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYStreamer const& stre
return buf;
}
-ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
+ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XYZ> const& streamer)
{
buf << streamer.Pos->GetPositionX();
buf << streamer.Pos->GetPositionY();
@@ -198,7 +188,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& str
return buf;
}
-ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
+ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XYZ> const& streamer)
{
float x, y, z;
buf >> x >> y >> z;
@@ -206,7 +196,7 @@ ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& str
return buf;
}
-ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
+ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XYZO> const& streamer)
{
buf << streamer.Pos->GetPositionX();
buf << streamer.Pos->GetPositionY();
@@ -215,10 +205,16 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
return buf;
}
-ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
+ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XYZO> const& streamer)
{
float x, y, z, o;
buf >> x >> y >> z >> o;
streamer.Pos->Relocate(x, y, z, o);
return buf;
}
+
+ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::PackedXYZ> const& streamer)
+{
+ buf.appendPackXYZ(streamer.Pos->GetPositionX(), streamer.Pos->GetPositionY(), streamer.Pos->GetPositionZ());
+ return buf;
+}
diff --git a/src/server/game/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h
index 74e1d7c6e42..381f970a014 100644
--- a/src/server/game/Entities/Object/Position.h
+++ b/src/server/game/Entities/Object/Position.h
@@ -19,9 +19,6 @@
#define Trinity_game_Position_h__
#include "Common.h"
-
-#include <G3D/Vector3.h>
-
#include <cmath>
class ByteBuffer;
@@ -33,25 +30,24 @@ struct TC_GAME_API Position
Position(Position const& loc) { Relocate(loc); }
- Position(G3D::Vector3 const& vect);
-
- operator G3D::Vector3() const;
+ // streamer tags
+ struct XY;
+ struct XYZ;
+ struct XYZO;
+ struct PackedXYZ;
- struct PositionXYStreamer
+ template<class Tag>
+ struct ConstStreamer
{
- explicit PositionXYStreamer(Position& pos) : Pos(&pos) { }
- Position* Pos;
+ explicit ConstStreamer(Position const& pos) : Pos(&pos) { }
+ Position const* Pos;
};
- struct PositionXYZStreamer
+ template<class Tag>
+ struct Streamer
{
- explicit PositionXYZStreamer(Position& pos) : Pos(&pos) { }
- Position* Pos;
- };
-
- struct PositionXYZOStreamer
- {
- explicit PositionXYZOStreamer(Position& pos) : Pos(&pos) { }
+ explicit Streamer(Position& pos) : Pos(&pos) { }
+ operator ConstStreamer<Tag>() { return ConstStreamer<Tag>(*Pos); }
Position* Pos;
};
@@ -95,11 +91,6 @@ public:
m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; SetOrientation(pos->m_orientation);
}
- void Relocate(G3D::Vector3 const& pos)
- {
- m_positionX = pos.x; m_positionY = pos.y; m_positionZ = pos.z;
- }
-
void RelocateOffset(Position const &offset);
void SetOrientation(float orientation)
@@ -129,9 +120,14 @@ public:
Position GetPosition() const { return *this; }
- Position::PositionXYStreamer PositionXYStream() { return PositionXYStreamer(*this); }
- Position::PositionXYZStreamer PositionXYZStream() { return PositionXYZStreamer(*this); }
- Position::PositionXYZOStreamer PositionXYZOStream() { return PositionXYZOStreamer(*this); }
+ Streamer<XY> PositionXYStream() { return Streamer<XY>(*this); }
+ ConstStreamer<XY> PositionXYStream() const { return ConstStreamer<XY>(*this); }
+ Streamer<XYZ> PositionXYZStream() { return Streamer<XYZ>(*this); }
+ ConstStreamer<XYZ> PositionXYZStream() const { return ConstStreamer<XYZ>(*this); }
+ Streamer<XYZO> PositionXYZOStream() { return Streamer<XYZO>(*this); }
+ ConstStreamer<XYZO> PositionXYZOStream() const { return ConstStreamer<XYZO>(*this); }
+ Streamer<PackedXYZ> PositionPackedXYZStream() { return Streamer<PackedXYZ>(*this); }
+ ConstStreamer<PackedXYZ> PositionPackedXYZStream() const { return ConstStreamer<PackedXYZ>(*this); }
bool IsPositionValid() const;
@@ -289,11 +285,32 @@ public:
uint32 m_mapId;
};
-TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYStreamer const& streamer);
-TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYStreamer const& streamer);
-TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer);
-TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer);
-TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
-TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
+TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XY> const& streamer);
+TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XY> const& streamer);
+TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XYZ> const& streamer);
+TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XYZ> const& streamer);
+TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XYZO> const& streamer);
+TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, Position::Streamer<Position::XYZO> const& streamer);
+TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::PackedXYZ> const& streamer);
+
+template<class Tag>
+struct TaggedPosition
+{
+ TaggedPosition(float x = 0.0f, float y = 0.0f, float z = 0.0f, float o = 0.0f) : Pos(x, y, z, o) { }
+ TaggedPosition(Position const& pos) : Pos(pos) { }
+
+ TaggedPosition& operator=(Position const& pos)
+ {
+ Pos.Relocate(pos);
+ return *this;
+ }
+
+ operator Position() const { return Pos; }
+
+ friend ByteBuffer& operator<<(ByteBuffer& buf, TaggedPosition const& tagged) { return buf << Position::ConstStreamer<Tag>(tagged.Pos); }
+ friend ByteBuffer& operator>>(ByteBuffer& buf, TaggedPosition& tagged) { return buf >> Position::Streamer<Tag>(tagged.Pos); }
+
+ Position Pos;
+};
#endif // Trinity_game_Position_h__
diff --git a/src/server/game/Entities/Player/CinematicMgr.cpp b/src/server/game/Entities/Player/CinematicMgr.cpp
index f3c1e231fa4..e3f0db3af8f 100644
--- a/src/server/game/Entities/Player/CinematicMgr.cpp
+++ b/src/server/game/Entities/Player/CinematicMgr.cpp
@@ -54,11 +54,11 @@ void CinematicMgr::BeginCinematic()
if (!m_cinematicCamera->empty())
{
FlyByCamera const& firstCamera = m_cinematicCamera->front();
- Position pos(firstCamera.locations.x, firstCamera.locations.y, firstCamera.locations.z, firstCamera.locations.w);
+ Position const& pos = firstCamera.locations;
if (!pos.IsPositionValid())
return;
- player->GetMap()->LoadGrid(firstCamera.locations.x, firstCamera.locations.y);
+ player->GetMap()->LoadGrid(pos.GetPositionX(), pos.GetPositionY());
m_CinematicObject = player->SummonCreature(VISUAL_WAYPOINT, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5 * MINUTE * IN_MILLISECONDS);
if (m_CinematicObject)
{
@@ -105,11 +105,11 @@ void CinematicMgr::UpdateCinematicLocation(uint32 /*diff*/)
{
if (cam.timeStamp > m_cinematicDiff)
{
- nextPosition = Position(cam.locations.x, cam.locations.y, cam.locations.z, cam.locations.w);
+ nextPosition.Relocate(cam.locations);
nextTimestamp = cam.timeStamp;
break;
}
- lastPosition = Position(cam.locations.x, cam.locations.y, cam.locations.z, cam.locations.w);
+ lastPosition.Relocate(cam.locations);
lastTimestamp = cam.timeStamp;
}
float angle = lastPosition.GetAngle(&nextPosition);
@@ -137,11 +137,11 @@ void CinematicMgr::UpdateCinematicLocation(uint32 /*diff*/)
{
if (static_cast<int32>(cam.timeStamp) >= workDiff)
{
- nextPosition = Position(cam.locations.x, cam.locations.y, cam.locations.z, cam.locations.w);
+ nextPosition.Relocate(cam.locations);
nextTimestamp = cam.timeStamp;
break;
}
- lastPosition = Position(cam.locations.x, cam.locations.y, cam.locations.z, cam.locations.w);
+ lastPosition.Relocate(cam.locations);
lastTimestamp = cam.timeStamp;
}
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1b41469c373..ef23b8b4495 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -4695,7 +4695,7 @@ void Player::RepopAtGraveyard()
{
WorldPackets::Misc::DeathReleaseLoc packet;
packet.MapID = ClosestGrave->MapID;
- packet.Loc = G3D::Vector3(ClosestGrave->Loc.X, ClosestGrave->Loc.Y, ClosestGrave->Loc.Z);
+ packet.Loc = Position(ClosestGrave->Loc.X, ClosestGrave->Loc.Y, ClosestGrave->Loc.Z);
GetSession()->SendPacket(packet.Write());
}
}
@@ -17242,9 +17242,7 @@ void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
void Player::SendBindPointUpdate() const
{
WorldPackets::Misc::BindPointUpdate packet;
- packet.BindPosition.x = m_homebindX;
- packet.BindPosition.y = m_homebindY;
- packet.BindPosition.z = m_homebindZ;
+ packet.BindPosition = Position(m_homebindX, m_homebindY, m_homebindZ);
packet.BindMapID = m_homebindMapId;
packet.BindAreaID = m_homebindAreaId;
SendDirectMessage(packet.Write());
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 2c09cf6f9e2..f7461a5355e 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -22,12 +22,14 @@
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "GameObjectAI.h"
+#include "Spline.h"
#include "Vehicle.h"
#include "Player.h"
#include "Cell.h"
#include "CellImpl.h"
#include "Totem.h"
#include "UpdateData.h"
+#include <G3D/Vector3.h>
Transport::Transport() : GameObject(),
_transportInfo(NULL), _isMoving(true), _pendingStop(false),
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 39c33b09c01..eb674b7fbf6 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12683,7 +12683,7 @@ void Unit::SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisua
WorldPackets::Spells::PlayOrphanSpellVisual playOrphanSpellVisual;
playOrphanSpellVisual.SourceLocation = GetPosition();
if (withSourceOrientation)
- playOrphanSpellVisual.SourceOrientation.z = GetOrientation();
+ playOrphanSpellVisual.SourceOrientation.Pos.SetOrientation(GetOrientation());
playOrphanSpellVisual.Target = target; // exclusive with TargetLocation
playOrphanSpellVisual.SpellVisualID = spellVisualId;
playOrphanSpellVisual.TravelSpeed = travelSpeed;
@@ -12692,12 +12692,12 @@ void Unit::SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisua
SendMessageToSet(playOrphanSpellVisual.Write(), true);
}
-void Unit::SendPlayOrphanSpellVisual(G3D::Vector3 const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime /*= false*/, bool withSourceOrientation /*= false*/)
+void Unit::SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime /*= false*/, bool withSourceOrientation /*= false*/)
{
WorldPackets::Spells::PlayOrphanSpellVisual playOrphanSpellVisual;
playOrphanSpellVisual.SourceLocation = GetPosition();
if (withSourceOrientation)
- playOrphanSpellVisual.SourceOrientation.z = GetOrientation();
+ playOrphanSpellVisual.SourceOrientation.Pos.SetOrientation(GetOrientation());
playOrphanSpellVisual.TargetLocation = targetLocation; // exclusive with Target
playOrphanSpellVisual.SpellVisualID = spellVisualId;
playOrphanSpellVisual.TravelSpeed = travelSpeed;
@@ -12727,7 +12727,7 @@ void Unit::SendPlaySpellVisual(ObjectGuid const& targetGuid, uint32 spellVisualI
SendMessageToSet(playSpellVisual.Write(), true);
}
-void Unit::SendPlaySpellVisual(G3D::Vector3 const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/)
+void Unit::SendPlaySpellVisual(Position const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/)
{
WorldPackets::Spells::PlaySpellVisual playSpellVisual;
playSpellVisual.Source = GetGUID();
@@ -12888,8 +12888,7 @@ void Unit::SendMoveKnockBack(Player* player, float speedXY, float speedZ, float
moveKnockBack.SequenceIndex = m_movementCounter++;
moveKnockBack.Speeds.HorzSpeed = speedXY;
moveKnockBack.Speeds.VertSpeed = speedZ;
- moveKnockBack.Direction.x = vcos;
- moveKnockBack.Direction.y = vsin;
+ moveKnockBack.Direction = Position(vcos, vsin);
player->GetSession()->SendPacket(moveKnockBack.Write());
}
@@ -13759,13 +13758,16 @@ void Unit::SendTeleportPacket(Position const& pos)
if (Player* playerMover = GetPlayerBeingMoved())
{
+ float x, y, z, o;
+ pos.GetPosition(x, y, z, o);
+ if (TransportBase* transportBase = GetDirectTransport())
+ transportBase->CalculatePassengerOffset(x, y, z, &o);
+
WorldPackets::Movement::MoveTeleport moveTeleport;
moveTeleport.MoverGUID = GetGUID();
- moveTeleport.Pos.Relocate(pos);
- if (TransportBase* transportBase = GetDirectTransport())
- transportBase->CalculatePassengerOffset(moveTeleport.Pos.m_positionX, moveTeleport.Pos.m_positionY, moveTeleport.Pos.m_positionZ);
+ moveTeleport.Pos = Position(x, y, z);
moveTeleport.TransportGUID = GetTransGUID();
- moveTeleport.Facing = pos.GetOrientation();
+ moveTeleport.Facing = o;
moveTeleport.SequenceIndex = m_movementCounter++;
playerMover->SendDirectMessage(moveTeleport.Write());
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 27538d85466..e05d2020a31 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1679,10 +1679,10 @@ class TC_GAME_API Unit : public WorldObject
void SendCancelOrphanSpellVisual(uint32 id);
void SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
- void SendPlayOrphanSpellVisual(G3D::Vector3 const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
+ void SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
void SendCancelSpellVisual(uint32 id);
void SendPlaySpellVisual(ObjectGuid const& target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
- void SendPlaySpellVisual(G3D::Vector3 const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
+ void SendPlaySpellVisual(Position const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
void SendCancelSpellVisualKit(uint32 id);
void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration);
diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp
index 318f2b8b207..f3a43abe3e0 100644
--- a/src/server/game/Garrison/Garrison.cpp
+++ b/src/server/game/Garrison/Garrison.cpp
@@ -265,7 +265,7 @@ void Garrison::InitializePlots()
Plot& plotInfo = _plots[garrPlotInstanceId];
plotInfo.PacketInfo.GarrPlotInstanceID = garrPlotInstanceId;
- plotInfo.PacketInfo.PlotPos.Relocate(gameObject->Position.X, gameObject->Position.Y, gameObject->Position.Z, 2 * std::acos(gameObject->RotationW));
+ plotInfo.PacketInfo.PlotPos = Position(gameObject->Position.X, gameObject->Position.Y, gameObject->Position.Z, 2 * std::acos(gameObject->RotationW));
plotInfo.PacketInfo.PlotType = plot->PlotType;
plotInfo.EmptyGameObjectId = gameObject->ID;
plotInfo.GarrSiteLevelPlotInstId = plots->at(i)->ID;
@@ -594,7 +594,7 @@ void Garrison::SendBuildingLandmarks(Player* receiver) const
Plot const& plot = p.second;
if (plot.BuildingInfo.PacketInfo)
if (uint32 garrBuildingPlotInstId = sGarrisonMgr.GetGarrBuildingPlotInst(plot.BuildingInfo.PacketInfo->GarrBuildingID, plot.GarrSiteLevelPlotInstId))
- buildingLandmarks.Landmarks.emplace_back(garrBuildingPlotInstId, plot.PacketInfo.PlotPos);
+ buildingLandmarks.Landmarks.emplace_back(garrBuildingPlotInstId, plot.PacketInfo.PlotPos.Pos);
}
receiver->SendDirectMessage(buildingLandmarks.Write());
@@ -726,9 +726,8 @@ GameObject* Garrison::Plot::CreateGameObject(Map* map, GarrisonFactionIndex fact
return nullptr;
}
- Position const& pos = PacketInfo.PlotPos;
GameObject* building = new GameObject();
- if (!building->Create(entry, map, 0, pos, G3D::Quat(), 255, GO_STATE_READY))
+ if (!building->Create(entry, map, 0, PacketInfo.PlotPos.Pos, G3D::Quat(), 255, GO_STATE_READY))
{
delete building;
return nullptr;
diff --git a/src/server/game/Garrison/GarrisonMap.cpp b/src/server/game/Garrison/GarrisonMap.cpp
index 2654bfd58ba..0c93d764ba7 100644
--- a/src/server/game/Garrison/GarrisonMap.cpp
+++ b/src/server/game/Garrison/GarrisonMap.cpp
@@ -76,7 +76,7 @@ void GarrisonGridLoader::Visit(GameObjectMapType& m)
CellCoord cellCoord = i_cell.GetCellCoord();
for (Garrison::Plot* plot : plots)
{
- Position const& spawn = plot->PacketInfo.PlotPos;
+ Position const& spawn = plot->PacketInfo.PlotPos.Pos;
if (cellCoord != Trinity::ComputeCellCoord(spawn.GetPositionX(), spawn.GetPositionY()))
continue;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 870b378cb66..77696912612 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -7518,16 +7518,15 @@ void ObjectMgr::LoadPointsOfInterest()
PointOfInterest pointOfInterest;
pointOfInterest.ID = id;
- pointOfInterest.Pos.x = fields[1].GetFloat();
- pointOfInterest.Pos.y = fields[2].GetFloat();
+ pointOfInterest.Pos.Relocate(fields[1].GetFloat(), fields[2].GetFloat());
pointOfInterest.Icon = fields[3].GetUInt32();
pointOfInterest.Flags = fields[4].GetUInt32();
pointOfInterest.Importance = fields[5].GetUInt32();
pointOfInterest.Name = fields[6].GetString();
- if (!Trinity::IsValidMapCoord(pointOfInterest.Pos.x, pointOfInterest.Pos.y))
+ if (!Trinity::IsValidMapCoord(pointOfInterest.Pos.GetPositionX(), pointOfInterest.Pos.GetPositionY()))
{
- TC_LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (PositionX: %f PositionY: %f), ignored.", id, pointOfInterest.Pos.x, pointOfInterest.Pos.y);
+ TC_LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (PositionX: %f PositionY: %f), ignored.", id, pointOfInterest.Pos.GetPositionX(), pointOfInterest.Pos.GetPositionY());
continue;
}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 17231f628a2..621e5647753 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -513,7 +513,7 @@ struct RepSpilloverTemplate
struct PointOfInterest
{
uint32 ID;
- G3D::Vector2 Pos;
+ Position Pos;
uint32 Icon;
uint32 Flags;
uint32 Importance;
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 0805da1eae3..e99e1dc2879 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -772,11 +772,13 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPackets::Misc::WorldTeleport&
return;
}
- TC_LOG_DEBUG("network", "CMSG_WORLD_TELEPORT: Player = %s, map = %u, x = %f, y = %f, z = %f, o = %f",
- GetPlayer()->GetName().c_str(), worldTeleport.MapID, worldTeleport.Pos.x, worldTeleport.Pos.y, worldTeleport.Pos.z, worldTeleport.Facing);
+ WorldLocation loc(worldTeleport.MapID, worldTeleport.Pos);
+ loc.SetOrientation(worldTeleport.Facing);
+ TC_LOG_DEBUG("network", "CMSG_WORLD_TELEPORT: Player = %s, map = %u, pos = %s",
+ GetPlayer()->GetName().c_str(), worldTeleport.MapID, loc.ToString().c_str());
if (HasPermission(rbac::RBAC_PERM_OPCODE_WORLD_TELEPORT))
- GetPlayer()->TeleportTo(worldTeleport.MapID, worldTeleport.Pos.x, worldTeleport.Pos.y, worldTeleport.Pos.z, worldTeleport.Facing);
+ GetPlayer()->TeleportTo(loc);
else
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
}
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index e06ef0f97a1..3ac094c3779 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -236,7 +236,7 @@ void WorldSession::HandleSuspendTokenResponse(WorldPackets::Movement::SuspendTok
WorldPackets::Movement::NewWorld packet;
packet.MapID = loc.GetMapId();
- packet.Pos.Relocate(loc);
+ packet.Pos = loc;
packet.Reason = !_player->IsBeingTeleportedSeamlessly() ? NEW_WORLD_NORMAL : NEW_WORLD_SEAMLESS;
SendPacket(packet.Write());
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 3e96198a658..1e32d27022b 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -98,7 +98,7 @@ void WorldSession::HandlePetAction(WorldPackets::Pet::PetAction& packet)
return;
if (GetPlayer()->m_Controlled.size() == 1)
- HandlePetActionHelper(pet, guid1, spellid, flag, guid2, packet.ActionPosition.x, packet.ActionPosition.y, packet.ActionPosition.z);
+ HandlePetActionHelper(pet, guid1, spellid, flag, guid2, packet.ActionPosition);
else
{
//If a pet is dismissed, m_Controlled will change
@@ -107,7 +107,7 @@ void WorldSession::HandlePetAction(WorldPackets::Pet::PetAction& packet)
if ((*itr)->GetEntry() == pet->GetEntry() && (*itr)->IsAlive())
controlled.push_back(*itr);
for (std::vector<Unit*>::iterator itr = controlled.begin(); itr != controlled.end(); ++itr)
- HandlePetActionHelper(*itr, guid1, spellid, flag, guid2, packet.ActionPosition.x, packet.ActionPosition.y, packet.ActionPosition.z);
+ HandlePetActionHelper(*itr, guid1, spellid, flag, guid2, packet.ActionPosition);
}
}
@@ -134,7 +134,7 @@ void WorldSession::HandlePetStopAttack(WorldPackets::Pet::PetStopAttack& packet)
pet->AttackStop();
}
-void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, float x, float y, float z)
+void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, Position const& pos)
{
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
@@ -259,7 +259,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
case COMMAND_MOVE_TO:
pet->StopMoving();
pet->GetMotionMaster()->Clear(false);
- pet->GetMotionMaster()->MovePoint(0, x, y, z);
+ pet->GetMotionMaster()->MovePoint(0, pos);
charmInfo->SetCommandState(COMMAND_MOVE_TO);
charmInfo->SetIsCommandAttack(false);
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 0a9d1c60380..2e1b52a4001 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -210,7 +210,7 @@ void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLoc
packet.Player = queryCorpseLocation.Player;
packet.MapID = corpseMapID;
packet.ActualMapID = mapID;
- packet.Position = G3D::Vector3(x, y, z);
+ packet.Position = Position(x, y, z);
packet.Transport = ObjectGuid::Empty;
SendPacket(packet.Write());
}
@@ -284,7 +284,7 @@ void WorldSession::HandleQueryCorpseTransport(WorldPackets::Query::QueryCorpseTr
Corpse* corpse = player->GetCorpse();
if (_player->IsInSameRaidWith(player) && corpse && !corpse->GetTransGUID().IsEmpty() && corpse->GetTransGUID() == queryCorpseTransport.Transport)
{
- response.Position = G3D::Vector3(corpse->GetTransOffsetX(), corpse->GetTransOffsetY(), corpse->GetTransOffsetZ());
+ response.Position = corpse->GetTransOffset();
response.Facing = corpse->GetTransOffsetO();
}
}
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 7d41bb7a018..a65b79daa40 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -594,25 +594,13 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPackets::Spells::UpdateMis
if (!spell || spell->m_spellInfo->Id != uint32(packet.SpellID) || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
return;
- Position pos = *spell->m_targets.GetSrcPos();
- pos.Relocate(packet.FirePos);
- spell->m_targets.ModSrc(pos);
-
- pos = *spell->m_targets.GetDstPos();
- pos.Relocate(packet.ImpactPos);
- spell->m_targets.ModDst(pos);
-
+ spell->m_targets.ModSrc(packet.FirePos);
+ spell->m_targets.ModDst(packet.ImpactPos);
spell->m_targets.SetPitch(packet.Pitch);
spell->m_targets.SetSpeed(packet.Speed);
- if (packet.Status.is_initialized())
- {
- GetPlayer()->ValidateMovementInfo(packet.Status.get_ptr());
- /*uint32 opcode;
- recvPacket >> opcode;
- recvPacket.SetOpcode(CMSG_MOVE_STOP); // always set to CMSG_MOVE_STOP in client SetOpcode
- //HandleMovementOpcodes(recvPacket);*/
- }
+ if (packet.Status)
+ HandleMovementOpcode(CMSG_MOVE_STOP, *packet.Status);
}
void WorldSession::HandleRequestCategoryCooldowns(WorldPackets::Spells::RequestCategoryCooldowns& /*requestCategoryCooldowns*/)
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index e00109a6ec6..21f03aa78ca 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -19,16 +19,10 @@
#include "Transport.h"
#include "InstanceScript.h"
#include "MapManager.h"
+#include "Spline.h"
TransportTemplate::~TransportTemplate()
{
- // Collect shared pointers into a set to avoid deleting the same memory more than once
- std::set<TransportSpline*> splines;
- for (size_t i = 0; i < keyFrames.size(); ++i)
- splines.insert(keyFrames[i].Spline);
-
- for (std::set<TransportSpline*>::iterator itr = splines.begin(); itr != splines.end(); ++itr)
- delete *itr;
}
TransportMgr::TransportMgr() { }
@@ -215,7 +209,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.size())
{
size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0;
- TransportSpline* spline = new TransportSpline();
+ std::shared_ptr<TransportSpline> spline = std::make_shared<TransportSpline>();
spline->init_spline(&splinePath[start], i - start + extra, Movement::SplineBase::ModeCatmullrom);
spline->initLengths();
for (size_t j = start; j < i + extra; ++j)
@@ -470,30 +464,18 @@ void TransportMgr::CreateInstanceTransports(Map* map)
TransportAnimationEntry const* TransportAnimation::GetAnimNode(uint32 time) const
{
- if (Path.empty())
- return NULL;
+ auto itr = Path.lower_bound(time);
+ if (itr != Path.end())
+ return itr->second;
- for (TransportPathContainer::const_reverse_iterator itr2 = Path.rbegin(); itr2 != Path.rend(); ++itr2)
- if (time >= itr2->first)
- return itr2->second;
-
- return Path.begin()->second;
+ return nullptr;
}
-G3D::Quat TransportAnimation::GetAnimRotation(uint32 time) const
+TransportRotationEntry const* TransportAnimation::GetAnimRotation(uint32 time) const
{
- if (Rotations.empty())
- return G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
-
- TransportRotationEntry const* rot = Rotations.begin()->second;
- for (TransportPathRotationContainer::const_reverse_iterator itr2 = Rotations.rbegin(); itr2 != Rotations.rend(); ++itr2)
- {
- if (time >= itr2->first)
- {
- rot = itr2->second;
- break;
- }
- }
+ auto itr = Rotations.lower_bound(time);
+ if (itr != Rotations.end())
+ return itr->second;
- return G3D::Quat(rot->X, rot->Y, rot->Z, rot->W);
+ return nullptr;
}
diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h
index 9ad327c424b..8b8d1d07d6a 100644
--- a/src/server/game/Maps/TransportMgr.h
+++ b/src/server/game/Maps/TransportMgr.h
@@ -18,10 +18,9 @@
#ifndef TRANSPORTMGR_H
#define TRANSPORTMGR_H
-#include <G3D/Quat.h>
-#include "Spline.h"
#include "DB2Stores.h"
#include "ObjectGuid.h"
+#include <memory>
struct KeyFrame;
struct GameObjectTemplate;
@@ -29,6 +28,11 @@ struct TransportTemplate;
class Transport;
class Map;
+namespace Movement
+{
+ template<typename length_type> class Spline;
+}
+
typedef Movement::Spline<double> TransportSpline;
typedef std::vector<KeyFrame> KeyFrameVec;
typedef std::unordered_map<uint32, TransportTemplate> TransportTemplates;
@@ -55,7 +59,7 @@ struct KeyFrame
bool Teleport;
uint32 ArriveTime;
uint32 DepartureTime;
- TransportSpline* Spline;
+ std::shared_ptr<TransportSpline> Spline;
// Data needed for next frame
float NextDistFromPrev;
@@ -91,7 +95,7 @@ struct TC_GAME_API TransportAnimation
uint32 TotalTime;
TransportAnimationEntry const* GetAnimNode(uint32 time) const;
- G3D::Quat GetAnimRotation(uint32 time) const;
+ TransportRotationEntry const* GetAnimRotation(uint32 time) const;
};
typedef std::map<uint32, TransportAnimation> TransportAnimationContainer;
@@ -136,8 +140,8 @@ class TC_GAME_API TransportMgr
private:
TransportMgr();
~TransportMgr();
- TransportMgr(TransportMgr const&);
- TransportMgr& operator=(TransportMgr const&);
+ TransportMgr(TransportMgr const&) = delete;
+ TransportMgr& operator=(TransportMgr const&) = delete;
// Generates and precaches a path for transport to avoid generation each time transport instance is created
void GeneratePath(GameObjectTemplate const* goInfo, TransportTemplate* transport);
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 280a5a9d972..1f36a292bbf 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -117,7 +117,7 @@ namespace Movement
WorldPackets::Movement::MonsterMove packet;
packet.MoverGUID = unit->GetGUID();
- packet.Pos = real_position;
+ packet.Pos = Position(real_position.x, real_position.y, real_position.z, real_position.orientation);
packet.InitializeSplineData(move_spline);
if (transport)
{
@@ -163,7 +163,7 @@ namespace Movement
WorldPackets::Movement::MonsterMove packet;
packet.MoverGUID = unit->GetGUID();
- packet.Pos = loc;
+ packet.Pos = Position(loc.x, loc.y, loc.z, loc.orientation);
packet.SplineData.StopDistanceTolerance = 2;
packet.SplineData.ID = move_spline.GetId();
diff --git a/src/server/game/Server/Packets/AreaTriggerPackets.cpp b/src/server/game/Server/Packets/AreaTriggerPackets.cpp
index 446a37534a9..cf459a1d30e 100644
--- a/src/server/game/Server/Packets/AreaTriggerPackets.cpp
+++ b/src/server/game/Server/Packets/AreaTriggerPackets.cpp
@@ -25,7 +25,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::AreaTrigger::AreaTriggerS
data.WriteBits(areaTriggerSpline.Points.size(), 16);
data.FlushBits();
- for (G3D::Vector3 const& point : areaTriggerSpline.Points)
+ for (TaggedPosition<Position::XYZ> const& point : areaTriggerSpline.Points)
data << point;
return data;
diff --git a/src/server/game/Server/Packets/AreaTriggerPackets.h b/src/server/game/Server/Packets/AreaTriggerPackets.h
index 379ec5cd0f8..129e4ba216d 100644
--- a/src/server/game/Server/Packets/AreaTriggerPackets.h
+++ b/src/server/game/Server/Packets/AreaTriggerPackets.h
@@ -19,10 +19,9 @@
#define AreaTriggerPackets_h__
#include "Packet.h"
-#include "PacketUtilities.h"
#include "ObjectGuid.h"
#include "Optional.h"
-#include <G3D/Vector3.h>
+#include "Position.h"
namespace WorldPackets
{
@@ -32,13 +31,13 @@ namespace WorldPackets
{
uint32 TimeToTarget = 0;
uint32 ElapsedTimeForMovement = 0;
- std::vector<G3D::Vector3> Points;
+ std::vector<TaggedPosition<Position::XYZ>> Points;
};
struct AreaTriggerUnkTypeInfo
{
Optional<ObjectGuid> AreaTriggerUnkGUID;
- Optional<G3D::Vector3> Center;
+ Optional<TaggedPosition<Position::XYZ>> Center;
bool UnkBit1 = false;
bool UnkBit2 = false;
uint32 UnkUInt1 = 0;
diff --git a/src/server/game/Server/Packets/BattlegroundPackets.h b/src/server/game/Server/Packets/BattlegroundPackets.h
index 6e52d872dc9..90dd5ccf529 100644
--- a/src/server/game/Server/Packets/BattlegroundPackets.h
+++ b/src/server/game/Server/Packets/BattlegroundPackets.h
@@ -21,10 +21,9 @@
#include "Common.h"
#include "ObjectGuid.h"
#include "LFGPackets.h"
-#include "PacketUtilities.h"
+#include "Position.h"
#include "Packet.h"
#include "Optional.h"
-#include <G3D/Vector3.h>
namespace WorldPackets
{
@@ -347,7 +346,7 @@ namespace WorldPackets
struct BattlegroundPlayerPosition
{
ObjectGuid Guid;
- G3D::Vector2 Pos;
+ TaggedPosition<Position::XY> Pos;
int8 IconID = 0;
int8 ArenaSlot = 0;
};
diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp
index 6a12c8a9f54..095f14c3783 100644
--- a/src/server/game/Server/Packets/CharacterPackets.cpp
+++ b/src/server/game/Server/Packets/CharacterPackets.cpp
@@ -49,9 +49,7 @@ WorldPackets::Character::EnumCharactersResult::CharacterInfo::CharacterInfo(Fiel
Level = fields[13].GetUInt8();
ZoneId = int32(fields[14].GetUInt16());
MapId = int32(fields[15].GetUInt16());
- PreLoadPosition.x = fields[16].GetFloat();
- PreLoadPosition.y = fields[17].GetFloat();
- PreLoadPosition.z = fields[18].GetFloat();
+ PreLoadPosition = Position(fields[16].GetFloat(), fields[17].GetFloat(), fields[18].GetFloat());
if (ObjectGuid::LowType guildId = fields[19].GetUInt64())
GuildGuid = ObjectGuid::Create<HighGuid::Guild>(guildId);
@@ -377,7 +375,7 @@ void WorldPackets::Character::PlayerLogin::Read()
WorldPacket const* WorldPackets::Character::LoginVerifyWorld::Write()
{
_worldPacket << int32(MapID);
- _worldPacket << Pos.PositionXYZOStream();
+ _worldPacket << Pos;
_worldPacket << uint32(Reason);
return &_worldPacket;
}
diff --git a/src/server/game/Server/Packets/CharacterPackets.h b/src/server/game/Server/Packets/CharacterPackets.h
index ecc0f545eb7..79f35e4b8ad 100644
--- a/src/server/game/Server/Packets/CharacterPackets.h
+++ b/src/server/game/Server/Packets/CharacterPackets.h
@@ -130,7 +130,7 @@ namespace WorldPackets
uint8 Level = 0;
int32 ZoneId = 0;
int32 MapId = 0;
- G3D::Vector3 PreLoadPosition;
+ TaggedPosition<Position::XYZ> PreLoadPosition;
ObjectGuid GuildGuid;
uint32 Flags = 0; ///< Character flag @see enum CharacterFlags
uint32 CustomizationFlag = 0; ///< Character customization flags @see enum CharacterCustomizeFlags
@@ -442,7 +442,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
int32 MapID = -1;
- Position Pos;
+ TaggedPosition<Position::XYZO> Pos;
uint32 Reason = 0;
};
diff --git a/src/server/game/Server/Packets/GarrisonPackets.cpp b/src/server/game/Server/Packets/GarrisonPackets.cpp
index b539439363e..aebee282ae5 100644
--- a/src/server/game/Server/Packets/GarrisonPackets.cpp
+++ b/src/server/game/Server/Packets/GarrisonPackets.cpp
@@ -37,7 +37,7 @@ WorldPacket const* WorldPackets::Garrison::GarrisonDeleteResult::Write()
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Garrison::GarrisonPlotInfo& plotInfo)
{
data << uint32(plotInfo.GarrPlotInstanceID);
- data << plotInfo.PlotPos.PositionXYZOStream();
+ data << plotInfo.PlotPos;
data << uint32(plotInfo.PlotType);
return data;
@@ -301,7 +301,7 @@ WorldPacket const* WorldPackets::Garrison::GarrisonRequestBlueprintAndSpecializa
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Garrison::GarrisonBuildingLandmark& landmark)
{
data << uint32(landmark.GarrBuildingPlotInstID);
- data << landmark.Pos.PositionXYZStream();
+ data << landmark.Pos;
return data;
}
diff --git a/src/server/game/Server/Packets/GarrisonPackets.h b/src/server/game/Server/Packets/GarrisonPackets.h
index 0b973cf1dbf..cf01534348c 100644
--- a/src/server/game/Server/Packets/GarrisonPackets.h
+++ b/src/server/game/Server/Packets/GarrisonPackets.h
@@ -62,7 +62,7 @@ namespace WorldPackets
struct GarrisonPlotInfo
{
uint32 GarrPlotInstanceID = 0;
- Position PlotPos;
+ TaggedPosition<Position::XYZO> PlotPos;
uint32 PlotType = 0;
};
@@ -295,7 +295,7 @@ namespace WorldPackets
GarrisonBuildingLandmark(uint32 buildingPlotInstId, Position const& pos) : GarrBuildingPlotInstID(buildingPlotInstId), Pos(pos) { }
uint32 GarrBuildingPlotInstID;
- Position Pos;
+ TaggedPosition<Position::XYZ> Pos;
};
class GarrisonBuildingLandmarks final : public ServerPacket
diff --git a/src/server/game/Server/Packets/MiscPackets.h b/src/server/game/Server/Packets/MiscPackets.h
index dc6040cb005..9617cc4b1e1 100644
--- a/src/server/game/Server/Packets/MiscPackets.h
+++ b/src/server/game/Server/Packets/MiscPackets.h
@@ -21,7 +21,6 @@
#include "Packet.h"
#include "ObjectGuid.h"
#include "WorldSession.h"
-#include "G3D/Vector3.h"
#include "Object.h"
#include "Unit.h"
#include "Player.h"
@@ -41,7 +40,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
uint32 BindMapID = MAPID_INVALID;
- G3D::Vector3 BindPosition;
+ TaggedPosition<Position::XYZ> BindPosition;
uint32 BindAreaID = 0;
};
@@ -307,7 +306,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
int32 MapID = 0;
- G3D::Vector3 Loc;
+ TaggedPosition<Position::XYZ> Loc;
};
class PortGraveyard final : public ClientPacket
@@ -589,7 +588,7 @@ namespace WorldPackets
ObjectGuid TargetObjectGUID;
ObjectGuid SourceObjectGUID;
int32 SoundKitID = 0;
- G3D::Vector3 Position;
+ TaggedPosition<Position::XYZ> Position;
};
class TC_GAME_API PlaySound final : public ServerPacket
@@ -771,7 +770,7 @@ namespace WorldPackets
uint32 MapID = 0;
ObjectGuid TransportGUID;
- G3D::Vector3 Pos;
+ TaggedPosition<Position::XYZ> Pos;
float Facing = 0.0f;
int32 LfgDungeonID = 0;
};
diff --git a/src/server/game/Server/Packets/MovementPackets.cpp b/src/server/game/Server/Packets/MovementPackets.cpp
index ffa5feedade..5320a74b0b8 100644
--- a/src/server/game/Server/Packets/MovementPackets.cpp
+++ b/src/server/game/Server/Packets/MovementPackets.cpp
@@ -22,7 +22,7 @@
#include "PacketUtilities.h"
#include "Unit.h"
-ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
+ByteBuffer& operator<<(ByteBuffer& data, MovementInfo const& movementInfo)
{
bool hasTransportData = !movementInfo.transport.guid.IsEmpty();
bool hasFallDirection = movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR);
@@ -254,10 +254,10 @@ ByteBuffer& WorldPackets::operator<<(ByteBuffer& data, Movement::MovementSpline
break;
}
- for (G3D::Vector3 const& pos : movementSpline.Points)
+ for (TaggedPosition<Position::XYZ> const& pos : movementSpline.Points)
+ data << pos;
+ for (TaggedPosition<Position::PackedXYZ> const& pos : movementSpline.PackedDeltas)
data << pos;
- for (G3D::Vector3 const& pos : movementSpline.PackedDeltas)
- data.appendPackXYZ(pos.x, pos.y, pos.z);
if (movementSpline.SpellEffectExtraData)
data << *movementSpline.SpellEffectExtraData;
@@ -281,10 +281,13 @@ void WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(::
{
data << uint32(moveSpline.GetId()); // ID
+ G3D::Vector3 dest;
if (!moveSpline.isCyclic()) // Destination
- data << moveSpline.FinalDestination().xyz();
+ dest = moveSpline.FinalDestination();
else
- data << G3D::Vector3::zero();
+ dest = G3D::Vector3::zero();
+
+ data << dest.x << dest.y << dest.z;
bool hasSplineMove = data.WriteBit(!moveSpline.Finalized() && !moveSpline.splineIsFacingOnly);
data.FlushBits();
@@ -321,8 +324,13 @@ void WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(::
switch (moveSpline.facing.type)
{
case ::Movement::MONSTER_MOVE_FACING_SPOT:
- data << moveSpline.facing.f; // FaceSpot
+ {
+ // FaceSpot
+ data << float(moveSpline.facing.f.x);
+ data << float(moveSpline.facing.f.y);
+ data << float(moveSpline.facing.f.z);
break;
+ }
case ::Movement::MONSTER_MOVE_FACING_TARGET:
data << moveSpline.facing.target; // FaceGUID
break;
@@ -362,7 +370,7 @@ void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveS
movementSpline.Face = moveSpline.facing.type;
movementSpline.FaceDirection = moveSpline.facing.angle;
movementSpline.FaceGUID = moveSpline.facing.target;
- movementSpline.FaceSpot = moveSpline.facing.f;
+ movementSpline.FaceSpot = Position(moveSpline.facing.f.x, moveSpline.facing.f.y, moveSpline.facing.f.z);
if (splineFlags.animation)
{
@@ -399,14 +407,14 @@ void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveS
{
uint32 count = spline.getPointCount() - 3;
for (uint32 i = 0; i < count; ++i)
- movementSpline.Points.push_back(array[i + 2]);
+ movementSpline.Points.emplace_back(array[i + 2].x, array[i + 2].y, array[i + 2].z);
}
else
{
uint32 count = spline.getPointCount() - 3;
- movementSpline.Points.push_back(array[1]);
+ movementSpline.Points.emplace_back(array[1].x, array[1].y, array[1].z);
for (uint32 i = 0; i < count; ++i)
- movementSpline.Points.push_back(array[i + 1]);
+ movementSpline.Points.emplace_back(array[i + 1].x, array[i + 1].y, array[i + 1].z);
}
}
else
@@ -414,7 +422,7 @@ void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveS
uint32 lastIdx = spline.getPointCount() - 3;
G3D::Vector3 const* realPath = &spline.getPoint(1);
- movementSpline.Points.push_back(realPath[lastIdx]);
+ movementSpline.Points.emplace_back(realPath[lastIdx].x, realPath[lastIdx].y, realPath[lastIdx].z);
if (lastIdx > 1)
{
@@ -422,7 +430,10 @@ void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveS
// first and last points already appended
for (uint32 i = 1; i < lastIdx; ++i)
- movementSpline.PackedDeltas.push_back(middle - realPath[i]);
+ {
+ G3D::Vector3 delta = middle - realPath[i];
+ movementSpline.PackedDeltas.emplace_back(delta.x, delta.y, delta.z);
+ }
}
}
}
@@ -509,9 +520,9 @@ WorldPacket const* WorldPackets::Movement::TransferAborted::Write()
WorldPacket const* WorldPackets::Movement::NewWorld::Write()
{
_worldPacket << int32(MapID);
- _worldPacket << Pos.PositionXYZOStream();
+ _worldPacket << Pos;
_worldPacket << uint32(Reason);
- _worldPacket << MovementOffset.PositionXYZStream();
+ _worldPacket << MovementOffset;
return &_worldPacket;
}
@@ -519,7 +530,7 @@ WorldPacket const* WorldPackets::Movement::MoveTeleport::Write()
{
_worldPacket << MoverGUID;
_worldPacket << uint32(SequenceIndex);
- _worldPacket << Pos.PositionXYZStream();
+ _worldPacket << Pos;
_worldPacket << float(Facing);
_worldPacket << uint8(PreloadWorld);
diff --git a/src/server/game/Server/Packets/MovementPackets.h b/src/server/game/Server/Packets/MovementPackets.h
index 243faeec7ad..5e4168a4270 100644
--- a/src/server/game/Server/Packets/MovementPackets.h
+++ b/src/server/game/Server/Packets/MovementPackets.h
@@ -21,7 +21,6 @@
#include "Packet.h"
#include "Object.h"
#include "Optional.h"
-#include <G3D/Vector3.h>
namespace Movement
{
@@ -86,23 +85,23 @@ namespace WorldPackets
uint32 MoveTime = 0;
float JumpGravity = 0.0f;
uint32 SpecialTime = 0;
- std::vector<G3D::Vector3> Points; // Spline path
+ std::vector<TaggedPosition<Position::XYZ>> Points; // Spline path
uint8 Mode = 0; // Spline mode - actually always 0 in this packet - Catmullrom mode appears only in SMSG_UPDATE_OBJECT. In this packet it is determined by flags
uint8 VehicleExitVoluntary = 0;
ObjectGuid TransportGUID;
int8 VehicleSeat = -1;
- std::vector<G3D::Vector3> PackedDeltas;
+ std::vector<TaggedPosition<Position::PackedXYZ>> PackedDeltas;
Optional<MonsterSplineFilter> SplineFilter;
Optional<MonsterSplineSpellEffectExtraData> SpellEffectExtraData;
float FaceDirection = 0.0f;
ObjectGuid FaceGUID;
- G3D::Vector3 FaceSpot;
+ TaggedPosition<Position::XYZ> FaceSpot;
};
struct MovementMonsterSpline
{
uint32 ID = 0;
- G3D::Vector3 Destination;
+ TaggedPosition<Position::XYZ> Destination;
bool CrzTeleport = false;
uint8 StopDistanceTolerance = 0; // Determines how far from spline destination the mover is allowed to stop in place 0, 0, 3.0, 2.76, numeric_limits<float>::max, 1.1, float(INT_MAX); default before this field existed was distance 3.0 (index 2)
MovementSpline Move;
@@ -125,7 +124,7 @@ namespace WorldPackets
MovementMonsterSpline SplineData;
ObjectGuid MoverGUID;
- G3D::Vector3 Pos;
+ TaggedPosition<Position::XYZ> Pos;
};
class MoveSplineSetSpeed : public ServerPacket
@@ -223,8 +222,8 @@ namespace WorldPackets
int32 MapID = 0;
uint32 Reason = 0;
- Position Pos;
- Position MovementOffset; // Adjusts all pending movement events by this offset
+ TaggedPosition<Position::XYZO> Pos;
+ TaggedPosition<Position::XYZ> MovementOffset; // Adjusts all pending movement events by this offset
};
class WorldPortResponse final : public ClientPacket
@@ -249,7 +248,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
- Position Pos;
+ TaggedPosition<Position::XYZ> Pos;
Optional<VehicleTeleport> Vehicle;
uint32 SequenceIndex = 0;
ObjectGuid MoverGUID;
@@ -261,8 +260,8 @@ namespace WorldPackets
struct MovementForce
{
ObjectGuid ID;
- G3D::Vector3 Origin;
- G3D::Vector3 Direction;
+ TaggedPosition<Position::XYZ> Origin;
+ TaggedPosition<Position::XYZ> Direction;
uint32 TransportID = 0;
float Magnitude = 0;
uint8 Type = 0;
@@ -383,7 +382,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid MoverGUID;
- G3D::Vector2 Direction;
+ TaggedPosition<Position::XY> Direction;
MoveKnockBackSpeeds Speeds;
uint32 SequenceIndex = 0;
};
@@ -566,7 +565,7 @@ namespace WorldPackets
struct KnockBackInfo
{
float HorzSpeed = 0.0f;
- G3D::Vector2 Direction;
+ TaggedPosition<Position::XY> Direction;
float InitVertSpeed = 0.0f;
};
@@ -600,7 +599,7 @@ namespace WorldPackets
}
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
-ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo);
+ByteBuffer& operator<<(ByteBuffer& data, MovementInfo const& movementInfo);
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo::TransportInfo& transportInfo);
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo);
diff --git a/src/server/game/Server/Packets/NPCPackets.cpp b/src/server/game/Server/Packets/NPCPackets.cpp
index cf1666ef79c..70c75aa5607 100644
--- a/src/server/game/Server/Packets/NPCPackets.cpp
+++ b/src/server/game/Server/Packets/NPCPackets.cpp
@@ -148,8 +148,7 @@ WorldPacket const* WorldPackets::NPC::GossipPOI::Write()
{
_worldPacket.WriteBits(Flags, 14);
_worldPacket.WriteBits(Name.length(), 6);
- _worldPacket << float(Pos.x);
- _worldPacket << float(Pos.y);
+ _worldPacket << Pos;
_worldPacket << int32(Icon);
_worldPacket << int32(Importance);
_worldPacket.WriteString(Name);
diff --git a/src/server/game/Server/Packets/NPCPackets.h b/src/server/game/Server/Packets/NPCPackets.h
index c4ed5c20c69..d063d33962d 100644
--- a/src/server/game/Server/Packets/NPCPackets.h
+++ b/src/server/game/Server/Packets/NPCPackets.h
@@ -22,8 +22,6 @@
#include "ItemPackets.h"
#include "Creature.h"
-#include "G3D/Vector2.h"
-
namespace WorldPackets
{
namespace NPC
@@ -180,7 +178,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
uint32 Flags = 0;
- G3D::Vector2 Pos;
+ TaggedPosition<Position::XY> Pos;
int32 Icon = 0;
int32 Importance = 0;
std::string Name;
diff --git a/src/server/game/Server/Packets/PacketUtilities.cpp b/src/server/game/Server/Packets/PacketUtilities.cpp
index a9560fac6c0..4d87feaabc5 100644
--- a/src/server/game/Server/Packets/PacketUtilities.cpp
+++ b/src/server/game/Server/Packets/PacketUtilities.cpp
@@ -17,35 +17,9 @@
#include "PacketUtilities.h"
#include "Errors.h"
-#include <G3D/Vector2.h>
-#include <G3D/Vector3.h>
#include <sstream>
#include <array>
-ByteBuffer& operator<<(ByteBuffer& data, G3D::Vector2 const& v)
-{
- data << v.x << v.y;
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, G3D::Vector3 const& v)
-{
- data << v.x << v.y << v.z;
- return data;
-}
-
-ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector2& v)
-{
- data >> v.x >> v.y;
- return data;
-}
-
-ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector3& v)
-{
- data >> v.x >> v.y >> v.z;
- return data;
-}
-
WorldPackets::PacketArrayMaxCapacityException::PacketArrayMaxCapacityException(std::size_t requestedSize, std::size_t sizeLimit)
{
std::ostringstream builder;
diff --git a/src/server/game/Server/Packets/PacketUtilities.h b/src/server/game/Server/Packets/PacketUtilities.h
index 4182c098eb1..a7e73465949 100644
--- a/src/server/game/Server/Packets/PacketUtilities.h
+++ b/src/server/game/Server/Packets/PacketUtilities.h
@@ -21,18 +21,6 @@
#include "ByteBuffer.h"
#include <boost/container/static_vector.hpp>
-namespace G3D
-{
- class Vector2;
- class Vector3;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, G3D::Vector2 const& v);
-ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector2& v);
-
-ByteBuffer& operator<<(ByteBuffer& data, G3D::Vector3 const& v);
-ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector3& v);
-
namespace WorldPackets
{
class PacketArrayMaxCapacityException : public ByteBufferException
diff --git a/src/server/game/Server/Packets/PetPackets.h b/src/server/game/Server/Packets/PetPackets.h
index 7ba4e54c069..6e5787f1a7f 100644
--- a/src/server/game/Server/Packets/PetPackets.h
+++ b/src/server/game/Server/Packets/PetPackets.h
@@ -200,7 +200,7 @@ namespace WorldPackets
ObjectGuid PetGUID;
uint32 Action = 0;
ObjectGuid TargetGUID;
- G3D::Vector3 ActionPosition;
+ TaggedPosition<Position::XYZ> ActionPosition;
};
class PetSetAction final : public ClientPacket
diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp
index 9fa813b005b..e57864f077b 100644
--- a/src/server/game/Server/Packets/QueryPackets.cpp
+++ b/src/server/game/Server/Packets/QueryPackets.cpp
@@ -308,9 +308,7 @@ WorldPacket const* WorldPackets::Query::CorpseLocation::Write()
_worldPacket << Player;
_worldPacket << ActualMapID;
- _worldPacket << Position.x;
- _worldPacket << Position.y;
- _worldPacket << Position.z;
+ _worldPacket << Position;
_worldPacket << MapID;
_worldPacket << Transport;
diff --git a/src/server/game/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h
index 63fb21875c7..cf34c758e4a 100644
--- a/src/server/game/Server/Packets/QueryPackets.h
+++ b/src/server/game/Server/Packets/QueryPackets.h
@@ -22,7 +22,6 @@
#include "AuthenticationPackets.h"
#include "Creature.h"
#include "NPCHandler.h"
-#include "G3D/Vector3.h"
#include "DB2Stores.h"
class Player;
@@ -233,7 +232,7 @@ namespace WorldPackets
ObjectGuid Player;
ObjectGuid Transport;
- G3D::Vector3 Position;
+ TaggedPosition<Position::XYZ> Position;
int32 ActualMapID = 0;
int32 MapID = 0;
bool Valid = false;
@@ -258,7 +257,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid Player;
- G3D::Vector3 Position;
+ TaggedPosition<Position::XYZ> Position;
float Facing = 0.0f;
};
diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h
index 32c05af10af..46dee3846ee 100644
--- a/src/server/game/Server/Packets/SpellPackets.h
+++ b/src/server/game/Server/Packets/SpellPackets.h
@@ -781,13 +781,13 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid Target; // Exclusive with TargetLocation
- G3D::Vector3 SourceLocation;
+ TaggedPosition<Position::XYZ> SourceLocation;
int32 SpellVisualID = 0;
bool SpeedAsTime = false;
float TravelSpeed = 0.0f;
float UnkZero = 0.0f; // Always zero
- G3D::Vector3 SourceOrientation; // Vector of rotations, Orientation is z
- G3D::Vector3 TargetLocation; // Exclusive with Target
+ TaggedPosition<Position::XYZ> SourceOrientation; // Vector of rotations, Orientation is z
+ TaggedPosition<Position::XYZ> TargetLocation; // Exclusive with Target
};
class PlaySpellVisual final : public ServerPacket
@@ -804,7 +804,7 @@ namespace WorldPackets
bool SpeedAsTime = false;
uint16 ReflectStatus = 0;
float TravelSpeed = 0.0f;
- G3D::Vector3 TargetPosition; // Exclusive with Target
+ TaggedPosition<Position::XYZ> TargetPosition; // Exclusive with Target
float Orientation = 0.0f;
};
@@ -991,7 +991,7 @@ namespace WorldPackets
ObjectGuid Target;
int32 SpellID = 0;
ObjectGuid CastID;
- G3D::Vector3 CollisionPos;
+ TaggedPosition<Position::XYZ> CollisionPos;
};
class NotifyMissileTrajectoryCollision final : public ServerPacket
@@ -1003,7 +1003,7 @@ namespace WorldPackets
ObjectGuid Caster;
ObjectGuid CastID;
- G3D::Vector3 CollisionPos;
+ TaggedPosition<Position::XYZ> CollisionPos;
};
class UpdateMissileTrajectory final : public ClientPacket
@@ -1018,8 +1018,8 @@ namespace WorldPackets
int32 SpellID = 0;
float Pitch = 0.0f;
float Speed = 0.0f;
- G3D::Vector3 FirePos;
- G3D::Vector3 ImpactPos;
+ TaggedPosition<Position::XYZ> FirePos;
+ TaggedPosition<Position::XYZ> ImpactPos;
Optional<MovementInfo> Status;
};
diff --git a/src/server/game/Server/Packets/TicketPackets.h b/src/server/game/Server/Packets/TicketPackets.h
index 4cce35a0b85..048e387c046 100644
--- a/src/server/game/Server/Packets/TicketPackets.h
+++ b/src/server/game/Server/Packets/TicketPackets.h
@@ -21,7 +21,7 @@
#include "Packet.h"
#include "LFGPackets.h"
#include "Optional.h"
-#include <G3D/Vector3.h>
+#include "Position.h"
namespace WorldPackets
{
@@ -30,7 +30,7 @@ namespace WorldPackets
struct SupportTicketHeader
{
int32 MapID = 0;
- G3D::Vector3 Position;
+ TaggedPosition<Position::XYZ> Position;
float Facing = 0.0f;
};
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 8974bf2a369..20999763fcb 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -55,6 +55,7 @@ struct AuctionEntry;
struct DeclinedName;
struct ItemTemplate;
struct MovementInfo;
+struct Position;
struct BlackMarketTemplate;
namespace lfg
@@ -1533,7 +1534,7 @@ class TC_GAME_API WorldSession
//Pet
void HandlePetAction(WorldPackets::Pet::PetAction& packet);
void HandlePetStopAttack(WorldPackets::Pet::PetStopAttack& packet);
- void HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, float x, float y, float z);
+ void HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, Position const& pos);
void HandleQueryPetName(WorldPackets::Query::QueryPetName& packet);
void HandlePetSetAction(WorldPackets::Pet::PetSetAction& packet);
void HandlePetAbandon(WorldPackets::Pet::PetAbandon& packet);
diff --git a/src/server/game/Support/SupportMgr.cpp b/src/server/game/Support/SupportMgr.cpp
index 7e883dce63e..cc358436bec 100644
--- a/src/server/game/Support/SupportMgr.cpp
+++ b/src/server/game/Support/SupportMgr.cpp
@@ -32,7 +32,7 @@ Ticket::~Ticket() { }
void Ticket::TeleportTo(Player* player) const
{
- player->TeleportTo(_mapId, _pos.x, _pos.y, _pos.z, 0.0f, 0);
+ player->TeleportTo(_mapId, _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), 0.0f, 0);
}
std::string Ticket::FormatViewMessageString(ChatHandler& handler, char const* closedName, char const* assignedToName, char const* unassignedName, char const* deletedName) const
@@ -51,9 +51,9 @@ std::string Ticket::FormatViewMessageString(ChatHandler& handler, char const* cl
return ss.str();
}
-BugTicket::BugTicket() : _facing(0.0f) { }
+BugTicket::BugTicket() { }
-BugTicket::BugTicket(Player* player) : Ticket(player), _facing(0.0f)
+BugTicket::BugTicket(Player* player) : Ticket(player)
{
_id = sSupportMgr->GenerateBugId();
}
@@ -68,10 +68,10 @@ void BugTicket::LoadFromDB(Field* fields)
_note = fields[++idx].GetString();
_createTime = fields[++idx].GetUInt32();
_mapId = fields[++idx].GetUInt16();
- _pos.x = fields[++idx].GetFloat();
- _pos.y = fields[++idx].GetFloat();
- _pos.z = fields[++idx].GetFloat();
- _facing = fields[++idx].GetFloat();
+ _pos.m_positionX = fields[++idx].GetFloat();
+ _pos.m_positionY = fields[++idx].GetFloat();
+ _pos.m_positionZ = fields[++idx].GetFloat();
+ _pos.SetOrientation(fields[++idx].GetFloat());
int64 closedBy = fields[++idx].GetInt64();
if (closedBy == 0)
@@ -98,10 +98,10 @@ void BugTicket::SaveToDB() const
stmt->setUInt64(++idx, _playerGuid.GetCounter());
stmt->setString(++idx, _note);
stmt->setUInt16(++idx, _mapId);
- stmt->setFloat(++idx, _pos.x);
- stmt->setFloat(++idx, _pos.y);
- stmt->setFloat(++idx, _pos.z);
- stmt->setFloat(++idx, _facing);
+ stmt->setFloat(++idx, _pos.GetPositionX());
+ stmt->setFloat(++idx, _pos.GetPositionY());
+ stmt->setFloat(++idx, _pos.GetPositionZ());
+ stmt->setFloat(++idx, _pos.GetOrientation());
stmt->setInt64(++idx, _closedBy.GetCounter());
stmt->setUInt64(++idx, _assignedTo.GetCounter());
stmt->setString(++idx, _comment);
@@ -137,9 +137,9 @@ std::string BugTicket::FormatViewMessageString(ChatHandler& handler, bool detail
return ss.str();
}
-ComplaintTicket::ComplaintTicket() : _facing(0.0f), _complaintType(GMTICKET_SUPPORT_COMPLAINT_TYPE_NONE) { }
+ComplaintTicket::ComplaintTicket() : _complaintType(GMTICKET_SUPPORT_COMPLAINT_TYPE_NONE) { }
-ComplaintTicket::ComplaintTicket(Player* player) : Ticket(player), _facing(0.0f), _complaintType(GMTICKET_SUPPORT_COMPLAINT_TYPE_NONE)
+ComplaintTicket::ComplaintTicket(Player* player) : Ticket(player), _complaintType(GMTICKET_SUPPORT_COMPLAINT_TYPE_NONE)
{
_id = sSupportMgr->GenerateComplaintId();
}
@@ -154,10 +154,10 @@ void ComplaintTicket::LoadFromDB(Field* fields)
_note = fields[++idx].GetString();
_createTime = fields[++idx].GetUInt32();
_mapId = fields[++idx].GetUInt16();
- _pos.x = fields[++idx].GetFloat();
- _pos.y = fields[++idx].GetFloat();
- _pos.z = fields[++idx].GetFloat();
- _facing = fields[++idx].GetFloat();
+ _pos.m_positionX = fields[++idx].GetFloat();
+ _pos.m_positionY = fields[++idx].GetFloat();
+ _pos.m_positionZ = fields[++idx].GetFloat();
+ _pos.SetOrientation(fields[++idx].GetFloat());
_targetCharacterGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
_complaintType = GMSupportComplaintType(fields[++idx].GetUInt8());
int32 reportLineIndex = fields[++idx].GetInt32();
@@ -196,10 +196,10 @@ void ComplaintTicket::SaveToDB() const
stmt->setUInt64(++idx, _playerGuid.GetCounter());
stmt->setString(++idx, _note);
stmt->setUInt16(++idx, _mapId);
- stmt->setFloat(++idx, _pos.x);
- stmt->setFloat(++idx, _pos.y);
- stmt->setFloat(++idx, _pos.z);
- stmt->setFloat(++idx, _facing);
+ stmt->setFloat(++idx, _pos.GetPositionX());
+ stmt->setFloat(++idx, _pos.GetPositionY());
+ stmt->setFloat(++idx, _pos.GetPositionZ());
+ stmt->setFloat(++idx, _pos.GetOrientation());
stmt->setUInt64(++idx, _targetCharacterGuid.GetCounter());
stmt->setUInt8(++idx, _complaintType);
if (_chatLog.ReportLineIndex)
@@ -260,9 +260,9 @@ std::string ComplaintTicket::FormatViewMessageString(ChatHandler& handler, bool
return ss.str();
}
-SuggestionTicket::SuggestionTicket() : _facing(0.0f) { }
+SuggestionTicket::SuggestionTicket() { }
-SuggestionTicket::SuggestionTicket(Player* player) : Ticket(player), _facing(0.0f)
+SuggestionTicket::SuggestionTicket(Player* player) : Ticket(player)
{
_id = sSupportMgr->GenerateSuggestionId();
}
@@ -277,10 +277,10 @@ void SuggestionTicket::LoadFromDB(Field* fields)
_note = fields[++idx].GetString();
_createTime = fields[++idx].GetUInt32();
_mapId = fields[++idx].GetUInt16();
- _pos.x = fields[++idx].GetFloat();
- _pos.y = fields[++idx].GetFloat();
- _pos.z = fields[++idx].GetFloat();
- _facing = fields[++idx].GetFloat();
+ _pos.m_positionX = fields[++idx].GetFloat();
+ _pos.m_positionY = fields[++idx].GetFloat();
+ _pos.m_positionZ = fields[++idx].GetFloat();
+ _pos.SetOrientation(fields[++idx].GetFloat());
int64 closedBy = fields[++idx].GetInt64();
if (closedBy == 0)
@@ -307,10 +307,10 @@ void SuggestionTicket::SaveToDB() const
stmt->setUInt64(++idx, _playerGuid.GetCounter());
stmt->setString(++idx, _note);
stmt->setUInt16(++idx, _mapId);
- stmt->setFloat(++idx, _pos.x);
- stmt->setFloat(++idx, _pos.y);
- stmt->setFloat(++idx, _pos.z);
- stmt->setFloat(++idx, _facing);
+ stmt->setFloat(++idx, _pos.GetPositionX());
+ stmt->setFloat(++idx, _pos.GetPositionY());
+ stmt->setFloat(++idx, _pos.GetPositionZ());
+ stmt->setFloat(++idx, _pos.GetOrientation());
stmt->setInt64(++idx, _closedBy.GetCounter());
stmt->setUInt64(++idx, _assignedTo.GetCounter());
stmt->setString(++idx, _comment);
diff --git a/src/server/game/Support/SupportMgr.h b/src/server/game/Support/SupportMgr.h
index 47a257da7d3..9c1f9b39fd4 100644
--- a/src/server/game/Support/SupportMgr.h
+++ b/src/server/game/Support/SupportMgr.h
@@ -90,11 +90,12 @@ public:
virtual void SetUnassigned() { _assignedTo.Clear(); }
void SetClosedBy(ObjectGuid value) { _closedBy = value; }
void SetComment(std::string const& comment) { _comment = comment; }
- void SetPosition(uint32 mapId, G3D::Vector3& pos)
+ void SetPosition(uint32 mapId, Position const& pos)
{
_mapId = mapId;
_pos = pos;
}
+ void SetFacing(float facing) { _pos.SetOrientation(facing); }
virtual void LoadFromDB(Field* fields) = 0;
virtual void SaveToDB() const = 0;
@@ -109,7 +110,7 @@ protected:
uint32 _id;
ObjectGuid _playerGuid;
uint16 _mapId;
- G3D::Vector3 _pos;
+ Position _pos;
uint64 _createTime;
ObjectGuid _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it.
ObjectGuid _assignedTo;
@@ -125,7 +126,6 @@ public:
std::string const& GetNote() const { return _note; }
- void SetFacing(float facing) { _facing = facing; }
void SetNote(std::string const& note) { _note = note; }
void LoadFromDB(Field* fields) override;
@@ -136,7 +136,6 @@ public:
std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const override;
private:
- float _facing;
std::string _note;
};
@@ -151,7 +150,6 @@ public:
GMSupportComplaintType GetComplaintType() const { return _complaintType; }
std::string const& GetNote() const { return _note; }
- void SetFacing(float facing) { _facing = facing; }
void SetTargetCharacterGuid(ObjectGuid targetCharacterGuid)
{
_targetCharacterGuid = targetCharacterGuid;
@@ -169,7 +167,6 @@ public:
std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const override;
private:
- float _facing;
ObjectGuid _targetCharacterGuid;
GMSupportComplaintType _complaintType;
ChatLog _chatLog;
@@ -186,8 +183,6 @@ public:
std::string const& GetNote() const { return _note; }
void SetNote(std::string const& note) { _note = note; }
- void SetFacing(float facing) { _facing = facing; }
-
void LoadFromDB(Field* fields) override;
void SaveToDB() const override;
void DeleteFromDB() override;
@@ -196,7 +191,6 @@ public:
std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const override;
private:
- float _facing;
std::string _note;
};
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index bfa60398261..be738602fe3 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -141,7 +141,7 @@ public:
uint32 count = 1;
for (FlyByCamera const& cam : *flyByCameras)
{
- handler->PSendSysMessage("%02u - %7ums [%f, %f, %f] Facing %f (%f degrees)", count, cam.timeStamp, cam.locations.x, cam.locations.y, cam.locations.z, cam.locations.w, cam.locations.w * (180 / M_PI));
+ handler->PSendSysMessage("%02u - %7ums [%s (%f degrees)]", count, cam.timeStamp, cam.locations.ToString().c_str(), cam.locations.GetOrientation() * (180 / M_PI));
count++;
}
handler->PSendSysMessage(SZFMTD " waypoints dumped", flyByCameras->size());
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 9cbf8e86187..af7e805c2a5 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -175,7 +175,7 @@ class spell_warr_charge_drop_fire_periodic : public SpellScriptLoader
{
int32 timeOffset = 6 * i * aurEff->GetPeriod() / 25;
Movement::Location loc = GetTarget()->movespline->ComputePosition(timeOffset);
- GetTarget()->SendPlaySpellVisual(loc, 0.f, SPELL_VISUAL_BLAZING_CHARGE, 0, 0, 1.f, true);
+ GetTarget()->SendPlaySpellVisual(Position(loc.x, loc.y, loc.z, loc.orientation), 0.f, SPELL_VISUAL_BLAZING_CHARGE, 0, 0, 1.f, true);
}
}
}
diff --git a/src/tools/mmaps_generator/TerrainBuilder.h b/src/tools/mmaps_generator/TerrainBuilder.h
index 80513037946..f918a56075e 100644
--- a/src/tools/mmaps_generator/TerrainBuilder.h
+++ b/src/tools/mmaps_generator/TerrainBuilder.h
@@ -22,9 +22,9 @@
#include "PathCommon.h"
#include "WorldModel.h"
-#include "G3D/Array.h"
-#include "G3D/Vector3.h"
-#include "G3D/Matrix3.h"
+#include <G3D/Array.h>
+#include <G3D/Vector3.h>
+#include <G3D/Matrix3.h>
namespace MMAP
{