Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

buildingtype.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           buildingtype.h  -  description
00003                              -------------------
00004     begin                : Fri Sep 29 2000
00005     copyright            : (C) 2000 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
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 const int cbuildingfunctionnum = 24;
00036 extern const char*  cbuildingfunctions[];
00037  #define cghqn 0
00038  #define cghqb ( 1 << cghqn  )
00039  #define cgtrainingn 1
00040  #define cgtrainingb ( 1 << cgtrainingn  )
00041  #define cgvehicleproductionn 3
00042  #define cgvehicleproductionb ( 1 << cgvehicleproductionn  )
00043  #define cgammunitionproductionn 4
00044  #define cgammunitionproductionb ( 1 << cgammunitionproductionn  )
00045  #define cgrepairfacilityn 8
00046  #define cgrepairfacilityb ( 1 << cgrepairfacilityn  )
00047  #define cgrecyclingplantn 9
00048  #define cgrecyclingplantb ( 1 << cgrecyclingplantn  )
00049  #define cgresearchn 10
00050  #define cgresearchb ( 1 << cgresearchn  )
00051  #define cgsonarn 11
00052  #define cgsonarb ( 1 << cgsonarn )
00053  #define cgwindkraftwerkn 12
00054  #define cgwindkraftwerkb ( 1 << cgwindkraftwerkn )
00055  #define cgsolarkraftwerkn 13
00056  #define cgsolarkraftwerkb ( 1 << cgsolarkraftwerkn )
00057  #define cgconventionelpowerplantn 14
00058  #define cgconventionelpowerplantb ( 1 << cgconventionelpowerplantn )
00059  #define cgminingstationn 15
00060  #define cgminingstationb ( 1 << cgminingstationn )
00061  #define cgexternalloadingn 16
00062  #define cgexternalloadingb ( 1 << cgexternalloadingn )
00063  #define cgproduceAllUnitsN 17
00064  #define cgproduceAllUnitsB ( 1 << cgproduceAllUnitsN )
00065  #define cgresourceSinkN 18
00066  #define cgresourceSinkB ( 1 << cgresourceSinkN )
00067  #define cgexternalresourceloadingn 19
00068  #define cgexternalresourceloadingb ( 1 << cgexternalresourceloadingn )
00069  #define cgexternalammoloadingn 20
00070  #define cgexternalammoloadingb ( 1 << cgexternalammoloadingn )
00071  #define cgnoobjectchainingn 21
00072  #define cgnoobjectchainingb ( 1 << cgnoobjectchainingn )
00073  #define cgselfdestruct_at_conquern 22
00074  #define cgselfdestruct_at_conquerb ( 1 << cgselfdestruct_at_conquern )
00075  #define cgsatviewn 23
00076  #define cgsatviewb ( 1 << cgsatviewn )
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; // for which weather are images available
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

Generated on Tue Jun 24 01:27:36 2008 for Advanced Strategic Command by  doxygen 1.4.2