[12026] Replace std containers of ObjectGuids with some predefined types

Based on patch by stfx

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2012-07-03 18:46:53 +02:00
parent b607d6a3fd
commit 0e0a765312
27 changed files with 57 additions and 68 deletions

View file

@ -237,7 +237,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
ObjectGuid auctioneerGuid; ObjectGuid auctioneerGuid;
uint32 etime, bid, buyout, itemCount; uint32 etime, bid, buyout, itemCount;
std::vector<ObjectGuid> guids; GuidVector guids;
std::vector<uint32> stackSizes; std::vector<uint32> stackSizes;
recv_data >> auctioneerGuid; recv_data >> auctioneerGuid;

View file

@ -1473,7 +1473,7 @@ void BattleGround::OnObjectDBLoad(Creature* creature)
ObjectGuid BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2) ObjectGuid BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2)
{ {
BGCreatures::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin(); GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
if (itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end()) if (itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end())
return *itr; return *itr;
return ObjectGuid(); return ObjectGuid();
@ -1523,7 +1523,7 @@ void BattleGround::OpenDoorEvent(uint8 event1, uint8 event2 /*=0*/)
sLog.outError("BattleGround:OpenDoorEvent this event isn't active event1:%u event2:%u", event1, event2); sLog.outError("BattleGround:OpenDoorEvent this event isn't active event1:%u event2:%u", event1, event2);
return; return;
} }
BGObjects::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin(); GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
for(; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr) for(; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr)
DoorOpen(*itr); DoorOpen(*itr);
} }
@ -1545,10 +1545,10 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
else else
m_ActiveEvents[event1] = BG_EVENT_NONE; // no event active if event2 gets despawned m_ActiveEvents[event1] = BG_EVENT_NONE; // no event active if event2 gets despawned
BGCreatures::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin(); GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
for(; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr) for(; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
SpawnBGCreature(*itr, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); SpawnBGCreature(*itr, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
BGObjects::const_iterator itr2 = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin(); GuidVector::const_iterator itr2 = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
for(; itr2 != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr2) for(; itr2 != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr2)
SpawnBGObject(*itr2, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); SpawnBGObject(*itr2, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
} }

View file

@ -497,11 +497,8 @@ class BattleGround
void HandleTriggerBuff(ObjectGuid go_guid); void HandleTriggerBuff(ObjectGuid go_guid);
// TODO: make this protected:
typedef std::vector<ObjectGuid> BGObjects;
typedef std::vector<ObjectGuid> BGCreatures;
// TODO drop m_BGObjects // TODO drop m_BGObjects
BGObjects m_BgObjects; GuidVector m_BgObjects;
void SpawnBGObject(ObjectGuid guid, uint32 respawntime); void SpawnBGObject(ObjectGuid guid, uint32 respawntime);
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
void SpawnBGCreature(ObjectGuid guid, uint32 respawntime); void SpawnBGCreature(ObjectGuid guid, uint32 respawntime);
@ -523,8 +520,8 @@ class BattleGround
struct EventObjects struct EventObjects
{ {
BGObjects gameobjects; GuidVector gameobjects;
BGCreatures creatures; GuidVector creatures;
}; };
// cause we create it dynamicly i use a map - to avoid resizing when // cause we create it dynamicly i use a map - to avoid resizing when

View file

@ -317,8 +317,7 @@ class BattleGroundEY : public BattleGround
Team m_PointOwnedByTeam[BG_EY_NODES_MAX]; Team m_PointOwnedByTeam[BG_EY_NODES_MAX];
uint8 m_PointState[BG_EY_NODES_MAX]; uint8 m_PointState[BG_EY_NODES_MAX];
int32 m_PointBarStatus[BG_EY_NODES_MAX]; int32 m_PointBarStatus[BG_EY_NODES_MAX];
typedef std::vector<ObjectGuid> PlayersNearPointType; GuidVector m_PlayersNearPoint[BG_EY_NODES_MAX_WITH_SPEIAL];
PlayersNearPointType m_PlayersNearPoint[BG_EY_NODES_MAX_WITH_SPEIAL];
uint8 m_CurrentPointPlayersCount[2*BG_EY_NODES_MAX]; uint8 m_CurrentPointPlayersCount[2*BG_EY_NODES_MAX];
int32 m_PointAddingTimer; int32 m_PointAddingTimer;

View file

@ -278,7 +278,6 @@ class Channel
typedef std::map<ObjectGuid, PlayerInfo> PlayerList; typedef std::map<ObjectGuid, PlayerInfo> PlayerList;
PlayerList m_players; PlayerList m_players;
typedef std::set<ObjectGuid> BannedList; GuidSet m_banned;
BannedList m_banned;
}; };
#endif #endif

