00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __ITEM_H
00015 #define __ITEM_H
00016
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021
00022 #include "action_level.h"
00023 #include "action_skill.h"
00024 #include "material.h"
00025 #include "action_bonus.h"
00026
00027 #define loopItemUsage(r,v) loopMapi((r)->listUsage(),v,class action_level)
00028 #define loopItemCreation(r,v) loopMap((r)->listCreation(),v,class action_skill)
00029 #define loopItemMaterial(r,v) loopSingle((r)->listMaterial(),v,class material,list)
00030 #define loopItemBonus(r,v) loopMapi((r)->listBonus(),v,class action_bonus)
00031
00032 class item {
00033 string name;
00034 int nr;
00035 string description;
00036 int status;
00037 int type;
00038 class skill *skill;
00039 class special *special;
00040 map<int,class action_level> usage;
00041 int maxUsage;
00042 map<string,class action_skill> creation;
00043 map<string,class material> material;
00044 map<int,class action_bonus> bonus;
00045 int maxBonus;
00046 public:
00047 item();
00048
00049
00050 const string getName() const;
00051 void setName(const string v);
00052
00053
00054 const int getNr() const;
00055 void setNr(const int v);
00056 int operator<(const class item &ck) const;
00057
00058
00059 const string getDescription() const;
00060 void setDescription(const string v);
00061
00062
00063 const int getStatus() const;
00064 void setStatus(const int v);
00065
00066
00067 enum type_enum{type_tool,type_cutting_weapon,type_blunt_weapon,type_impaling_weapon,type_transport,type_building,type_good};
00068 const int getType() const;
00069 const string showType() const;
00070 void setType(const int v);
00071 void setType(const string v);
00072
00073
00074 class skill& getSkill() const;
00075 void setSkill(class skill &v);
00076
00077
00078 class special& getSpecial() const;
00079 void setSpecial(class special &v);
00080
00081
00082 class action_level& getUsage(const int v);
00083 map<int,class action_level>& listUsage();
00084 void setUsage(class action_level &v);
00085 void delUsage(const int v);
00086 const bool isUsage(const int v) const;
00087
00088
00089 class action_skill& getCreation(const string v);
00090 map<string,class action_skill>& listCreation();
00091 void setCreation(class action_skill &v);
00092 void delCreation(const string v);
00093 const bool isCreation(const string v) const;
00094
00095
00096 class material& getMaterial(const string v);
00097 list<class material>& listMaterial();
00098 void setMaterial(class material &v);
00099 void delMaterial(const string v);
00100 const bool isMaterial(const string v) const;
00101
00102
00103 class action_bonus& getBonus(const int v);
00104 map<int,class action_bonus>& listBonus();
00105 void setBonus(class action_bonus &v);
00106 void delBonus(const int v);
00107 const bool isBonus(const int v) const;
00108
00109 void save(class channel &ch);
00110 void load(class channel &ch);
00111 void xml(ofstream &f, int l=0, int r=0);
00112 };
00113
00114
00115
00116 #define loopItems(v) loopSingle(item_repo.listItem(),v,class item,list)
00117
00118 class itemRepository {
00119 map<string,item> items;
00120 int max_nr;
00121 public:
00122 itemRepository();
00123 class item& getItem(const string v);
00124 void setItem(class item& v);
00125 list<class item>& listItem();
00126 void delItem(const string v);
00127 const bool isItem(const string v) const;
00128 multimap<string, sigc::signal<void, class item& > > relations;
00129 bool load(class channel &ch);
00130 void save(class channel &ch);
00131 };
00132
00133 extern itemRepository item_repo;
00134
00135 #endif // __ITEM_H