mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[9580] Add ObjectGuid const& Object::GetObjectGuid() and restore build.
This commit is contained in:
parent
2bf75e7a10
commit
ab7840a591
16 changed files with 32 additions and 32 deletions
|
|
@ -1264,7 +1264,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
|
|||
if(!item && !itemGuid.IsEmpty()) // cheating check 1
|
||||
return;
|
||||
|
||||
if(item && item->GetGUID() != itemGuid.GetRawValue())// cheating check 2
|
||||
if(item && item->GetObjectGuid() != itemGuid) // cheating check 2
|
||||
return;
|
||||
|
||||
eqSet.Items[i] = itemGuid.GetCounter();
|
||||
|
|
@ -1297,9 +1297,9 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
|||
recv_data >> itemGuid.ReadAsPacked();
|
||||
recv_data >> srcbag >> srcslot;
|
||||
|
||||
sLog.outDebug("Item " I64FMT ": srcbag %u, srcslot %u", itemGuid.GetRawValue(), srcbag, srcslot);
|
||||
sLog.outDebug("Item (%s): srcbag %u, srcslot %u", itemGuid.GetString().c_str(), srcbag, srcslot);
|
||||
|
||||
Item *item = _player->GetItemByGuid(itemGuid.GetRawValue());
|
||||
Item *item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
|
|||
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());
|
||||
|
||||
Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid.GetRawValue());
|
||||
Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid);
|
||||
|
||||
if(!pEnemy)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ Creature::~Creature()
|
|||
void Creature::AddToWorld()
|
||||
{
|
||||
///- Register the creature for guid lookup
|
||||
if(!IsInWorld() && GetGUIDHigh() == HIGHGUID_UNIT)
|
||||
if(!IsInWorld() && GetObjectGuid().GetHigh() == HIGHGUID_UNIT)
|
||||
GetMap()->GetObjectsStore().insert<Creature>(GetGUID(), (Creature*)this);
|
||||
|
||||
Unit::AddToWorld();
|
||||
|
|
@ -157,7 +157,7 @@ void Creature::AddToWorld()
|
|||
void Creature::RemoveFromWorld()
|
||||
{
|
||||
///- Remove the creature from the accessor
|
||||
if(IsInWorld() && GetGUIDHigh() == HIGHGUID_UNIT)
|
||||
if(IsInWorld() && GetObjectGuid().GetHigh() == HIGHGUID_UNIT)
|
||||
GetMap()->GetObjectsStore().erase<Creature>(GetGUID(), (Creature*)NULL);
|
||||
|
||||
Unit::RemoveFromWorld();
|
||||
|
|
|
|||
|
|
@ -746,7 +746,7 @@ void Guild::Roster(WorldSession *session /*= NULL*/)
|
|||
}
|
||||
else
|
||||
{
|
||||
data << uint64(ObjectGuid(HIGHGUID_PLAYER, itr->first).GetRawValue());
|
||||
data << ObjectGuid(HIGHGUID_PLAYER, itr->first);
|
||||
data << uint8(0);
|
||||
data << itr->second.Name;
|
||||
data << uint32(itr->second.RankId);
|
||||
|
|
|
|||
|
|
@ -2383,7 +2383,7 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
|||
sTicketMgr.Delete(guid);
|
||||
|
||||
//notify player
|
||||
if(Player* pl = sObjectMgr.GetPlayer(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)))
|
||||
if(Player* pl = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, guid)))
|
||||
{
|
||||
pl->GetSession()->SendGMTicketGetTicket(0x0A, 0);
|
||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, GetNameLink(pl).c_str());
|
||||
|
|
|
|||
|
|
@ -1548,7 +1548,7 @@ void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data )
|
|||
|
||||
recv_data >> guid.ReadAsPacked();
|
||||
|
||||
if(Player *player = sObjectMgr.GetPlayer(guid.GetRawValue()))
|
||||
if(Player *player = sObjectMgr.GetPlayer(guid))
|
||||
player->GetAchievementMgr().SendRespondInspectAchievements(_player);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
|
|||
|
||||
uint32 flags, time;
|
||||
recv_data >> flags >> time;
|
||||
DEBUG_LOG("Guid " UI64FMTD, guid.GetRawValue());
|
||||
DEBUG_LOG("Guid: %s", guid.GetString().c_str());
|
||||
DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);
|
||||
|
||||
Unit *mover = _player->m_mover;
|
||||
|
|
@ -187,7 +187,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
|
|||
if(!plMover || !plMover->IsBeingTeleportedNear())
|
||||
return;
|
||||
|
||||
if(guid.GetRawValue() != plMover->GetGUID())
|
||||
if(guid != plMover->GetObjectGuid())
|
||||
return;
|
||||
|
||||
plMover->SetSemaphoreTeleportNear(false);
|
||||
|
|
@ -373,7 +373,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
|||
recv_data >> newspeed;
|
||||
|
||||
// now can skip not our packet
|
||||
if(_player->GetGUID() != guid.GetRawValue())
|
||||
if(_player->GetObjectGuid() != guid)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
return;
|
||||
|
|
@ -455,7 +455,7 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
|
|||
recv_data >> old_mover_guid.ReadAsPacked();
|
||||
recv_data >> mi;
|
||||
|
||||
if(_player->m_mover->GetGUID() == old_mover_guid.GetRawValue())
|
||||
if(_player->m_mover->GetObjectGuid() == old_mover_guid)
|
||||
{
|
||||
sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " UI64FMTD, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid.GetRawValue());
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
case TYPEID_GAMEOBJECT:
|
||||
case TYPEID_DYNAMICOBJECT:
|
||||
case TYPEID_CORPSE:
|
||||
*data << uint32(GetGUIDHigh()); // GetGUIDHigh()
|
||||
*data << uint32(GetObjectGuid().GetHigh()); // GetGUIDHigh()
|
||||
break;
|
||||
case TYPEID_UNIT:
|
||||
*data << uint32(0x0000000B); // unk, can be 0xB or 0xC
|
||||
|
|
|
|||
|
|
@ -108,10 +108,10 @@ class MANGOS_DLL_SPEC Object
|
|||
m_inWorld = false;
|
||||
}
|
||||
|
||||
ObjectGuid const& GetObjectGuid() const { return *reinterpret_cast<ObjectGuid const*>(&GetUInt64Value(0)); }
|
||||
|
||||
const uint64& GetGUID() const { return GetUInt64Value(0); }
|
||||
uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
|
||||
uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); }
|
||||
uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); }
|
||||
PackedGuid const& GetPackGUID() const { return m_PackGUID; }
|
||||
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
||||
|
|
|
|||
|
|
@ -85,8 +85,6 @@ enum HighGuid
|
|||
#define GUID_HIPART(x) (uint32)((uint64(x) >> 48) & 0x0000FFFF)
|
||||
|
||||
// We have different low and middle part size for different guid types
|
||||
#define _GUID_ENPART_2(x) 0
|
||||
#define _GUID_ENPART_3(x) (uint32)((uint64(x) >> 24) & UI64LIT(0x0000000000FFFFFF))
|
||||
#define _GUID_LOPART_2(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF))
|
||||
#define _GUID_LOPART_3(x) (uint32)(uint64(x) & UI64LIT(0x0000000000FFFFFF))
|
||||
|
||||
|
|
@ -110,7 +108,6 @@ inline bool IsGuidHaveEnPart(uint64 const& guid)
|
|||
}
|
||||
}
|
||||
|
||||
#define GUID_ENPART(x) (IsGuidHaveEnPart(x) ? _GUID_ENPART_3(x) : _GUID_ENPART_2(x))
|
||||
#define GUID_LOPART(x) (IsGuidHaveEnPart(x) ? _GUID_LOPART_3(x) : _GUID_LOPART_2(x))
|
||||
|
||||
//*** Must be replaced by ObjectGuid use END ***
|
||||
|
|
@ -196,6 +193,8 @@ class ObjectGuid
|
|||
|
||||
TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
|
||||
|
||||
bool operator== (ObjectGuid const& guid) const { return GetRawValue() == guid.GetRawValue(); }
|
||||
bool operator!= (ObjectGuid const& guid) const { return GetRawValue() != guid.GetRawValue(); }
|
||||
bool operator< (ObjectGuid const& guid) const { return GetRawValue() < guid.GetRawValue(); }
|
||||
|
||||
public: // accessors - for debug
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ class ObjectMgr
|
|||
typedef std::vector<std::string> ScriptNameMap;
|
||||
|
||||
Player* GetPlayer(const char* name) const { return ObjectAccessor::FindPlayerByName(name);}
|
||||
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
|
||||
Player* GetPlayer(ObjectGuid guid) const { return ObjectAccessor::FindPlayer(guid); }
|
||||
|
||||
static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); }
|
||||
|
||||
|
|
|
|||
|
|
@ -8691,26 +8691,26 @@ Item* Player::GetItemByGuid(ObjectGuid guid) const
|
|||
{
|
||||
for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
|
||||
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
if (pItem->GetGUID() == guid.GetRawValue())
|
||||
if (pItem->GetObjectGuid() == guid)
|
||||
return pItem;
|
||||
|
||||
for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
||||
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
if (pItem->GetGUID() == guid.GetRawValue())
|
||||
if (pItem->GetObjectGuid() == guid)
|
||||
return pItem;
|
||||
|
||||
for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||
if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
|
||||
if (Item* pItem = pBag->GetItemByPos(j))
|
||||
if (pItem->GetGUID() == guid.GetRawValue())
|
||||
if (pItem->GetObjectGuid() == guid)
|
||||
return pItem;
|
||||
|
||||
for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
||||
if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
|
||||
if (Item* pItem = pBag->GetItemByPos(j))
|
||||
if (pItem->GetGUID() == guid.GetRawValue())
|
||||
if (pItem->GetObjectGuid() == guid)
|
||||
return pItem;
|
||||
|
||||
return NULL;
|
||||
|
|
@ -21685,13 +21685,13 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
|
|||
{
|
||||
case HIGHGUID_ITEM:
|
||||
if (typemask & TYPEMASK_ITEM)
|
||||
return GetItemByGuid(guid.GetRawValue());
|
||||
return GetItemByGuid(guid);
|
||||
break;
|
||||
case HIGHGUID_PLAYER:
|
||||
if (GetGUID()==guid.GetRawValue())
|
||||
if (GetObjectGuid()==guid)
|
||||
return this;
|
||||
if ((typemask & TYPEMASK_PLAYER) && IsInWorld())
|
||||
return ObjectAccessor::FindPlayer(guid.GetRawValue());
|
||||
return ObjectAccessor::FindPlayer(guid);
|
||||
break;
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
if ((typemask & TYPEMASK_GAMEOBJECT) && IsInWorld())
|
||||
|
|
|
|||
|
|
@ -183,9 +183,9 @@ void SpellCastTargets::setCorpseTarget(Corpse* corpse)
|
|||
|
||||
void SpellCastTargets::Update(Unit* caster)
|
||||
{
|
||||
m_GOTarget = !m_GOTargetGUID.IsEmpty() ? caster->GetMap()->GetGameObject(m_GOTargetGUID.GetRawValue()) : NULL;
|
||||
m_GOTarget = !m_GOTargetGUID.IsEmpty() ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL;
|
||||
m_unitTarget = !m_unitTargetGUID.IsEmpty() ?
|
||||
( m_unitTargetGUID.GetRawValue() == caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID.GetRawValue()) ) :
|
||||
( m_unitTargetGUID == caster->GetObjectGuid() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) :
|
||||
NULL;
|
||||
|
||||
m_itemTarget = NULL;
|
||||
|
|
@ -3636,7 +3636,7 @@ void Spell::TakeCastItem()
|
|||
{
|
||||
// This code is to avoid a crash
|
||||
// I'm not sure, if this is really an error, but I guess every item needs a prototype
|
||||
sLog.outError("Cast item has no item prototype highId=%d, lowId=%d",m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
|
||||
sLog.outError("Cast item (%s) has no item prototype", m_CastItem->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12783,7 +12783,7 @@ void Unit::ClearComboPointHolders()
|
|||
{
|
||||
uint32 lowguid = *m_ComboPointHolders.begin();
|
||||
|
||||
Player* plr = sObjectMgr.GetPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
|
||||
Player* plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, lowguid));
|
||||
if(plr && plr->GetComboTarget()==GetGUID()) // recheck for safe
|
||||
plr->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ struct ItemPrototype;
|
|||
struct AuctionEntry;
|
||||
struct DeclinedName;
|
||||
|
||||
class ObjectGuid;
|
||||
class Creature;
|
||||
class Item;
|
||||
class Object;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9579"
|
||||
#define REVISION_NR "9580"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue