Skip to content

Commit

Permalink
[9579] Use ObjectGuid in some loot code.
Browse files Browse the repository at this point in the history
Also use ObjectGuidSet instead std::set<ObjectGuid>
  • Loading branch information
VladimirMangos committed Mar 13, 2010
1 parent 897906b commit 6e24375
Show file tree
Hide file tree
Showing 13 changed files with 407 additions and 388 deletions.
6 changes: 3 additions & 3 deletions src/game/GridNotifiers.cpp
Expand Up @@ -94,7 +94,7 @@ VisibleNotifier::Notify()

// generate outOfRange for not iterate objects
i_data.AddOutOfRangeGUID(i_clientGUIDs);
for(Player::ClientGUIDs::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
for(ObjectGuidSet::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
{
i_player.m_clientGUIDs.erase(*itr);

Expand Down Expand Up @@ -123,8 +123,8 @@ VisibleNotifier::Notify()
i_player.GetSession()->SendPacket(&packet);

// send out of range to other players if need
std::set<ObjectGuid> const& oor = i_data.GetOutOfRangeGUIDs();
for(std::set<ObjectGuid>::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
ObjectGuidSet const& oor = i_data.GetOutOfRangeGUIDs();
for(ObjectGuidSet::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
{
if(!iter->IsPlayer())
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/game/GridNotifiers.h
Expand Up @@ -50,7 +50,7 @@ namespace MaNGOS
Player &i_player;
UpdateData i_data;
UpdateDataMapType i_data_updates;
Player::ClientGUIDs i_clientGUIDs;
ObjectGuidSet i_clientGUIDs;
std::set<WorldObject*> i_visibleNow;

explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
Expand Down
335 changes: 179 additions & 156 deletions src/game/LootHandler.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/game/ObjectGuid.h
Expand Up @@ -75,9 +75,7 @@ enum HighGuid
#define IS_PLAYER_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PLAYER && Guid!=0 )
#define IS_UNIT_GUID(Guid) ( IS_CREATURE_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid) )
// special case for empty guid need check
#define IS_ITEM_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_ITEM )
#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT )
#define IS_CORPSE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_CORPSE )
#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT )

// l - OBJECT_FIELD_GUID
Expand Down Expand Up @@ -233,6 +231,8 @@ class ObjectGuid
uint64 m_guid;
};

typedef std::set<ObjectGuid> ObjectGuidSet;

class PackedGuid
{
friend ByteBuffer& operator<< (ByteBuffer& buf, PackedGuid const& guid);
Expand Down

4 comments on commit 6e24375

@Rosjha
Copy link

@Rosjha Rosjha commented on 6e24375 Mar 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile fails on Debian Linux.

in file include from src/game/ArenaTeamHandler.cpp:19: src/Game/WorldSession.h:250: error: ObjectGuid has not been declared.

@arizejsn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same i have erros compiling in CentOS

@Cha0Sxx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fix the compile

diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index 4a755ad..f8a74b8 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -25,6 +25,7 @@

#include "Common.h"
#include "SharedDefines.h"
+#include "ObjectGuid.h"

struct ItemPrototype;
struct AuctionEntry;

@Cha0Sxx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad formating but i think with a bit imagination you should see that you have to add ' #include "ObjectGuid.h" ' to the includes in WorldSession.h

Please sign in to comment.