mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -33,7 +33,7 @@ Corpse::~Corpse()
|
||||
}
|
||||
|
||||
void Corpse::AddToWorld()
|
||||
{
|
||||
{
|
||||
///- Register the corpse for guid lookup
|
||||
if (!IsInWorld())
|
||||
sObjectAccessor->AddObject(this);
|
||||
@@ -42,7 +42,7 @@ void Corpse::AddToWorld()
|
||||
}
|
||||
|
||||
void Corpse::RemoveFromWorld()
|
||||
{
|
||||
{
|
||||
///- Remove the corpse from the accessor
|
||||
if (IsInWorld())
|
||||
sObjectAccessor->RemoveObject(this);
|
||||
@@ -51,14 +51,14 @@ void Corpse::RemoveFromWorld()
|
||||
}
|
||||
|
||||
bool Corpse::Create(uint32 guidlow, Map* map)
|
||||
{
|
||||
{
|
||||
SetMap(map);
|
||||
Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Corpse::Create(uint32 guidlow, Player* owner)
|
||||
{
|
||||
{
|
||||
ASSERT(owner);
|
||||
|
||||
Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
|
||||
@@ -66,7 +66,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
|
||||
if (!IsPositionValid())
|
||||
{
|
||||
sLog->outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||
guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY());
|
||||
guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
|
||||
}
|
||||
|
||||
void Corpse::SaveToDB()
|
||||
{
|
||||
{
|
||||
// prevent DB data inconsistence problems and duplicates
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
DeleteFromDB(trans);
|
||||
@@ -115,7 +115,7 @@ void Corpse::SaveToDB()
|
||||
}
|
||||
|
||||
void Corpse::DeleteFromDB(SQLTransaction& trans)
|
||||
{
|
||||
{
|
||||
PreparedStatement* stmt = nullptr;
|
||||
if (GetType() == CORPSE_BONES)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
|
||||
}
|
||||
|
||||
bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
||||
{
|
||||
{
|
||||
uint32 ownerGuid = fields[17].GetUInt32();
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
|
||||
@@ -169,7 +169,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
||||
if (!IsPositionValid())
|
||||
{
|
||||
sLog->outError("Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
|
||||
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
|
||||
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
||||
}
|
||||
|
||||
bool Corpse::IsExpired(time_t t) const
|
||||
{
|
||||
{
|
||||
if (m_type == CORPSE_BONES)
|
||||
return m_time < t - 60 * MINUTE;
|
||||
else
|
||||
|
||||
@@ -36,38 +36,38 @@ enum CorpseFlags
|
||||
|
||||
class Corpse : public WorldObject, public GridObject<Corpse>
|
||||
{
|
||||
public:
|
||||
explicit Corpse(CorpseType type = CORPSE_BONES);
|
||||
~Corpse();
|
||||
public:
|
||||
explicit Corpse(CorpseType type = CORPSE_BONES);
|
||||
~Corpse();
|
||||
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
bool Create(uint32 guidlow, Map* map);
|
||||
bool Create(uint32 guidlow, Player* owner);
|
||||
bool Create(uint32 guidlow, Map* map);
|
||||
bool Create(uint32 guidlow, Player* owner);
|
||||
|
||||
void SaveToDB();
|
||||
bool LoadCorpseFromDB(uint32 guid, Field* fields);
|
||||
void SaveToDB();
|
||||
bool LoadCorpseFromDB(uint32 guid, Field* fields);
|
||||
|
||||
void DeleteFromDB(SQLTransaction& trans);
|
||||
void DeleteFromDB(SQLTransaction& trans);
|
||||
|
||||
uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||
uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||
|
||||
time_t const& GetGhostTime() const { return m_time; }
|
||||
void ResetGhostTime() { m_time = time(nullptr); }
|
||||
CorpseType GetType() const { return m_type; }
|
||||
time_t const& GetGhostTime() const { return m_time; }
|
||||
void ResetGhostTime() { m_time = time(nullptr); }
|
||||
CorpseType GetType() const { return m_type; }
|
||||
|
||||
GridCoord const& GetGridCoord() const { return _gridCoord; }
|
||||
void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; }
|
||||
GridCoord const& GetGridCoord() const { return _gridCoord; }
|
||||
void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; }
|
||||
|
||||
Loot loot; // remove insignia ONLY at BG
|
||||
Player* lootRecipient;
|
||||
Loot loot; // remove insignia ONLY at BG
|
||||
Player* lootRecipient;
|
||||
|
||||
bool IsExpired(time_t t) const;
|
||||
bool IsExpired(time_t t) const;
|
||||
|
||||
private:
|
||||
CorpseType m_type;
|
||||
time_t m_time;
|
||||
GridCoord _gridCoord; // gride for corpse position for fast search
|
||||
private:
|
||||
CorpseType m_type;
|
||||
time_t m_time;
|
||||
GridCoord _gridCoord; // gride for corpse position for fast search
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user