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
00035 class BuildingType : public ContainerBaseType {
00036 ASCString originalImageFilename[cwettertypennum];
00037
00038 public:
00039 static const int xdimension = 4;
00040 static const int ydimension = 6;
00041 bool field_Exists[xdimension][ydimension];
00042 Surface w_picture [ cwettertypennum ][ maxbuildingpicnum ][4][6];
00043 int bi_picture [ cwettertypennum ][ maxbuildingpicnum ][4][6];
00044
00045 BitSet weatherBits;
00046
00051 void convertOldFunctions( int abilities, const ASCString& location );
00052
00054 static const int cbuildingfunctionnum = 24;
00055
00057 class LocalCoordinate {
00058 public:
00059 int x,y;
00060 LocalCoordinate ( int _x, int _y ) : x(_x), y(_y) {};
00061 LocalCoordinate ( ) : x(-1), y(-1) {};
00062 LocalCoordinate ( const ASCString& s );
00063 bool valid() const { return x>=0 && y>=0; };
00064 ASCString toString ( ) const;
00065 bool operator<(const LocalCoordinate& a) const { return y < a.y || (y == a.y && x < a.x);};
00066 };
00067
00068
00069 typedef multimap<LocalCoordinate,int> DestructionObjects;
00071 DestructionObjects destructionObjects;
00072
00074 LocalCoordinate entry;
00075
00080 int _armor;
00081
00083 int technologylevel;
00084
00086 TerrainAccess terrainaccess;
00087
00089 int construction_steps;
00090
00091 int getMoveMalusType() const {
00092 return 11;
00093 };
00094
00095
00097 int externalloadheight;
00098
00099 const Surface& getPicture ( const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0 ) const;
00100 void paint ( Surface& s, SPoint pos, const PlayerColor& player, int weather = 0, int constructionStep = 0 ) const;
00101 void paint ( Surface& s, SPoint pos ) const;
00102 void paintSingleField ( Surface& s, SPoint pos, const LocalCoordinate& localCoordinate, const PlayerColor& player , int weather = 0, int constructionStep = 0 ) const;
00103 void paintSingleField ( Surface& s, SPoint pos, const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0 ) const;
00104
00105 int getBIPicture( const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0) const;
00106
00108 bool fieldExists(const LocalCoordinate& localCoordinate) const { return field_Exists[localCoordinate.x][localCoordinate.y]; } ;
00109
00110 BuildingType ( void );
00111
00116 MapCoordinate getFieldCoordinate( const MapCoordinate& entryOnMap, const LocalCoordinate& localCoordinate ) const;
00117
00119 LocalCoordinate getLocalCoordinate( const MapCoordinate& entryOnMap, const MapCoordinate& field ) const;
00120
00121 void read ( tnstream& stream ) ;
00122 void write ( tnstream& stream ) const ;
00123 void runTextIO ( PropertyContainer& pc );
00124
00126 bool buildingNotRemovable;
00127
00128 int getMemoryFootprint() const;
00129
00130
00131 };
00132
00133
00134 #endif