server_new/plan.h

Go to the documentation of this file.
00001 /* $Id:plan.h $ */
00002 /*
00003    Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
00004    Part of the Moros Project http://moros.sourceforge.net/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 3.
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY.
00010 
00011    See the COPYING file for more details.
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     // Field : nr
00043     const int getNr() const;
00044     void setNr(const int v);
00045     int operator<(const class plan &ck) const;
00046 
00047     // Field : type
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     // Field : planned
00055     const int getPlanned() const;
00056     void setPlanned(const int v);
00057 
00058     // Field : finished
00059     const int getFinished() const;
00060     void setFinished(const int v);
00061 
00062     // Field : done
00063     const int getDone() const;
00064     void setDone(const int v);
00065 
00066     // Field : what
00067     class army& getWhat() const;
00068     void setWhat(class army &v);
00069 
00070     // Field : contributers
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     // Field : persons
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     // Field : priority
00085     const int getPriority() const;
00086     void setPriority(const int v);
00087 
00088     // Field : location
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 // Repository
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


Generated on Tue Jan 1 17:30:01 2008 for server_new/plan.h Source File by  doxygen   Visit the project page on SourceForge.net Logo