diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 0effdb2ba..4ebe1d7c3 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -90,7 +90,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner) } SetObjectScale(DEFAULT_OBJECT_SCALE); - SetUInt64Value( CORPSE_FIELD_OWNER, owner->GetGUID() ); + SetGuidValue(CORPSE_FIELD_OWNER, owner->GetObjectGuid()); m_grid = MaNGOS::ComputeGridPair(GetPositionX(), GetPositionY()); @@ -109,7 +109,7 @@ void Corpse::SaveToDB() std::ostringstream ss; ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,map,time,corpse_type,instance,phaseMask) VALUES (" << GetGUIDLow() << ", " - << GUID_LOPART(GetOwnerGUID()) << ", " + << GetOwnerGuid().GetCounter() << ", " << GetPositionX() << ", " << GetPositionY() << ", " << GetPositionZ() << ", " @@ -143,7 +143,7 @@ void Corpse::DeleteFromDB() MANGOS_ASSERT(GetType() != CORPSE_BONES); // all corpses (not bones) - CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%u' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID())); + CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%u' AND corpse_type <> '0'", GetOwnerGuid().GetCounter()); } bool Corpse::LoadFromDB(uint32 lowguid, Field *fields) @@ -166,7 +166,7 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields) if(m_type >= MAX_CORPSE_TYPE) { - sLog.outError("Corpse (guidlow %d, owner %d) have wrong corpse type, not load.",GetGUIDLow(),GUID_LOPART(GetOwnerGUID())); + sLog.outError("%s Owner %s have wrong corpse type (%i), not load.", GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), m_type); return false; } @@ -240,8 +240,8 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields) if(!IsPositionValid()) { - sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", - GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), GetPositionX(), GetPositionY()); + sLog.outError("%s Owner %s not created. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), GetPositionX(), GetPositionY()); return false; } @@ -257,7 +257,7 @@ bool Corpse::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool Corpse::IsHostileTo( Unit const* unit ) const { - if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGUID())) + if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid())) return owner->IsHostileTo(unit); else return false; @@ -265,7 +265,7 @@ bool Corpse::IsHostileTo( Unit const* unit ) const bool Corpse::IsFriendlyTo( Unit const* unit ) const { - if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGUID())) + if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid())) return owner->IsFriendlyTo(unit); else return true; diff --git a/src/game/Corpse.h b/src/game/Corpse.h index 2b49d0e8d..aaf8f0bd7 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -65,7 +65,7 @@ class Corpse : public WorldObject void DeleteBonesFromWorld(); void DeleteFromDB(); - uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); } + ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(CORPSE_FIELD_OWNER); } time_t const& GetGhostTime() const { return m_time; } void ResetGhostTime() { m_time = time(NULL); } diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index b4c3c6937..ca2a77461 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -198,7 +198,7 @@ bool CannibalizeObjectCheck::operator()(Corpse* u) if(u->GetType()==CORPSE_BONES) return false; - Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID()); + Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGuid()); if( !owner || i_fobj->IsFriendlyTo(owner)) return false; diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 56176ae39..42284e191 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -124,8 +124,9 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid) { Guard guard(i_corpseGuard); - Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid.GetRawValue()); - if( iter == i_player2corpse.end() ) return NULL; + Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid); + if (iter == i_player2corpse.end()) + return NULL; MANGOS_ASSERT(iter->second->GetType() != CORPSE_BONES); @@ -138,7 +139,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse) MANGOS_ASSERT(corpse && corpse->GetType() != CORPSE_BONES); Guard guard(i_corpseGuard); - Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); + Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGuid()); if( iter == i_player2corpse.end() ) return; @@ -146,7 +147,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse) CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID())); + sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGuid().GetCounter()); corpse->RemoveFromWorld(); i_player2corpse.erase(iter); @@ -158,14 +159,14 @@ ObjectAccessor::AddCorpse(Corpse *corpse) MANGOS_ASSERT(corpse && corpse->GetType() != CORPSE_BONES); Guard guard(i_corpseGuard); - MANGOS_ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end()); - i_player2corpse[corpse->GetOwnerGUID()] = corpse; + MANGOS_ASSERT(i_player2corpse.find(corpse->GetOwnerGuid()) == i_player2corpse.end()); + i_player2corpse[corpse->GetOwnerGuid()] = corpse; // build mapid*cellid -> guid_set map CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - sObjectMgr.AddCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId()); + sObjectMgr.AddCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGuid().GetCounter(), corpse->GetInstanceId()); } void @@ -238,7 +239,7 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia) bones->SetPhaseMask(corpse->GetPhaseMask(), false); bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES); - bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0); + bones->SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid()); for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) { diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 5b9445fce..fe3c6c20f 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -95,7 +95,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton Player2CorpsesMapType; + typedef UNORDERED_MAP Player2CorpsesMapType; // global (obj used for map only location local guid objects (pets currently) static Unit* GetUnitInWorld(WorldObject const& obj, ObjectGuid guid); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index cd41e9172..273655f2f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2449,7 +2449,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& break; case TYPEID_CORPSE: m_targets.setCorpseTarget((Corpse*)result); - if (Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID())) + if (Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGuid())) targetUnitMap.push_back(owner); break; } @@ -2504,7 +2504,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID()); if(corpse) { - Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()); + Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGuid()); if(owner) targetUnitMap.push_back(owner); } @@ -2560,7 +2560,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& else if (m_targets.getCorpseTargetGUID()) { if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID())) - if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID())) + if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGuid())) targetUnitMap.push_back(owner); } break; @@ -6387,7 +6387,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff ) if(!corpse) return false; - if(target->GetGUID() != corpse->GetOwnerGUID()) + if(target->GetObjectGuid() != corpse->GetOwnerGuid()) return false; if(!corpse->IsWithinLOSInMap(m_caster)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0b6595bcd..e5262c87a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10811" + #define REVISION_NR "10812" #endif // __REVISION_NR_H__