View file

@ -2449,7 +2449,7 @@ void Creature::ApplyGameEventSpells(GameEventCreatureData const* eventData, bool
CastSpell(this, cast_spell, true); CastSpell(this, cast_spell, true);
} }
void Creature::FillGuidsListFromThreatList( std::vector<ObjectGuid>& guids, uint32 maxamount /*= 0*/ ) void Creature::FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount /*= 0*/)
{ {
if (!CanHaveThreatList()) if (!CanHaveThreatList())
return; return;

View file

@ -500,7 +500,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
bool CanTrainAndResetTalentsOf(Player* pPlayer) const; bool CanTrainAndResetTalentsOf(Player* pPlayer) const;
bool IsOutOfThreatArea(Unit* pVictim) const; bool IsOutOfThreatArea(Unit* pVictim) const;
void FillGuidsListFromThreatList(std::vector<ObjectGuid>& guids, uint32 maxamount = 0); void FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount = 0);
bool IsImmuneToSpell(SpellEntry const* spellInfo); bool IsImmuneToSpell(SpellEntry const* spellInfo);
// redefine Unit::IsImmuneToSpell // redefine Unit::IsImmuneToSpell
@ -768,7 +768,7 @@ class AssistDelayEvent : public BasicEvent
AssistDelayEvent(); AssistDelayEvent();
ObjectGuid m_victimGuid; ObjectGuid m_victimGuid;
std::vector<ObjectGuid> m_assistantGuids; GuidVector m_assistantGuids;
Unit& m_owner; Unit& m_owner;
}; };

View file

