00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __PLAN_H
00015 #define __PLAN_H
00016
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021
00022 #include "contributers.h"
00023 #include "contractors.h"
00024
00025 #define loopPlanContributers(r,v) loopMap((r)->listContributers(),v,class contributers)
00026 #define loopPlanPersons(r,v) loopMap((r)->listPersons(),v,class contractors)
00027
00028 class plan {
00029 int nr;
00030 int type;
00031 int planned;
00032 int finished;
00033 int done;
00034 class army *what;
00035 map<string,class contributers> contributers;
00036 map<string,class contractors> persons;
00037 int priority;
00038 int location;
00039 public:
00040 plan();
00041
00042
00043 const int getNr() const;
00044 void setNr(const int v);
00045 int operator<(const class plan &ck) const;
00046
00047
00048 enum type_enum{type_create,type_patrol,type_defend,type_destroy,type_pillage,type_conquer,type_scout,type_trade};
00049 const int getType() const;
00050 const string showType() const;
00051 void setType(const int v);
00052 void setType(const string v);
00053
00054
00055 const int getPlanned() const;
00056 void setPlanned(const int v);
00057
00058
00059 const int getFinished() const;
00060 void setFinished(const int v);
00061
00062
00063 const int getDone() const;
00064 void setDone(const int v);
00065
00066
00067 class army& getWhat() const;
00068 void setWhat(class army &v);
00069
00070
00071 class contributers& getContributers(const string v);
00072 map<string,class contributers>& listContributers();
00073 void setContributers(class contributers &v);
00074 void delContributers(const string v);
00075 const bool isContributers(const string v) const;
00076
00077
00078 class contractors& getPersons(const string v);
00079 map<string,class contractors>& listPersons();
00080 void setPersons(class contractors &v);
00081 void delPersons(const string v);
00082 const bool isPersons(const string v) const;
00083
00084
00085 const int getPriority() const;
00086 void setPriority(const int v);
00087
00088
00089 const int getLocation() const;
00090 void setLocation(const int v);
00091 const string showLocation() const;
00092
00093 void save(class channel &ch);
00094 void load(class channel &ch);
00095 void xml(ofstream &f, int l=0, int r=0);
00096 };
00097
00098
00099
00100 #define loopPlans(v) loopMapi(plan_repo.listPlan(),v,class plan)
00101
00102 class planRepository {
00103 map<int,class plan> plans;
00104 int max_nr;
00105 public:
00106 planRepository();
00107 class plan& getPlan(const int v);
00108 void setPlan(class plan& v);
00109 map<int,class plan>& listPlan();
00110 void delPlan(const int v);
00111 const bool isPlan(const int v) const;
00112 bool load(class channel &ch);
00113 void save(class channel &ch);
00114 };
00115
00116 extern planRepository plan_repo;
00117
00118 #endif // __PLAN_H