00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __UNIT_H
00015 #define __UNIT_H
00016
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021
00022 #include "action_level.h"
00023 #include "material.h"
00024 #include "background_level.h"
00025 #include "culture_part.h"
00026 #include "skill_level.h"
00027 #include "stat_amount.h"
00028
00029 #define loopUnitSpecials(r,v) loopMapi((r)->listSpecials(),v,class action_level)
00030 #define loopUnitWeapons(r,v) loopSingle((r)->listWeapons(),v,class material,list)
00031 #define loopUnitBackground(r,v) loopSingle((r)->listBackground(),v,class background_level,list)
00032 #define loopUnitCulture(r,v) loopMap((r)->listCulture(),v,class culture_part)
00033 #define loopUnitSkills(r,v) loopMap((r)->listSkills(),v,class skill_level)
00034 #define loopUnitStats(r,v) loopMap((r)->listStats(),v,class stat_amount)
00035
00036 class unit {
00037 string name;
00038 string description;
00039 int size;
00040 map<int,class action_level> specials;
00041 int maxSpecials;
00042 map<string,class material> weapons;
00043 map<string,class background_level> background;
00044 map<string,class culture_part> culture;
00045 map<string,class skill_level> skills;
00046 map<string,class stat_amount> stats;
00047 public:
00048 unit();
00049
00050
00051 const string getName() const;
00052 void setName(const string v);
00053
00054
00055 const string getDescription() const;
00056 void setDescription(const string v);
00057
00058
00059 const int getSize() const;
00060 void setSize(const int v);
00061
00062
00063 class action_level& getSpecials(const int v);
00064 map<int,class action_level>& listSpecials();
00065 void setSpecials(class action_level &v);
00066 void delSpecials(const int v);
00067 const bool isSpecials(const int v) const;
00068
00069
00070 class material& getWeapons(const string v);
00071 list<class material>& listWeapons();
00072 void setWeapons(class material &v);
00073 void delWeapons(const string v);
00074 const bool isWeapons(const string v) const;
00075
00076
00077 class background_level& getBackground(const string v);
00078 list<class background_level>& listBackground();
00079 void setBackground(class background_level &v);
00080 void delBackground(const string v);
00081 const bool isBackground(const string v) const;
00082
00083
00084 class culture_part& getCulture(const string v);
00085 map<string,class culture_part>& listCulture();
00086 void setCulture(class culture_part &v);
00087 void delCulture(const string v);
00088 const bool isCulture(const string v) const;
00089
00090
00091 class skill_level& getSkills(const string v);
00092 map<string,class skill_level>& listSkills();
00093 void setSkills(class skill_level &v);
00094 void delSkills(const string v);
00095 const bool isSkills(const string v) const;
00096
00097
00098 class stat_amount& getStats(const string v);
00099 map<string,class stat_amount>& listStats();
00100 void setStats(class stat_amount &v);
00101 void delStats(const string v);
00102 const bool isStats(const string v) const;
00103
00104 void save(class channel &ch);
00105 void load(class channel &ch);
00106 void xml(ofstream &f, int l=0, int r=0);
00107 };
00108
00109
00110
00111 #define loopUnits(v) loopMap(unit_repo.listUnit(),v,class unit)
00112
00113 class unitRepository {
00114 map<string,unit> units;
00115 public:
00116 class unit& getUnit(const string v);
00117 void setUnit(class unit& v);
00118 map<string,class unit>& listUnit();
00119 void delUnit(const string v);
00120 const bool isUnit(const string v) const;
00121 multimap<string, sigc::signal<void, class unit& > > relations;
00122 bool load(class channel &ch);
00123 void save(class channel &ch);
00124 };
00125
00126 extern unitRepository unit_repo;
00127
00128 #endif // __UNIT_H