@ -160,7 +160,6 @@ class CreatureLinkingHolder
bool TryFollowMaster(Creature* pCreature); bool TryFollowMaster(Creature* pCreature);
private: private:
typedef std::list<ObjectGuid> GuidList;
// Structure associated to a master (entry case) // Structure associated to a master (entry case)
struct InfoAndGuids struct InfoAndGuids
{ {

View file

@ -155,7 +155,7 @@ void DynamicObject::Delete()
void DynamicObject::Delay(int32 delaytime) void DynamicObject::Delay(int32 delaytime)
{ {
m_aliveDuration -= delaytime; m_aliveDuration -= delaytime;
for(AffectedSet::iterator iter = m_affected.begin(); iter != m_affected.end(); ) for (GuidSet::iterator iter = m_affected.begin(); iter != m_affected.end(); )
{ {
Unit *target = GetMap()->GetUnit((*iter)); Unit *target = GetMap()->GetUnit((*iter));
if (target) if (target)

View file

@ -35,7 +35,6 @@ struct SpellEntry;
class DynamicObject : public WorldObject class DynamicObject : public WorldObject
{ {
public: public:
typedef std::set<ObjectGuid> AffectedSet;
explicit DynamicObject(); explicit DynamicObject();
void AddToWorld(); void AddToWorld();
@ -74,7 +73,7 @@ class DynamicObject : public WorldObject
int32 m_aliveDuration; int32 m_aliveDuration;
float m_radius; // radius apply persistent effect, 0 = no persistent effect float m_radius; // radius apply persistent effect, 0 = no persistent effect
bool m_positive; bool m_positive;
AffectedSet m_affected; GuidSet m_affected;
private: private:
GridReference<DynamicObject> m_gridRef; GridReference<DynamicObject> m_gridRef;
}; };

View file

@ -387,7 +387,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/)
if (spellId) if (spellId)
{ {
for (GuidsSet::const_iterator itr = m_UniqueUsers.begin(); itr != m_UniqueUsers.end(); ++itr) for (GuidSet::const_iterator itr = m_UniqueUsers.begin(); itr != m_UniqueUsers.end(); ++itr)
{ {
if (Player* owner = GetMap()->GetPlayer(*itr)) if (Player* owner = GetMap()->GetPlayer(*itr))
owner->CastSpell(owner, spellId, false, NULL, NULL, GetObjectGuid()); owner->CastSpell(owner, spellId, false, NULL, NULL, GetObjectGuid());

View file

@ -760,15 +760,13 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction). time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
// For traps/goober this: spell casting cooldown, for doors/buttons: reset time. // For traps/goober this: spell casting cooldown, for doors/buttons: reset time.
typedef std::set<ObjectGuid> GuidsSet; GuidSet m_SkillupSet; // players that already have skill-up at GO use
GuidsSet m_SkillupSet; // players that already have skill-up at GO use
uint32 m_useTimes; // amount uses/charges triggered uint32 m_useTimes; // amount uses/charges triggered
// collected only for GAMEOBJECT_TYPE_SUMMONING_RITUAL // collected only for GAMEOBJECT_TYPE_SUMMONING_RITUAL
ObjectGuid m_firstUser; // first GO user, in most used cases owner, but in some cases no, for example non-summoned multi-use GAMEOBJECT_TYPE_SUMMONING_RITUAL ObjectGuid m_firstUser; // first GO user, in most used cases owner, but in some cases no, for example non-summoned multi-use GAMEOBJECT_TYPE_SUMMONING_RITUAL
GuidsSet m_UniqueUsers; // all players who use item, some items activated after specific amount unique uses GuidSet m_UniqueUsers; // all players who use item, some items activated after specific amount unique uses
GameObjectInfo const* m_goInfo; GameObjectInfo const* m_goInfo;
GameObjectDisplayInfoEntry const* m_displayInfo; GameObjectDisplayInfoEntry const* m_displayInfo;

View file

@ -59,7 +59,7 @@ VisibleNotifier::Notify()
// generate outOfRange for not iterate objects // generate outOfRange for not iterate objects
i_data.AddOutOfRangeGUID(i_clientGUIDs); i_data.AddOutOfRangeGUID(i_clientGUIDs);
for(ObjectGuidSet::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr) for(GuidSet::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
{ {
player.m_clientGUIDs.erase(*itr); player.m_clientGUIDs.erase(*itr);
@ -75,8 +75,8 @@ VisibleNotifier::Notify()
player.GetSession()->SendPacket(&packet); player.GetSession()->SendPacket(&packet);
// send out of range to other players if need // send out of range to other players if need
ObjectGuidSet const& oor = i_data.GetOutOfRangeGUIDs(); GuidSet const& oor = i_data.GetOutOfRangeGUIDs();
for(ObjectGuidSet::const_iterator iter = oor.begin(); iter != oor.end(); ++iter) for(GuidSet::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
{ {
if (!iter->IsPlayer()) if (!iter->IsPlayer())
continue; continue;

View file

@ -40,7 +40,7 @@ namespace MaNGOS
{ {
Camera& i_camera; Camera& i_camera;
UpdateData i_data; UpdateData i_data;
ObjectGuidSet i_clientGUIDs; GuidSet i_clientGUIDs;
std::set<WorldObject*> i_visibleNow; std::set<WorldObject*> i_visibleNow;
explicit VisibleNotifier(Camera &c) : i_camera(c), i_clientGUIDs(c.GetOwner()->m_clientGUIDs) {} explicit VisibleNotifier(Camera &c) : i_camera(c), i_clientGUIDs(c.GetOwner()->m_clientGUIDs) {}

View file

@ -585,8 +585,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
{ {
// notify all players that are looting this that the item was removed // notify all players that are looting this that the item was removed
// convert the index to the slot the player sees // convert the index to the slot the player sees
PlayersLooting::iterator i_next; GuidSet::iterator i_next;
for (PlayersLooting::iterator i = m_playersLooting.begin(); i != m_playersLooting.end(); i = i_next) for (GuidSet::iterator i = m_playersLooting.begin(); i != m_playersLooting.end(); i = i_next)
{ {
i_next = i; i_next = i;
++i_next; ++i_next;
@ -600,8 +600,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
void Loot::NotifyMoneyRemoved() void Loot::NotifyMoneyRemoved()
{ {
// notify all players that are looting this that the money was removed // notify all players that are looting this that the money was removed
PlayersLooting::iterator i_next; GuidSet::iterator i_next;
for (PlayersLooting::iterator i = m_playersLooting.begin(); i != m_playersLooting.end(); i = i_next) for (GuidSet::iterator i = m_playersLooting.begin(); i != m_playersLooting.end(); i = i_next)
{ {
i_next = i; i_next = i;
++i_next; ++i_next;
@ -619,8 +619,8 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
// (other questitems can be looted by each group member) // (other questitems can be looted by each group member)
// bit inefficient but isnt called often // bit inefficient but isnt called often
PlayersLooting::iterator i_next; GuidSet::iterator i_next;
for (PlayersLooting::iterator i = m_playersLooting.begin(); i != m_playersLooting.end(); i = i_next) for (GuidSet::iterator i = m_playersLooting.begin(); i != m_playersLooting.end(); i = i_next)
{ {
i_next = i; i_next = i;
++i_next; ++i_next;

View file

@ -303,8 +303,7 @@ struct Loot
LootItemList m_questItems; LootItemList m_questItems;
typedef std::set<ObjectGuid> PlayersLooting; GuidSet m_playersLooting;
PlayersLooting m_playersLooting;
QuestItemMap m_playerQuestItems; QuestItemMap m_playerQuestItems;
QuestItemMap m_playerFFAItems; QuestItemMap m_playerFFAItems;

View file

@ -206,7 +206,10 @@ class MANGOS_DLL_SPEC ObjectGuid
uint64 m_guid; uint64 m_guid;
}; };
typedef std::set<ObjectGuid> ObjectGuidSet; // Some Shared defines
typedef std::set<ObjectGuid> GuidSet;
typedef std::list<ObjectGuid> GuidList;
typedef std::vector<ObjectGuid> GuidVector;
//minimum buffer size for packed guid is 9 bytes //minimum buffer size for packed guid is 9 bytes
#define PACKED_GUID_MIN_BUFFER_SIZE 9 #define PACKED_GUID_MIN_BUFFER_SIZE 9

View file

@ -246,7 +246,7 @@ void PetAI::UpdateAI(const uint32 diff)
else else
{ {
bool spellUsed = false; bool spellUsed = false;
for (AllySet::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) for (GuidSet::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
{ {
Unit* Target = m_creature->GetMap()->GetUnit(*tar); Unit* Target = m_creature->GetMap()->GetUnit(*tar);

View file

@ -51,8 +51,7 @@ class MANGOS_DLL_DECL PetAI : public CreatureAI
TimeTracker i_tracker; TimeTracker i_tracker;
bool inCombat; bool inCombat;
typedef std::set<ObjectGuid> AllySet; GuidSet m_AllySet;
AllySet m_AllySet;
uint32 m_updateAlliesTimer; uint32 m_updateAlliesTimer;
}; };
#endif #endif

View file

@ -20079,13 +20079,13 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
} }
template<class T> template<class T>
inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, T* target) inline void UpdateVisibilityOf_helper(GuidSet& s64, T* target)
{ {
s64.insert(target->GetObjectGuid()); s64.insert(target->GetObjectGuid());
} }
template<> template<>
inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, GameObject* target) inline void UpdateVisibilityOf_helper(GuidSet& s64, GameObject* target)
{ {
if(!target->IsTransport()) if(!target->IsTransport())
s64.insert(target->GetObjectGuid()); s64.insert(target->GetObjectGuid());
@ -20782,7 +20782,7 @@ void Player::UpdateForQuestWorldObjects()
UpdateData udata; UpdateData udata;
WorldPacket packet; WorldPacket packet;
for(ObjectGuidSet::const_iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr) for(GuidSet::const_iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr)
{ {
if (itr->IsGameObject()) if (itr->IsGameObject())
{ {

View file

@ -2212,7 +2212,7 @@ class MANGOS_DLL_SPEC Player : public Unit
Object* GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask); Object* GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask);
// currently visible objects at player client // currently visible objects at player client
ObjectGuidSet m_clientGUIDs; GuidSet m_clientGUIDs;
bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetObjectGuid())!=m_clientGUIDs.end(); } bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetObjectGuid())!=m_clientGUIDs.end(); }

View file

@ -605,7 +605,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4); WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder data << uint32(count); // placeholder
for(ObjectGuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) for(GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
{ {
uint8 dialogStatus = DIALOG_STATUS_NONE; uint8 dialogStatus = DIALOG_STATUS_NONE;

View file

@ -4944,7 +4944,7 @@ void Unit::RemoveDynObject(uint32 spellid)
{ {
if(m_dynObjGUIDs.empty()) if(m_dynObjGUIDs.empty())
return; return;
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) for (GuidList::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
{ {
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
if(!dynObj) if(!dynObj)
@ -4973,7 +4973,7 @@ void Unit::RemoveAllDynObjects()
DynamicObject * Unit::GetDynObject(uint32 spellId, SpellEffectIndex effIndex) DynamicObject * Unit::GetDynObject(uint32 spellId, SpellEffectIndex effIndex)
{ {
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) for (GuidList::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
{ {
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
if(!dynObj) if(!dynObj)
@ -4991,7 +4991,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId, SpellEffectIndex effIndex)
DynamicObject * Unit::GetDynObject(uint32 spellId) DynamicObject * Unit::GetDynObject(uint32 spellId)
{ {
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) for (GuidList::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
{ {
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
if(!dynObj) if(!dynObj)
@ -6030,7 +6030,7 @@ void Unit::RemoveGuardians()
Pet* Unit::FindGuardianWithEntry(uint32 entry) Pet* Unit::FindGuardianWithEntry(uint32 entry)
{ {
for (GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
if (Pet* pet = GetMap()->GetPet(*itr)) if (Pet* pet = GetMap()->GetPet(*itr))
if (pet->GetEntry() == entry) if (pet->GetEntry() == entry)
return pet; return pet;
@ -6040,7 +6040,7 @@ Pet* Unit::FindGuardianWithEntry(uint32 entry)
Pet* Unit::GetProtectorPet() Pet* Unit::GetProtectorPet()
{ {
for (GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
if (Pet* pet = GetMap()->GetPet(*itr)) if (Pet* pet = GetMap()->GetPet(*itr))
if (pet->getPetType() == PROTECTOR_PET) if (pet->getPetType() == PROTECTOR_PET)
return pet; return pet;

View file

@ -1062,8 +1062,6 @@ enum IgnoreUnitState
IGNORE_UNIT_TARGET_NON_FROZEN = 126, // ignore absent of frozen state IGNORE_UNIT_TARGET_NON_FROZEN = 126, // ignore absent of frozen state
}; };
typedef std::set<ObjectGuid> GuardianPetList;
// delay time next attack to prevent client attack animation problems // delay time next attack to prevent client attack animation problems
#define ATTACK_DISPLAY_DELAY 200 #define ATTACK_DISPLAY_DELAY 200
#define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player #define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player
@ -1930,8 +1928,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
SingleCastSpellTargetMap m_singleCastSpellTargets; // casted by unit single per-caster auras SingleCastSpellTargetMap m_singleCastSpellTargets; // casted by unit single per-caster auras
typedef std::list<ObjectGuid> DynObjectGUIDs; GuidList m_dynObjGUIDs;
DynObjectGUIDs m_dynObjGUIDs;
typedef std::list<GameObject*> GameObjectList; typedef std::list<GameObject*> GameObjectList;
GameObjectList m_gameObj; GameObjectList m_gameObj;
@ -1996,7 +1993,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
ComboPointHolderSet m_ComboPointHolders; ComboPointHolderSet m_ComboPointHolders;
GuardianPetList m_guardianPets; GuidSet m_guardianPets;
ObjectGuid m_TotemSlot[MAX_TOTEM_SLOT]; ObjectGuid m_TotemSlot[MAX_TOTEM_SLOT];
@ -2030,7 +2027,7 @@ void Unit::CallForAllControlledUnits(Func const& func, uint32 controlledMask)
if (controlledMask & CONTROLLED_GUARDIANS) if (controlledMask & CONTROLLED_GUARDIANS)
{ {
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();) for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();)
if (Pet* guardian = _GetPet(*(itr++))) if (Pet* guardian = _GetPet(*(itr++)))
func(guardian); func(guardian);
} }
@ -2063,7 +2060,7 @@ bool Unit::CheckAllControlledUnits(Func const& func, uint32 controlledMask) cons
if (controlledMask & CONTROLLED_GUARDIANS) if (controlledMask & CONTROLLED_GUARDIANS)
{ {
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();) for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();)
if (Pet const* guardian = _GetPet(*(itr++))) if (Pet const* guardian = _GetPet(*(itr++)))
if (func(guardian)) if (func(guardian))
return true; return true;

View file

@ -30,7 +30,7 @@ UpdateData::UpdateData() : m_blockCount(0)
{ {
} }
void UpdateData::AddOutOfRangeGUID(ObjectGuidSet& guids) void UpdateData::AddOutOfRangeGUID(GuidSet& guids)
{ {
m_outOfRangeGUIDs.insert(guids.begin(),guids.end()); m_outOfRangeGUIDs.insert(guids.begin(),guids.end());
} }
@ -115,7 +115,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS; buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
buf << (uint32) m_outOfRangeGUIDs.size(); buf << (uint32) m_outOfRangeGUIDs.size();
for(ObjectGuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i) for(GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
buf << i->WriteAsPacked(); buf << i->WriteAsPacked();
} }

View file

@ -54,18 +54,18 @@ class UpdateData
public: public:
UpdateData(); UpdateData();
void AddOutOfRangeGUID(ObjectGuidSet& guids); void AddOutOfRangeGUID(GuidSet& guids);
void AddOutOfRangeGUID(ObjectGuid const &guid); void AddOutOfRangeGUID(ObjectGuid const &guid);
void AddUpdateBlock(const ByteBuffer &block); void AddUpdateBlock(const ByteBuffer &block);
bool BuildPacket(WorldPacket *packet); bool BuildPacket(WorldPacket *packet);
bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); } bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
void Clear(); void Clear();
ObjectGuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; } GuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
protected: protected:
uint32 m_blockCount; uint32 m_blockCount;
ObjectGuidSet m_outOfRangeGUIDs; GuidSet m_outOfRangeGUIDs;
ByteBuffer m_data; ByteBuffer m_data;
void Compress(void* dst, uint32 *dst_size, void* src, int src_size); void Compress(void* dst, uint32 *dst_size, void* src, int src_size);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12025" #define REVISION_NR "12026"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__