[11714] Add enum AuctionHouseType and let use it for more direct access to auction houses in AuctionHouseMgr

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
VladimirMangos 2011-07-07 03:37:59 +04:00
parent 7db70dd969
commit 1a263cb6a0
3 changed files with 18 additions and 11 deletions

View file

@ -51,14 +51,14 @@ AuctionHouseMgr::~AuctionHouseMgr()
AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house) AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house)
{ {
if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
return &mNeutralAuctions; return &mAuctions[AUCTION_HOUSE_NEUTRAL];
// team have linked auction houses // team have linked auction houses
switch(GetAuctionHouseTeam(house)) switch(GetAuctionHouseTeam(house))
{ {
case ALLIANCE: return &mAllianceAuctions; case ALLIANCE: return &mAuctions[AUCTION_HOUSE_ALLIANCE];
case HORDE: return &mHordeAuctions; case HORDE: return &mAuctions[AUCTION_HOUSE_HORDE];
default: return &mNeutralAuctions; default: return &mAuctions[AUCTION_HOUSE_NEUTRAL];
} }
} }
@ -483,9 +483,8 @@ bool AuctionHouseMgr::RemoveAItem(uint32 id)
void AuctionHouseMgr::Update() void AuctionHouseMgr::Update()
{ {
mHordeAuctions.Update(); for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
mAllianceAuctions.Update(); mAuctions[i].Update();
mNeutralAuctions.Update();
} }
uint32 AuctionHouseMgr::GetAuctionHouseTeam(AuctionHouseEntry const* house) uint32 AuctionHouseMgr::GetAuctionHouseTeam(AuctionHouseEntry const* house)

View file

@ -145,6 +145,15 @@ class AuctionSorter
Player* m_viewPlayer; Player* m_viewPlayer;
}; };
enum AuctionHouseType
{
AUCTION_HOUSE_ALLIANCE = 0,
AUCTION_HOUSE_HORDE = 1,
AUCTION_HOUSE_NEUTRAL = 2
};
#define MAX_AUCTION_HOUSE_TYPE 3
class AuctionHouseMgr class AuctionHouseMgr
{ {
public: public:
@ -153,6 +162,7 @@ class AuctionHouseMgr
typedef UNORDERED_MAP<uint32, Item*> ItemMap; typedef UNORDERED_MAP<uint32, Item*> ItemMap;
AuctionHouseObject* GetAuctionsMap(AuctionHouseType houseType) { return &mAuctions[houseType]; }
AuctionHouseObject* GetAuctionsMap(AuctionHouseEntry const* house); AuctionHouseObject* GetAuctionsMap(AuctionHouseEntry const* house);
Item* GetAItem(uint32 id) Item* GetAItem(uint32 id)
@ -185,9 +195,7 @@ class AuctionHouseMgr
void Update(); void Update();
private: private:
AuctionHouseObject mHordeAuctions; AuctionHouseObject mAuctions[MAX_AUCTION_HOUSE_TYPE];
AuctionHouseObject mAllianceAuctions;
AuctionHouseObject mNeutralAuctions;
ItemMap mAitems; ItemMap mAitems;
}; };

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 "11713" #define REVISION_NR "11714"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__