00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef __RACE_H
00015 #define __RACE_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 "skill_level.h"
00026 #include "unit.h"
00027 #include "culture.h"
00028 
00029 #define loopRaceSpecial(r,v) loopMapi((r)->listSpecial(),v,class action_level)
00030 #define loopRaceWeapons(r,v) loopSingle((r)->listWeapons(),v,class material,list)
00031 #define loopRaceBackground(r,v) loopSingle((r)->listBackground(),v,class background_level,list)
00032 #define loopRaceSkill(r,v) loopMap((r)->listSkill(),v,class skill_level)
00033 #define loopRaceUnit(r,v) loopMap((r)->listUnit(),v,class unit)
00034 #define loopRaceCulture(r,v) loopMap((r)->listCulture(),v,class culture)
00035 
00036 class race {
00037     string name;
00038     string description;
00039     int size;
00040     map<int,class action_level> special;
00041     int maxSpecial;
00042     map<string,class material> weapons;
00043     int age_percentage;
00044     class aging *aging;
00045     int reach;
00046     map<string,class background_level> background;
00047     map<string,class skill_level> skill;
00048     int armor;
00049     map<string,class unit> unit;
00050     map<string,class culture> culture;
00051 public:
00052     race();
00053 
00054     
00055     const string getName() const;
00056     void setName(const string v);
00057 
00058     
00059     const string getDescription() const;
00060     void setDescription(const string v);
00061 
00062     
00063     const int getSize() const;
00064     void setSize(const int v);
00065 
00066     
00067     class action_level& getSpecial(const int v);
00068     map<int,class action_level>& listSpecial();
00069     void setSpecial(class action_level &v);
00070     void delSpecial(const int v);
00071     const bool isSpecial(const int v) const;
00072 
00073     
00074     class material& getWeapons(const string v);
00075     list<class material>& listWeapons();
00076     void setWeapons(class material &v);
00077     void delWeapons(const string v);
00078     const bool isWeapons(const string v) const;
00079 
00080     
00081     const int getAge_percentage() const;
00082     void setAge_percentage(const int v);
00083 
00084     
00085     class aging& getAging() const;
00086     void setAging(class aging &v);
00087 
00088     
00089     const int getReach() const;
00090     void setReach(const int v);
00091 
00092     
00093     class background_level& getBackground(const string v);
00094     list<class background_level>& listBackground();
00095     void setBackground(class background_level &v);
00096     void delBackground(const string v);
00097     const bool isBackground(const string v) const;
00098 
00099     
00100     class skill_level& getSkill(const string v);
00101     map<string,class skill_level>& listSkill();
00102     void setSkill(class skill_level &v);
00103     void delSkill(const string v);
00104     const bool isSkill(const string v) const;
00105 
00106     
00107     const int getArmor() const;
00108     void setArmor(const int v);
00109 
00110     
00111     class unit& getUnit(const string v);
00112     map<string,class unit>& listUnit();
00113     void setUnit(class unit &v);
00114     void delUnit(const string v);
00115     const bool isUnit(const string v) const;
00116 
00117     
00118     class culture& getCulture(const string v);
00119     map<string,class culture>& listCulture();
00120     void setCulture(class culture &v);
00121     void delCulture(const string v);
00122     const bool isCulture(const string v) const;
00123 
00124     void save(class channel &ch);
00125     void load(class channel &ch);
00126     void xml(ofstream &f, int l=0, int r=0);
00127 };
00128 
00129 
00130 
00131 #define loopRaces(v) loopMap(race_repo.listRace(),v,class race)
00132 
00133 class raceRepository {
00134     map<string,race> races;
00135 public:
00136     class race& getRace(const string v);
00137     void setRace(class race& v);
00138     map<string,class race>& listRace();
00139     void delRace(const string v);
00140     const bool isRace(const string v) const;
00141     multimap<string, sigc::signal<void, class race& > > relations;
00142     bool load(class channel &ch);
00143     void save(class channel &ch);
00144 };
00145 
00146 extern raceRepository race_repo;
00147 
00148 #endif // __RACE_H