00001 #ifndef ITEMS_HH_ 00002 # define ITEMS_HH_ 00003 00004 # include <map> 00005 # include <set> 00006 00007 # include "objects_fwd.hh" 00008 00009 namespace objects 00010 { 00011 class Items 00012 { 00013 public: 00014 typedef std::map<int, ItemInst *> ItemMap; 00015 typedef std::set<ItemInst *> ItemSet; 00016 typedef std::set<ItemInScreen *> ItemInScreenSet; 00017 typedef std::set<PossessedItem *> PossessedItemSet; 00018 00019 public: 00020 Items(); 00021 ~Items(); 00022 00023 void add_item(ItemInst &item); 00024 ItemInst *remove_item(int item_id); 00025 ItemInst *get_item(int item_id); 00026 const ItemMap &get_item_map() const; 00027 00028 protected: 00029 ItemMap _item_map; 00030 00031 public: // Filters 00032 // Items in screen. 00033 ItemInScreenSet &get_items_in_screen(); 00034 // Items possessed by the player. 00035 PossessedItemSet &get_possessed_items(); 00036 // Items in hand. 00037 PossessedItemSet &get_items_in_hand(); 00038 // Items in hand, including shortcut items. 00039 PossessedItemSet &get_items_in_hand_and_shortcut(); 00040 // Items on body. 00041 PossessedItemSet &get_equipped_items(); 00042 // Healing items in hand. 00043 PossessedItemSet &get_hp_healing_items(); 00044 PossessedItemSet &get_mp_healing_items(); 00045 // Gate scrolls. 00046 PossessedItemSet &get_scroll_items(); 00047 00048 private: 00049 ItemInScreenSet _items_in_screen; 00050 PossessedItemSet _possessed_items; 00051 }; 00052 } 00053 00054 # include "items.hxx" 00055 00056 #endif