00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __ACTION_H
00015 #define __ACTION_H
00016
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021
00022 #include "action_skill.h"
00023 #include "action_bonus.h"
00024
00025 #define loopActionSkills(r,v) loopMap((r)->listSkills(),v,class action_skill)
00026 #define loopActionBonus(r,v) loopMapi((r)->listBonus(),v,class action_bonus)
00027
00028 class action {
00029 string name;
00030 string description;
00031 int type;
00032 class skill *deity;
00033 int time;
00034 int time_base;
00035 int endurance;
00036 int range;
00037 int aiming;
00038 int energy;
00039 map<string,class action_skill> skills;
00040 map<int,class action_bonus> bonus;
00041 int maxBonus;
00042 public:
00043 action();
00044
00045
00046 const string getName() const;
00047 void setName(const string v);
00048
00049
00050 const string getDescription() const;
00051 void setDescription(const string v);
00052
00053
00054 enum type_enum{type_free,type_tools,type_transport,type_building};
00055 const int getType() const;
00056 const string showType() const;
00057 void setType(const int v);
00058 void setType(const string v);
00059
00060
00061 class skill& getDeity() const;
00062 void setDeity(class skill &v);
00063
00064
00065 const int getTime() const;
00066 void setTime(const int v);
00067
00068
00069 enum time_base_enum{time_base_second,time_base_minute,time_base_hour,time_base_day,time_base_week,time_base_month,time_base_year};
00070 const int getTime_base() const;
00071 const string showTime_base() const;
00072 void setTime_base(const int v);
00073 void setTime_base(const string v);
00074
00075
00076 const int getEndurance() const;
00077 void setEndurance(const int v);
00078
00079
00080 const int getRange() const;
00081 void setRange(const int v);
00082
00083
00084 const int getAiming() const;
00085 void setAiming(const int v);
00086
00087
00088 const int getEnergy() const;
00089 void setEnergy(const int v);
00090
00091
00092 class action_skill& getSkills(const string v);
00093 map<string,class action_skill>& listSkills();
00094 void setSkills(class action_skill &v);
00095 void delSkills(const string v);
00096 const bool isSkills(const string v) const;
00097
00098
00099 class action_bonus& getBonus(const int v);
00100 map<int,class action_bonus>& listBonus();
00101 void setBonus(class action_bonus &v);
00102 void delBonus(const int v);
00103 const bool isBonus(const int v) const;
00104
00105 void save(class channel &ch);
00106 void load(class channel &ch);
00107 void xml(ofstream &f, int l=0, int r=0);
00108 };
00109
00110
00111
00112 #define loopActions(v) loopMap(action_repo.listAction(),v,class action)
00113
00114 class actionRepository {
00115 map<string,action> actions;
00116 public:
00117 class action& getAction(const string v);
00118 void setAction(class action& v);
00119 map<string,class action>& listAction();
00120 void delAction(const string v);
00121 const bool isAction(const string v) const;
00122 multimap<string, sigc::signal<void, class action& > > relations;
00123 bool load(class channel &ch);
00124 void save(class channel &ch);
00125 };
00126
00127 extern actionRepository action_repo;
00128
00129 #endif // __ACTION_H