00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef objecttypeH
00019 #define objecttypeH
00020
00021 #include "typen.h"
00022 #include "terraintype.h"
00023 #include "research.h"
00024 #include "overviewmapimage.h"
00025 #include "mapitemtype.h"
00026 #include "mapfield.h"
00027
00028
00030 class ObjectType : public MapItemType, public LoadableItemType {
00031 bool rotateImage;
00032 void realDisplay ( Surface& surface, const SPoint& pos, int dir, int weather ) const;
00033 public:
00035 int id;
00036
00037
00039 vector<int> secondaryIDs;
00040
00042 int groupID;
00043
00045 BitSet weather;
00046
00048 bool visibleago;
00049
00051 vector<IntRange> linkableObjects;
00052
00054 vector<IntRange> linkableTerrain;
00055
00057 int armor;
00058
00059 struct FieldModification {
00060 FieldModification();
00061
00063 TerrainType::MoveMalus movemalus_plus;
00064
00066 TerrainType::MoveMalus movemalus_abs;
00067
00069 TerrainAccess terrainaccess;
00070
00072 TerrainBits terrain_and;
00073 TerrainBits terrain_or;
00074 void runTextIO ( PropertyContainer& pc );
00075 } fieldModification[cwettertypennum];
00076
00077 const FieldModification& getFieldModification( int weather ) const;
00078
00080 int attackbonus_plus;
00082 int attackbonus_abs;
00083
00085 int defensebonus_plus;
00087 int defensebonus_abs;
00088
00090 int basicjamming_plus;
00092 int basicjamming_abs;
00093
00095 int viewbonus_plus;
00097 int viewbonus_abs;
00098
00099
00100
00102 int imageHeight;
00103
00105 int physicalHeight;
00106
00108 Resources buildcost;
00109
00111 Resources removecost;
00112
00114 int build_movecost;
00115
00117 int remove_movecost;
00118
00120 bool canExistBeneathBuildings;
00121
00123 ASCString name;
00124
00125 ASCString getName() const { return name; };
00126
00127 enum NamingMethod { ReplaceTerrain, AddToTerrain, UnNamed };
00128 int namingMethod;
00129 static const char* namingMethodNames[];
00130 static const int namingMethodNum;
00131
00132 int getID() const { return id; };
00133
00134
00135 static const int netBehaviourNum = 7;
00136 enum NetBehaviour { NetToBuildings = 1, NetToBuildingEntry = 2, NetToSelf = 4, NetToBorder = 8, SpecialForest = 0x10, AutoBorder = 0x20, KeepOrientation = 0x40 };
00137
00139 int netBehaviour;
00140
00141 ObjectType ( void );
00142
00143 TechAdapterDependency techDependency;
00144
00145 const OverviewMapImage* getOverviewMapImage( int picnum, int weather ) const ;
00146
00148 struct WeatherPicture {
00149 mutable vector<OverviewMapImage> overviewMapImage;
00150 vector<Surface> images;
00151 vector<int> bi3pic;
00152 vector<int> flip;
00153 void resize(int i) { flip.resize(i); bi3pic.resize(i); images.resize(i); };
00154 } weatherPicture [cwettertypennum];
00155
00157 void display ( Surface& surface, const SPoint& pos ) const ;
00158 void display ( Surface& surface, const SPoint& pos, int dir, int weather = 0 ) const;
00159
00161 const Surface& getPicture ( int i = 0, int weather = 0 ) const;
00162
00164 bool buildable ( tfield* fld ) const;
00165
00167 void read ( tnstream& stream );
00169 void write ( tnstream& stream ) const;
00170
00172 void runTextIO ( PropertyContainer& pc );
00173
00175 int displayMethod;
00176
00178 int getEffectiveHeight() const;
00179
00181 double growthRate;
00182
00184 bool growOnUnits;
00185
00187 int lifetime;
00188
00191 int growthDuration;
00192
00193
00194 int getMemoryFootprint() const;
00195 protected:
00196 int getWeather( int weather ) const;
00197
00198 private:
00200 void setupImages();
00201 };
00202
00203
00204
00205 const int objectDisplayingMethodNum = 5;
00206
00207 namespace ForestCalculation {
00209 extern void smooth ( int what, GameMap* gamemap, ObjectType* woodObj );
00210 };
00211
00212
00213 #endif