feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)

This commit is contained in:
UltraNix
2021-04-25 22:18:03 +02:00
committed by GitHub
parent 91081f4ad8
commit f4c226423d
568 changed files with 10655 additions and 11019 deletions

View File

@@ -32,7 +32,7 @@ MotionTransport::~MotionTransport()
UnloadStaticPassengers();
}
bool MotionTransport::CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
bool MotionTransport::CreateMoTrans(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
{
Relocate(x, y, z, ang);
@@ -43,7 +43,7 @@ bool MotionTransport::CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid,
return false;
}
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
Object::_Create(guidlow, 0, HighGuid::Mo_Transport);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
@@ -292,7 +292,7 @@ void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll)
{
passenger->SetTransport(nullptr);
passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
passenger->m_movementInfo.transport.guid = 0;
passenger->m_movementInfo.transport.guid.Clear();
passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
if (passenger->ToUnit())
{
@@ -302,7 +302,7 @@ void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll)
}
}
Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* data)
Creature* MotionTransport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data)
{
Map* map = GetMap();
Creature* creature = new Creature();
@@ -333,7 +333,8 @@ Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* d
if (!creature->IsPositionValid())
{
LOG_ERROR("server", "Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
LOG_ERROR("server", "Creature (%s) not created. Suggested coordinates aren't valid (X: %f Y: %f)",
creature->GetGUID().ToString().c_str(), creature->GetPositionX(), creature->GetPositionY());
delete creature;
return nullptr;
}
@@ -349,7 +350,7 @@ Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* d
return creature;
}
GameObject* MotionTransport::CreateGOPassenger(uint32 guid, GameObjectData const* data)
GameObject* MotionTransport::CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data)
{
Map* map = GetMap();
GameObject* go = new GameObject();
@@ -374,7 +375,8 @@ GameObject* MotionTransport::CreateGOPassenger(uint32 guid, GameObjectData const
if (!go->IsPositionValid())
{
LOG_ERROR("server", "GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY());
LOG_ERROR("server", "GameObject (%s) not created. Suggested coordinates aren't valid (X: %f Y: %f)",
go->GetGUID().ToString().c_str(), go->GetPositionX(), go->GetPositionY());
delete go;
return nullptr;
}
@@ -660,7 +662,7 @@ StaticTransport::~StaticTransport()
ASSERT(_passengers.empty());
}
bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit)
bool StaticTransport::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit)
{
ASSERT(map);
SetMap(map);
@@ -690,7 +692,7 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph
return false;
}
Object::_Create(guidlow, 0, HIGHGUID_TRANSPORT);
Object::_Create(guidlow, 0, HighGuid::Transport);
m_goInfo = goinfo;
@@ -970,7 +972,7 @@ void StaticTransport::RemovePassenger(WorldObject* passenger, bool withAll)
{
passenger->SetTransport(nullptr);
passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
passenger->m_movementInfo.transport.guid = 0;
passenger->m_movementInfo.transport.guid.Clear();
passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
}
}

View File

@@ -35,12 +35,12 @@ protected:
class MotionTransport : public Transport
{
friend MotionTransport* TransportMgr::CreateTransport(uint32, uint32, Map*);
friend MotionTransport* TransportMgr::CreateTransport(uint32, ObjectGuid::LowType, Map*);
MotionTransport();
public:
~MotionTransport() override;
bool CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress);
bool CreateMoTrans(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress);
void CleanupsBeforeDelete(bool finalCleanup = true) override;
void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&) override;
@@ -50,8 +50,8 @@ public:
void AddPassenger(WorldObject* passenger, bool withAll = false) override;
void RemovePassenger(WorldObject* passenger, bool withAll = false) override;
Creature* CreateNPCPassenger(uint32 guid, CreatureData const* data);
GameObject* CreateGOPassenger(uint32 guid, GameObjectData const* data);
Creature* CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data);
GameObject* CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data);
void LoadStaticPassengers();
PassengerSet const& GetStaticPassengers() const { return _staticPassengers; }
@@ -102,7 +102,7 @@ public:
StaticTransport();
~StaticTransport() override;
bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0) override;
bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0) override;
void CleanupsBeforeDelete(bool finalCleanup = true) override;
void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&) override;