00001 /* $Id:special.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 __SPECIAL_H 00015 #define __SPECIAL_H 00016 00017 #include <string> 00018 #include <map> 00019 #include <list> 00020 using namespace std; 00021 00022 00023 00024 class special { 00025 class skill *skill; 00026 string name; 00027 string description; 00028 int type; 00029 class special *prerequisite; 00030 string group; 00031 public: 00032 special(); 00033 00034 // Field : skill 00035 class skill& getSkill() const; 00036 void setSkill(class skill &v); 00037 00038 // Field : name 00039 const string getName() const; 00040 void setName(const string v); 00041 00042 // Field : description 00043 const string getDescription() const; 00044 void setDescription(const string v); 00045 00046 // Field : type 00047 enum type_enum{type_common,type_uncommon}; 00048 const int getType() const; 00049 const string showType() const; 00050 void setType(const int v); 00051 void setType(const string v); 00052 00053 // Field : prerequisite 00054 class special& getPrerequisite() const; 00055 void setPrerequisite(class special &v); 00056 00057 // Field : group 00058 const string getGroup() const; 00059 void setGroup(const string v); 00060 00061 void save(class channel &ch); 00062 void load(class channel &ch); 00063 void xml(ofstream &f, int l=0, int r=0); 00064 }; 00065 00066 // Repository 00067 00068 #define loopSpecials(v) loopMap(special_repo.listSpecial(),v,class special) 00069 00070 class specialRepository { 00071 map<string,special> specials; 00072 public: 00073 class special& getSpecial(const string v); 00074 void setSpecial(class special& v); 00075 map<string,class special>& listSpecial(); 00076 void delSpecial(const string v); 00077 const bool isSpecial(const string v) const; 00078 multimap<string, sigc::signal<void, class special& > > relations; 00079 bool load(class channel &ch); 00080 void save(class channel &ch); 00081 }; 00082 00083 extern specialRepository special_repo; 00084 00085 #endif // __SPECIAL_H