diff options
author | n0n4m3 <none@none> | 2009-12-24 10:20:15 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2009-12-24 10:20:15 +0100 |
commit | 250a00cc1c91d2df2b6c4f72a2ad322b46fed783 (patch) | |
tree | eab0216df4c91777747e866ed4525c9fbc7a037f /src/game/Creature.h | |
parent | acdc4ca15b69c84197f867192328829904646a66 (diff) |
Temporary revert 6743 commit. I fix this patch across 1-2 days.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.h')
-rw-r--r-- | src/game/Creature.h | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/game/Creature.h b/src/game/Creature.h index 7209388c032..6470af4bb71 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -28,7 +28,6 @@ #include "LootMgr.h" #include "Database/DatabaseEnv.h" #include "Cell.h" -#include "TimeMgr.h" #include <list> @@ -319,50 +318,45 @@ struct VendorItem uint32 ExtendedCost; }; typedef std::vector<VendorItem*> VendorItemList; -typedef std::map<uint32, uint8> ItemToSlotMap; struct VendorItemData { VendorItemList m_items; - ItemToSlotMap m_itemtoslot; - VendorItem* GetItem(uint8 slot) const + VendorItem* GetItem(uint32 slot) const { - if(slot >= uint8(m_items.size())) - return NULL; + if(slot>=m_items.size()) return NULL; return m_items[slot]; } - bool Empty() const { return m_items.empty(); } - uint8 GetItemCount() const { return uint8(m_items.size()); } - void AddItem(uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 vendorslot) + uint8 GetItemCount() const { return m_items.size(); } + void AddItem( uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost) { m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost)); - m_itemtoslot[item] = vendorslot; } bool RemoveItem( uint32 item_id ); VendorItem const* FindItem(uint32 item_id) const; - uint8 FindItemSlot(uint32 item_id) const; + size_t FindItemSlot(uint32 item_id) const; void Clear() { for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr) delete (*itr); m_items.clear(); - m_itemtoslot.clear(); } }; struct VendorItemCount { - VendorItemCount(); - VendorItemCount(uint32 _count); + explicit VendorItemCount(uint32 _item, uint32 _count) + : itemId(_item), count(_count), lastIncrementTime(time(NULL)) {} + uint32 itemId; uint32 count; time_t lastIncrementTime; }; -typedef std::map<uint32, VendorItemCount*> VendorItemCounts; +typedef std::list<VendorItemCount> VendorItemCounts; struct TrainerSpell { @@ -589,7 +583,7 @@ class TRINITY_DLL_SPEC Creature : public Unit time_t const& GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const; - void SetRespawnTime(uint32 respawn); + void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; } void Respawn(bool force = false); void SaveRespawnTime(); |