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
00038 vector<int> secondaryIDs;
00039
00041 int groupID;
00042
00044 BitSet weather;
00045
00047 bool visibleago;
00048
00050 vector<IntRange> linkableObjects;
00051
00053 vector<IntRange> linkableTerrain;
00054
00056 int armor;
00057
00058 struct FieldModification {
00059 FieldModification();
00060
00062 TerrainType::MoveMalus movemalus_plus;
00063
00065 TerrainType::MoveMalus movemalus_abs;
00066
00068 TerrainAccess terrainaccess;
00069
00071 TerrainBits terrain_and;
00072 TerrainBits terrain_or;
00073 void runTextIO ( PropertyContainer& pc );
00074 } fieldModification[cwettertypennum];
00075
00076 const FieldModification& getFieldModification( int weather ) const;
00077
00079 int attackbonus_plus;
00081 int attackbonus_abs;
00082
00084 int defensebonus_plus;
00086 int defensebonus_abs;
00087
00089 int basicjamming_plus;
00091 int basicjamming_abs;
00092
00094 int viewbonus_plus;
00096 int viewbonus_abs;
00097
00098
00099
00101 int imageHeight;
00102
00104 int physicalHeight;
00105
00107 Resources buildcost;
00108
00110 Resources removecost;
00111
00113 int build_movecost;
00114
00116 int remove_movecost;
00117
00119 bool canExistBeneathBuildings;
00120
00122 ASCString name;
00123
00124 ASCString getName() const { return name; };
00125
00126 enum NamingMethod { ReplaceTerrain, AddToTerrain, UnNamed };
00127 int namingMethod;
00128 static const char* namingMethodNames[];
00129 static const int namingMethodNum;
00130
00131 int getID() const { return id; };
00132
00133
00134 static const int netBehaviourNum = 7;
00135 enum NetBehaviour { NetToBuildings = 1, NetToBuildingEntry = 2, NetToSelf = 4, NetToBorder = 8, SpecialForest = 0x10, AutoBorder = 0x20, KeepOrientation = 0x40 };
00136
00138 int netBehaviour;
00139
00140 ObjectType ( void );
00141
00142 TechAdapterDependency techDependency;
00143
00144 const OverviewMapImage* getOverviewMapImage( int picnum, int weather ) const ;
00145
00147 struct WeatherPicture {
00148 mutable vector<OverviewMapImage> overviewMapImage;
00149 vector<Surface> images;
00150 vector<int> bi3pic;
00151 vector<int> flip;
00152 void resize(int i) { flip.resize(i); bi3pic.resize(i); images.resize(i); };
00153 ASCString originalFilename;
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 ( MapField* 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