server/area.h

Go to the documentation of this file.
00001 /* $Id:area.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 __AREA_H
00015 #define __AREA_H
00016 
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021 
00022 
00023 
00024 class area {
00025     int nr;
00026     int terrain;
00027     int river_e;
00028     int river_ne;
00029     int river_nw;
00030     int road_e;
00031     int road_ne;
00032     int road_nw;
00033 public:
00034     area();
00035 
00036     // Field : nr
00037     const int getNr() const;
00038     void setNr(const int v);
00039     int operator<(const class area &ck) const;
00040 
00041     // Field : terrain
00042     enum terrain_enum{terrain_ocean,terrain_coast,terrain_ford,terrain_lava,terrain_ice,terrain_cave,terrain_field,terrain_grass,terrain_forest,terrain_tropical,terrain_dirt,terrain_swamp,terrain_desert,terrain_deserthills,terrain_desertmountains,terrain_mountains};
00043     const int getTerrain() const;
00044     const string showTerrain() const;
00045     void setTerrain(const int v);
00046     void setTerrain(const string v);
00047 
00048     // Field : river_e
00049     enum river_e_enum{river_e_open,river_e_river,river_e_river_dike,river_e_dike,river_e_wall};
00050     const int getRiver_e() const;
00051     const string showRiver_e() const;
00052     void setRiver_e(const int v);
00053     void setRiver_e(const string v);
00054 
00055     // Field : river_ne
00056     enum river_ne_enum{river_ne_open,river_ne_river,river_ne_river_dike,river_ne_dike,river_ne_wall};
00057     const int getRiver_ne() const;
00058     const string showRiver_ne() const;
00059     void setRiver_ne(const int v);
00060     void setRiver_ne(const string v);
00061 
00062     // Field : river_nw
00063     enum river_nw_enum{river_nw_open,river_nw_river,river_nw_river_dike,river_nw_dike,river_nw_wall};
00064     const int getRiver_nw() const;
00065     const string showRiver_nw() const;
00066     void setRiver_nw(const int v);
00067     void setRiver_nw(const string v);
00068 
00069     // Field : road_e
00070     enum road_e_enum{road_e_nothing,road_e_broken,road_e_normal,road_e_good};
00071     const int getRoad_e() const;
00072     const string showRoad_e() const;
00073     void setRoad_e(const int v);
00074     void setRoad_e(const string v);
00075 
00076     // Field : road_ne
00077     enum road_ne_enum{road_ne_nothing,road_ne_broken,road_ne_normal,road_ne_good};
00078     const int getRoad_ne() const;
00079     const string showRoad_ne() const;
00080     void setRoad_ne(const int v);
00081     void setRoad_ne(const string v);
00082 
00083     // Field : road_nw
00084     enum road_nw_enum{road_nw_nothing,road_nw_broken,road_nw_normal,road_nw_good};
00085     const int getRoad_nw() const;
00086     const string showRoad_nw() const;
00087     void setRoad_nw(const int v);
00088     void setRoad_nw(const string v);
00089 
00090     void save(class channel &ch);
00091     void load(class channel &ch);
00092     void xml(ofstream &f, int l=0, int r=0);
00093 };
00094 
00095 // Repository
00096 
00097 #define loopAreas(v) loopMapi(area_repo.listArea(),v,class area)
00098 
00099 class areaRepository {
00100     map<int,class area> areas;
00101     int max_nr;
00102 public:
00103     areaRepository();
00104     class area& getArea(const int v);
00105     void setArea(class area& v);
00106     map<int,class area>& listArea();
00107     void delArea(const int v);
00108     const bool isArea(const int v) const;
00109     bool load(class channel &ch);
00110     void save(class channel &ch);
00111 };
00112 
00113 extern areaRepository area_repo;
00114 
00115 #endif // __AREA_H


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