aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Object/MovementInfo.h35
-rw-r--r--src/server/game/Entities/Object/Position.h28
-rw-r--r--src/server/game/Entities/Player/Player.cpp6
-rw-r--r--src/server/game/Garrison/Garrison.cpp16
-rw-r--r--src/server/game/Groups/Group.h2
5 files changed, 42 insertions, 45 deletions
diff --git a/src/server/game/Entities/Object/MovementInfo.h b/src/server/game/Entities/Object/MovementInfo.h
index 2f753ee5257..65a044ecbe4 100644
--- a/src/server/game/Entities/Object/MovementInfo.h
+++ b/src/server/game/Entities/Object/MovementInfo.h
@@ -28,11 +28,11 @@ struct MovementInfo
{
// common
ObjectGuid guid;
- uint32 flags;
- uint32 flags2;
- uint32 flags3;
+ uint32 flags = 0;
+ uint32 flags2 = 0;
+ uint32 flags3 = 0;
Position pos;
- uint32 time;
+ uint32 time = 0;
// transport
struct TransportInfo
@@ -49,14 +49,14 @@ struct MovementInfo
ObjectGuid guid;
Position pos;
- int8 seat;
- uint32 time;
- uint32 prevTime;
- uint32 vehicleId;
+ int8 seat = -1;
+ uint32 time = 0;
+ uint32 prevTime = 0;
+ uint32 vehicleId = 0;
} transport;
// swimming/flying
- float pitch;
+ float pitch = 0.0f;
struct Inertia
{
@@ -78,13 +78,16 @@ struct MovementInfo
zspeed = sinAngle = cosAngle = xyspeed = 0.0f;
}
- uint32 fallTime;
+ uint32 fallTime = 0;
- float zspeed, sinAngle, cosAngle, xyspeed;
+ float zspeed = 0.0f;
+ float sinAngle = 0.0f;
+ float cosAngle = 0.0f;
+ float xyspeed = 0.0f;
} jump;
- float stepUpStartElevation;
+ float stepUpStartElevation = 0.0f;
// advflying
struct AdvFlying
@@ -97,14 +100,6 @@ struct MovementInfo
Optional<ObjectGuid> standingOnGameObjectGUID;
- MovementInfo() :
- flags(0), flags2(0), flags3(0), time(0), pitch(0.0f), stepUpStartElevation(0.0f)
- {
- pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
- transport.Reset();
- jump.Reset();
- }
-
uint32 GetMovementFlags() const { return flags; }
void SetMovementFlags(uint32 flag) { flags = flag; }
void AddMovementFlag(uint32 flag) { flags |= flag; }
diff --git a/src/server/game/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h
index ed4709dadf3..f2f1ddcde43 100644
--- a/src/server/game/Entities/Object/Position.h
+++ b/src/server/game/Entities/Object/Position.h
@@ -27,7 +27,16 @@ class ByteBuffer;
struct TC_GAME_API Position
{
- constexpr Position(float x = 0, float y = 0, float z = 0, float o = 0)
+ constexpr Position()
+ : m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f) { }
+
+ constexpr Position(float x, float y)
+ : m_positionX(x), m_positionY(y), m_positionZ(0.0f), m_orientation(0.0f) { }
+
+ constexpr Position(float x, float y, float z)
+ : m_positionX(x), m_positionY(y), m_positionZ(z), m_orientation(0.0f) { }
+
+ constexpr Position(float x, float y, float z, float o)
: m_positionX(x), m_positionY(y), m_positionZ(z), m_orientation(NormalizeOrientationConstexprWrapper(o)) { }
// streamer tags
@@ -181,16 +190,18 @@ private:
class TC_GAME_API WorldLocation : public Position
{
public:
- constexpr explicit WorldLocation(uint32 mapId = MAPID_INVALID, float x = 0.f, float y = 0.f, float z = 0.f, float o = 0.f)
- : Position(x, y, z, o), m_mapId(mapId) { }
+ constexpr WorldLocation() : m_mapId(MAPID_INVALID) { }
+
+ constexpr WorldLocation(uint32 mapId, float x, float y) : Position(x, y), m_mapId(mapId) { }
+ constexpr WorldLocation(uint32 mapId, float x, float y, float z) : Position(x, y, z), m_mapId(mapId) { }
+ constexpr WorldLocation(uint32 mapId, float x, float y, float z, float o) : Position(x, y, z, o), m_mapId(mapId) { }
- constexpr WorldLocation(uint32 mapId, Position const& position)
- : Position(position), m_mapId(mapId) { }
+ constexpr WorldLocation(uint32 mapId, Position const& position) : Position(position), m_mapId(mapId) { }
constexpr void WorldRelocate(WorldLocation const& loc) { m_mapId = loc.GetMapId(); Relocate(loc); }
constexpr void WorldRelocate(WorldLocation const* loc) { m_mapId = loc->GetMapId(); Relocate(loc); }
constexpr void WorldRelocate(uint32 mapId, Position const& pos) { m_mapId = mapId; Relocate(pos); }
- constexpr void WorldRelocate(uint32 mapId = MAPID_INVALID, float x = 0.f, float y = 0.f, float z = 0.f, float o = 0.f)
+ constexpr void WorldRelocate(uint32 mapId, float x, float y, float z, float o)
{
m_mapId = mapId;
Relocate(x, y, z, o);
@@ -219,7 +230,10 @@ TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Posi
template<class Tag>
struct TaggedPosition
{
- constexpr TaggedPosition(float x = 0.0f, float y = 0.0f, float z = 0.0f, float o = 0.0f) : Pos(x, y, z, o) { }
+ constexpr TaggedPosition() { }
+ constexpr TaggedPosition(float x, float y) : Pos(x, y) { }
+ constexpr TaggedPosition(float x, float y, float z) : Pos(x, y, z) { }
+ constexpr TaggedPosition(float x, float y, float z, float o) : Pos(x, y, z, o) { }
constexpr TaggedPosition(Position const& pos) : Pos(pos) { }
constexpr TaggedPosition& operator=(Position const& pos)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 3fa8b482fd6..bca4dc9b59e 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -4579,7 +4579,7 @@ Corpse* Player::CreateCorpse()
void Player::SpawnCorpseBones(bool triggerSave /*= true*/)
{
- _corpseLocation.WorldRelocate();
+ _corpseLocation.WorldRelocate(MAPID_INVALID, 0.0f, 0.0f, 0.0f, 0.0f);
if (GetMap()->ConvertCorpseToBones(GetGUID()))
if (triggerSave && !GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
SaveToDB(); // prevent loading as ghost without corpse
@@ -9137,7 +9137,7 @@ void Player::RemovedInsignia(Player* looterPlr)
RepopAtGraveyard();
}
- _corpseLocation.WorldRelocate();
+ _corpseLocation.WorldRelocate(MAPID_INVALID, 0.0f, 0.0f, 0.0f, 0.0f);
// We have to convert player corpse to bones, not to be able to resurrect there
// SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
@@ -23789,7 +23789,7 @@ void Player::SetBattlegroundEntryPoint()
if (GetMap()->IsDungeon())
{
if (WorldSafeLocsEntry const* entry = sObjectMgr->GetClosestGraveyard(*this, GetTeam(), this))
- m_bgData.joinPos.WorldRelocate(entry->Loc.GetMapId(), entry->Loc.GetPositionX(), entry->Loc.GetPositionY(), entry->Loc.GetPositionZ());
+ m_bgData.joinPos.WorldRelocate(entry->Loc.GetMapId(), entry->Loc.GetPositionX(), entry->Loc.GetPositionY(), entry->Loc.GetPositionZ(), 0.0f);
else
TC_LOG_ERROR("entities.player", "Player::SetBattlegroundEntryPoint: Dungeon (MapID: {}) has no linked graveyard, setting home location as entry point.", GetMapId());
}
diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp
index ae0bb48ccae..112f82d9738 100644
--- a/src/server/game/Garrison/Garrison.cpp
+++ b/src/server/game/Garrison/Garrison.cpp
@@ -287,27 +287,15 @@ void Garrison::Upgrade()
void Garrison::Enter() const
{
if (MapEntry const* map = sMapStore.LookupEntry(_siteLevel->MapID))
- {
if (int32(_owner->GetMapId()) == map->ParentMapID)
- {
- WorldLocation loc(_siteLevel->MapID);
- loc.Relocate(_owner);
- _owner->TeleportTo(loc, TELE_TO_SEAMLESS);
- }
- }
+ _owner->TeleportTo(WorldLocation(_siteLevel->MapID, *_owner), TELE_TO_SEAMLESS);
}
void Garrison::Leave() const
{
if (MapEntry const* map = sMapStore.LookupEntry(_siteLevel->MapID))
- {
if (_owner->GetMapId() == _siteLevel->MapID)
- {
- WorldLocation loc(map->ParentMapID);
- loc.Relocate(_owner);
- _owner->TeleportTo(loc, TELE_TO_SEAMLESS);
- }
- }
+ _owner->TeleportTo(WorldLocation(map->ParentMapID, *_owner), TELE_TO_SEAMLESS);
}
GarrisonFactionIndex Garrison::GetFaction() const
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 98f22523d2f..0f780f127dc 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -167,7 +167,7 @@ struct RaidMarker
RaidMarker(uint32 mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid = ObjectGuid::Empty)
{
- Location.WorldRelocate(mapId, positionX, positionY, positionZ);
+ Location.WorldRelocate(mapId, positionX, positionY, positionZ, 0.0f);
TransportGUID = transportGuid;
}
};