00001
00002
00003
00004
00005
00006
00007
00008
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef buildingtypeH
00023 #define buildingtypeH
00024
00025 #include "typen.h"
00026 #include "containerbasetype.h"
00027 #include "ascstring.h"
00028 #include "terraintype.h"
00029 #include "objecttype.h"
00030 #include "basestreaminterface.h"
00031 #include "textfileparser.h"
00032 #include "research.h"
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00080 class BuildingType : public ContainerBaseType {
00081 bool field_Exists[4][6];
00082 Surface w_picture [ cwettertypennum ][ maxbuildingpicnum ][4][6];
00083 int bi_picture [ cwettertypennum ][ maxbuildingpicnum ][4][6];
00084
00085 BitSet weatherBits;
00086
00087 void convertOldFunctions( int abilities, const ASCString& location );
00088
00089 static const int cbuildingfunctionnum = 24;
00090
00091 public:
00093 class LocalCoordinate {
00094 public:
00095 int x,y;
00096 LocalCoordinate ( int _x, int _y ) : x(_x), y(_y) {};
00097 LocalCoordinate ( ) : x(-1), y(-1) {};
00098 LocalCoordinate ( const ASCString& s );
00099 bool valid() const { return x>=0 && y>=0; };
00100 ASCString toString ( ) const;
00101 bool operator<(const LocalCoordinate& a) const { return y < a.y || (y == a.y && x < a.x);};
00102 };
00103
00104
00105 typedef multimap<LocalCoordinate,int> DestructionObjects;
00107 DestructionObjects destructionObjects;
00108
00109 LocalCoordinate entry;
00110
00115 int _armor;
00116
00118 int technologylevel;
00119
00121 int researchid;
00122
00124 TerrainAccess terrainaccess;
00125
00127 int construction_steps;
00128
00130 int buildingheight;
00131
00132 int getMoveMalusType() const {
00133 return 11;
00134 };
00135
00136
00138 int externalloadheight;
00139
00140 const Surface& getPicture ( const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0 ) const;
00141 void paint ( Surface& s, SPoint pos, const PlayerColor& player, int weather = 0, int constructionStep = 0 ) const;
00142 void paint ( Surface& s, SPoint pos ) const;
00143 void paintSingleField ( Surface& s, SPoint pos, const LocalCoordinate& localCoordinate, const PlayerColor& player , int weather = 0, int constructionStep = 0 ) const;
00144 void paintSingleField ( Surface& s, SPoint pos, const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0 ) const;
00145
00146 int getBIPicture( const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0) const;
00147
00148
00149 bool fieldExists(const LocalCoordinate& localCoordinate) const { return field_Exists[localCoordinate.x][localCoordinate.y]; } ;
00150
00151 BuildingType ( void );
00152
00157 MapCoordinate getFieldCoordinate( const MapCoordinate& entryOnMap, const LocalCoordinate& localCoordinate ) const;
00158
00160 LocalCoordinate getLocalCoordinate( const MapCoordinate& entryOnMap, const MapCoordinate& field ) const;
00161
00162 void read ( tnstream& stream ) ;
00163 void write ( tnstream& stream ) const ;
00164 void runTextIO ( PropertyContainer& pc );
00165
00166 bool buildingNotRemovable;
00167
00168 int getMemoryFootprint() const;
00169
00170
00171 };
00172
00173
00174 #endif