Advanced Strategic Command
buildingtype.h
Go to the documentation of this file.
1 /***************************************************************************
2  buildingtype.h - description
3  -------------------
4  begin : Fri Sep 29 2000
5  copyright : (C) 2000 by Martin Bickel
6  email : bickel@asc-hq.org
7  ***************************************************************************/
8 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 
22 #ifndef buildingtypeH
23  #define buildingtypeH
24 
25  #include "typen.h"
26  #include "containerbasetype.h"
27  #include "ascstring.h"
28  #include "terraintype.h"
29  #include "objecttype.h"
30  #include "basestreaminterface.h"
31  #include "textfileparser.h"
32  #include "research.h"
33 
36  ASCString originalImageFilename[cwettertypennum];
37 
38  public:
39  static const int xdimension = 4;
40  static const int ydimension = 6;
44 
45  BitSet weatherBits; // for which weather are images available
46 
51  void convertOldFunctions( int abilities, const ASCString& location );
52 
54  static const int cbuildingfunctionnum = 24;
55 
58  public:
59  int x,y;
60  LocalCoordinate ( int _x, int _y ) : x(_x), y(_y) {};
61  LocalCoordinate ( ) : x(-1), y(-1) {};
62  LocalCoordinate ( const ASCString& s );
63  bool valid() const { return x>=0 && y>=0; };
64  ASCString toString ( ) const;
65  bool operator<(const LocalCoordinate& a) const { return y < a.y || (y == a.y && x < a.x);};
66  };
67 
68 
69  typedef multimap<LocalCoordinate,int> DestructionObjects;
72 
75 
80  int _armor;
81 
84 
87 
90 
91  int getMoveMalusType() const {
92  return 11;
93  };
94 
95 
98 
99  const Surface& getPicture ( const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0 ) const;
100  void paint ( Surface& s, SPoint pos, const PlayerColor& player, int weather = 0, int constructionStep = 0 ) const;
101  void paint ( Surface& s, SPoint pos ) const;
102  void paintSingleField ( Surface& s, SPoint pos, const LocalCoordinate& localCoordinate, const PlayerColor& player , int weather = 0, int constructionStep = 0 ) const;
103  void paintSingleField ( Surface& s, SPoint pos, const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0 ) const;
104 
105  int getBIPicture( const LocalCoordinate& localCoordinate, int weather = 0, int constructionStep = 0) const;
106 
108  bool fieldExists(const LocalCoordinate& localCoordinate) const { return field_Exists[localCoordinate.x][localCoordinate.y]; } ;
109 
110  BuildingType ( void );
111 
116  MapCoordinate getFieldCoordinate( const MapCoordinate& entryOnMap, const LocalCoordinate& localCoordinate ) const;
117 
119  LocalCoordinate getLocalCoordinate( const MapCoordinate& entryOnMap, const MapCoordinate& field ) const;
120 
121  void read ( tnstream& stream ) ;
122  void write ( tnstream& stream ) const ;
123  void runTextIO ( PropertyContainer& pc );
124 
127 
128  int getMemoryFootprint() const;
129 
130 
131 };
132 
133 
134 #endif
void read(tnstream &stream)
read the binary representation of this item from the given stream
void paintSingleField(Surface &s, SPoint pos, const LocalCoordinate &localCoordinate, const PlayerColor &player, int weather=0, int constructionStep=0) const
MapCoordinate getFieldCoordinate(const MapCoordinate &entryOnMap, const LocalCoordinate &localCoordinate) const
returns the Mapcoordinate of a buildings field
int getBIPicture(const LocalCoordinate &localCoordinate, int weather=0, int constructionStep=0) const
int externalloadheight
bitmapped: units on these levels of height may be refuelled when standing next to the buildings entry...
Definition: buildingtype.h:93
Surface w_picture[cwettertypennum][maxbuildingpicnum][4][6]
Definition: buildingtype.h:42
void write(tnstream &stream) const
write the binary representation of this item to the given stream
A local coordinate referencing a single field that a building covers.
Definition: buildingtype.h:57
bool buildingNotRemovable
if true, this building can not be removed by the player with his construction vehicles ...
Definition: buildingtype.h:126
int technologylevel
not used at the moment
Definition: buildingtype.h:83
static const int cbuildingfunctionnum
the number of legacy abilities that a building could be equipped with
Definition: buildingtype.h:54
The interface for all kinds of IO stream.
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
LocalCoordinate(int _x, int _y)
Definition: buildingtype.h:60
int getMoveMalusType() const
Definition: buildingtype.h:91
bool fieldExists(const LocalCoordinate &localCoordinate) const
returns whether this building covers the given field
Definition: buildingtype.h:108
const int maxbuildingpicnum
The maximum number of number of different images for a building and a weather. For example...
Definition: typen.h:70
The class describing properties that are common to all buildings of a certain kind.
Definition: buildingtype.h:35
This class is used by buildings, vehicles and objects to specify which terrain it can move to / be bu...
Definition: terraintype.h:42
BuildingType(void)
Coordinate on the twodimensional map.
Definition: typen.h:202
BitSet weatherBits
Definition: buildingtype.h:45
void paint(Surface &s, SPoint pos, const PlayerColor &player, int weather=0, int constructionStep=0) const
const Surface & getPicture(const LocalCoordinate &localCoordinate, int weather=0, int constructionStep=0) const
TerrainAccess terrainaccess
the terrain properties which are necessary for the building to be constructed there ...
Definition: buildingtype.h:86
SDLmm::SPoint SPoint
Definition: surface.h:27
bool operator<(const LocalCoordinate &a) const
Definition: buildingtype.h:65
static const int xdimension
Definition: buildingtype.h:39
static const int ydimension
Definition: buildingtype.h:40
int _armor
the armor of the buildingtype.
Definition: buildingtype.h:80
int getMemoryFootprint() const
bool field_Exists[xdimension][ydimension]
Definition: buildingtype.h:41
int construction_steps
the number of stages that are required to construct a building using a construction unit...
Definition: buildingtype.h:89
void runTextIO(PropertyContainer &pc)
registers the properties of this item for loading/writing into asctxt files
DestructionObjects destructionObjects
when the building is destroyed, it can leave rubble objects behind. If set to 0 no objects are being ...
Definition: buildingtype.h:71
ASCString location
The filename and location on disk (including containerfiles) of the object.
Definition: typen.h:296
void convertOldFunctions(int abilities, const ASCString &location)
the method for specifying a building's abilility was change at some point in time.
multimap< LocalCoordinate, int > DestructionObjects
Definition: buildingtype.h:69
int bi_picture[cwettertypennum][maxbuildingpicnum][4][6]
Definition: buildingtype.h:43
std::bitset< 64 > BitSet
Definition: basictypes.h:48
Everything related to research.
LocalCoordinate entry
the position of the entrance, which is the field of the building where units can enter and leave ...
Definition: buildingtype.h:74
const int cwettertypennum
The number of different weather.
Definition: typen.h:61
The standard interface for ASC streams. This is the parent class for all kinds of streams: normal fil...
LocalCoordinate getLocalCoordinate(const MapCoordinate &entryOnMap, const MapCoordinate &field) const
converts a global coordinate into a local coordinate.
Functions to parse the *.asctxt files.