server_new/person.h

Go to the documentation of this file.
00001 /* $Id:person.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 __PERSON_H
00015 #define __PERSON_H
00016 
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021 
00022 #include "background_level.h"
00023 #include "skill_level.h"
00024 #include "has_special.h"
00025 #include "stat_amount.h"
00026 #include "person_items.h"
00027 #include "status.h"
00028 #include "relations.h"
00029 
00030 #define loopPersonBackground(r,v) loopSingle((r)->listBackground(),v,class background_level,list)
00031 #define loopPersonSkills(r,v) loopMap((r)->listSkills(),v,class skill_level)
00032 #define loopPersonSpecials(r,v) loopMap((r)->listSpecials(),v,class has_special)
00033 #define loopPersonStats(r,v) loopMap((r)->listStats(),v,class stat_amount)
00034 #define loopPersonItems(r,v) loopSingle((r)->listItems(),v,class person_items,list)
00035 #define loopPersonStatus(r,v) loopMap((r)->listStatus(),v,class status)
00036 #define loopPersonRelations(r,v) loopMap((r)->listRelations(),v,class relations)
00037 
00038 class person {
00039     string name;
00040     string user;
00041     class race *race;
00042     map<string,class background_level> background;
00043     map<string,class skill_level> skills;
00044     map<string,class has_special> specials;
00045     map<string,class stat_amount> stats;
00046     map<string,class person_items> items;
00047     map<string,class status> status;
00048     int points;
00049     map<string,class relations> relations;
00050     int location;
00051     int start; // when was this player last logon or this npc created
00052     int last; // last command to this character by the player or the last ncp command
00053 public:
00054     person();
00055 
00056     // Field : name
00057     const string getName() const;
00058     void setName(const string v);
00059 
00060     // Field : user
00061     const string getUser() const;
00062     void setUser(const string v);
00063 
00064     // Field : race
00065     class race& getRace() const;
00066     void setRace(class race &v);
00067 
00068     // Field : background
00069     class background_level& getBackground(const string v);
00070     list<class background_level>& listBackground();
00071     void setBackground(class background_level &v);
00072     void delBackground(const string v);
00073     const bool isBackground(const string v) const;
00074 
00075     // Field : skills
00076     class skill_level& getSkills(const string v);
00077     map<string,class skill_level>& listSkills();
00078     void setSkills(class skill_level &v);
00079     void delSkills(const string v);
00080     const bool isSkills(const string v) const;
00081 
00082     // Field : specials
00083     class has_special& getSpecials(const string v);
00084     map<string,class has_special>& listSpecials();
00085     void setSpecials(class has_special &v);
00086     void delSpecials(const string v);
00087     const bool isSpecials(const string v) const;
00088 
00089     // Field : stats
00090     class stat_amount& getStats(const string v);
00091     map<string,class stat_amount>& listStats();
00092     void setStats(class stat_amount &v);
00093     void delStats(const string v);
00094     const bool isStats(const string v) const;
00095 
00096     // Field : items
00097     class person_items& getItems(const string v);
00098     list<class person_items>& listItems();
00099     void setItems(class person_items &v);
00100     void delItems(const string v);
00101     const bool isItems(const string v) const;
00102 
00103     // Field : status
00104     class status& getStatus(const string v);
00105     map<string,class status>& listStatus();
00106     void setStatus(class status &v);
00107     void delStatus(const string v);
00108     const bool isStatus(const string v) const;
00109 
00110     // Field : points
00111     const int getPoints() const;
00112     void setPoints(const int v);
00113 
00114     // Field : relations
00115     class relations& getRelations(const string v);
00116     map<string,class relations>& listRelations();
00117     void setRelations(class relations &v);
00118     void delRelations(const string v);
00119     const bool isRelations(const string v) const;
00120 
00121     // Field : location
00122     const int getLocation() const;
00123     void setLocation(const int v);
00124     const string showLocation() const;
00125 
00126     // Field : start
00127     const int getStart() const;
00128     void setStart(const int v);
00129 
00130     // Field : last
00131     const int getLast() const;
00132     void setLast(const int v);
00133 
00134     void save(class channel &ch);
00135     void load(class channel &ch);
00136     void xml(ofstream &f, int l=0, int r=0);
00137 };
00138 
00139 // Repository
00140 
00141 #define loopPersons(v) loopMap(person_repo.listPerson(),v,class person)
00142 
00143 class personRepository {
00144     map<string,person> persons;
00145 public:
00146     class person& getPerson(const string v);
00147     void setPerson(class person& v);
00148     map<string,class person>& listPerson();
00149     void delPerson(const string v);
00150     const bool isPerson(const string v) const;
00151     multimap<string, sigc::signal<void, class person& > > relations;
00152     bool load(class channel &ch);
00153     void save(class channel &ch);
00154 };
00155 
00156 extern personRepository person_repo;
00157 
00158 #endif // __PERSON_H


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