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

vehicletype.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           vehicletype.h  -  description
00003                              -------------------
00004     begin                : Fri Sep 29 2000
00005     copyright            : (C) 2000 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef vehicletypeH
00019  #define vehicletypeH
00020 
00021  #include "typen.h"
00022  #include "containerbase.h"
00023  #include "ascstring.h"
00024  #include "baseaiinterface.h"
00025  #include "terraintype.h"
00026  #include "research.h"
00027  #include "playercolor.h"
00028  
00029 /*
00031 extern const char*  cvehiclefunctions[];
00032  #define cfsonar 1
00033  #define cfparatrooper 2
00034  #define cfminenleger 4
00035  #define cfrepair 16
00036  #define cf_conquer 32
00037  #define cf_moveafterattack 64
00038  #define cfsatellitenview 128
00039  #define cfputbuilding 256
00040  #define cfmineview 512
00041  #define cfvehicleconstruction 1024
00042  #define cfspecificbuildingconstruction 2048
00043  #define cffuelref 4096
00044  #define cficebreaker 8192
00045  #define cfnoairrefuel 16384
00046  #define cfmaterialref 32768
00047  #define cffahrspur ( 1 << 17 )
00048  #define cfmanualdigger ( 1 << 18 )
00049  #define cfno_reactionfire ( 1 << 19 )
00050  #define cfautorepair ( 1 << 20 )
00051  #define cfgenerator ( 1 << 21 )
00052  #define cfautodigger ( 1 << 22 )
00053  #define cfkamikaze ( 1 << 23 )
00054  #define cfmineimmune ( 1 << 24 )
00055  #define cfenergyref ( 1 << 25 )
00056  #define cfownFieldJamming ( 1 << 26 )
00057  #define cfmovewithRF ( 1 << 27 )
00058  #define cfonlytransmove ( 1 << 28 )
00059 
00060  #define cfvehiclefunctionsanzeige 0xFFFFFFFF
00061 */
00062 
00063 #define cwaffentypennum 13
00064  extern const char*  cwaffentypen[cwaffentypennum] ;
00065  #define cwcruisemissile 0
00066  #define cwcruisemissileb ( 1 << cwcruisemissile )
00067  #define cwminen 1
00068  #define cwmineb ( 1 << cwminen   )
00069  #define cwbombn 2
00070  #define cwbombb ( 1 << cwbombn  )
00071  #define cwlargemissilen 3
00072  #define cwlargemissileb ( 1 << cwlargemissilen  )
00073  #define cwsmallmissilen 4
00074  #define cwsmallmissileb ( 1 << cwsmallmissilen  )
00075  #define cwtorpedon 5
00076  #define cwtorpedob ( 1 << cwtorpedon  )
00077  #define cwmachinegunn 6
00078  #define cwmachinegunb ( 1 << cwmachinegunn )
00079  #define cwcannonn 7
00080  #define cwcannonb ( 1 << cwcannonn )
00081  #define cwweapon ( cwcruisemissileb | cwbombb | cwlargemissileb | cwsmallmissileb | cwtorpedob | cwmachinegunb | cwcannonb | cwlaserb )
00082  #define cwshootablen 11
00083  #define cwshootableb ( 1 << cwshootablen  )
00084  #define cwlasern 10
00085  #define cwlaserb ( 1 << cwlasern  )
00086  #define cwammunitionn 9
00087  #define cwammunitionb ( 1 << cwammunitionn )
00088  #define cwservicen 8
00089  #define cwserviceb ( 1 << cwservicen )
00090  #define cwobjectplacementn 12
00091  #define cwobjectplacementb ( 1 << cwobjectplacementn )
00092  extern const int cwaffenproduktionskosten[cwaffentypennum][3];  /*  Angabe: Waffentyp; energy - Material - Sprit ; jeweils fuer 5er Pack */
00093 
00094 
00095  extern const bool weaponAmmo[cwaffentypennum];
00096 
00097 
00098 
00100  class SingleWeapon {
00101      int          typ;
00102     public:
00103      SingleWeapon ();
00105      int          targ;
00106 
00108      int          sourceheight;
00109 
00111      int          maxdistance;
00112 
00114      int          mindistance;
00115 
00117      int          count;
00118 
00120      int          maxstrength;
00121 
00123      int          minstrength;
00124 
00132      int          efficiency[13];
00133 
00137      int          targetingAccuracy[cmovemalitypenum];
00138 
00140      int          laserRechargeRate;
00141 
00143      Resources    laserRechargeCost;
00144 
00145      int          reactionFireShots;
00146 
00147      ASCString    soundLabel;
00148 
00149      ASCString    name;
00150 
00151      int          getScalarWeaponType(void) const;
00152      bool         requiresAmmo(void) const;
00153      bool         shootable( void ) const;
00154      bool         service( void ) const;
00155      bool         placeObjects() const;
00156      bool         canRefuel ( void ) const;
00157      void         set ( int type );  // will be enhanced later ...
00158      int          gettype ( void ) const { return typ; };
00159      bool         offensive( void ) const;
00160      ASCString    getName ( void ) const;
00161      static ASCString   getIconFileName( int weaponType );
00162      void         runTextIO ( PropertyContainer& pc );
00163      bool         equals( const SingleWeapon* otherWeapon ) const;
00164  };
00165 
00167  class  UnitWeapon {
00168    public:
00169      int count;
00170      SingleWeapon weapon[16];
00171      UnitWeapon ( void );
00172  };
00173 
00174  class Player;
00175 
00177  class Vehicletype : public ContainerBaseType {
00179         Surface  image;
00180     public:
00181         static const int legacyVehicleFunctionNum = 29;
00182         
00184         ASCString    description;
00185 
00186         ASCString    getName() const;
00187 
00188         int armor;
00189 
00190         
00192         int          height;
00193 
00195         double     cargoMovementDivisor;
00196 
00198         bool         wait;
00199 
00201         int          fuelConsumption;
00202 
00204         vector<int>  movement;
00205 
00207         int          movemalustyp;
00208 
00210         int          maxwindspeedonwater;
00211 
00213         int          digrange;
00214 
00216         int          initiative;
00217 
00219         int           weight;
00220 
00222         TerrainAccess terrainaccess;
00223 
00225         int           bipicture;
00226 
00228         vector<IntRange> buildingsBuildable;
00229 
00231         vector<IntRange> vehiclesBuildable;
00232 
00234         vector<IntRange> objectsBuildable;
00235 
00237         vector<IntRange> objectsRemovable;
00238 
00240         vector<IntRange> objectGroupsBuildable;
00241 
00243         vector<IntRange> objectGroupsRemovable;
00244 
00246         vector<IntRange> objectLayedByMovement;
00247 
00249         UnitWeapon   weapons;
00250 
00252         int          autorepairrate;
00253 
00255         int  unitConstructionMoveCostPercentage;
00256         
00258         vector<int> wreckageObject;
00259 
00261         mutable AiValue* aiparam[8];
00262 
00264         AiParameter::Job recommendedAIJob;
00265 
00267         int maxsize   ( void ) const ;
00268 
00270         ASCString    movementSoundLabel;
00271 
00273         ASCString    killSoundLabel;
00274 
00275         vector<int> guideSortHelp;
00276 
00277         int heightChangeMethodNum;
00278         class HeightChangeMethod{
00279             public:
00280               int startHeight;
00281               int heightDelta;
00282               int moveCost;
00283               bool canAttack;
00284               int dist;
00285 
00286               void runTextIO ( PropertyContainer& pc );
00287               void read ( tnstream& stream ) ;
00288               void write ( tnstream& stream ) const ;
00289         };
00290         vector<HeightChangeMethod> heightChangeMethod;
00291 
00292         int maxSpeed ( ) const;
00293 
00294         Vehicletype ( void );
00295         void read ( tnstream& stream ) ;
00296         void write ( tnstream& stream ) const ;
00297         void runTextIO ( PropertyContainer& pc );
00298         ~Vehicletype ( );
00299         Resources calcProductionsCost();
00300 
00301         int getMoveMalusType() const {
00302            return movemalustyp;
00303         }
00304 
00305         struct JumpDrive {
00306            JumpDrive() : height(0), maxDistance(maxint) {};
00308            int height; 
00309            Resources consumption;
00310            TerrainAccess targetterrain;
00311            int maxDistance;
00312         } jumpDrive;
00313            
00314         
00315         
00316         void  paint ( Surface& s, SPoint pos, const PlayerColor& player, int direction = 0 ) const;
00317         void  paint ( Surface& s, SPoint pos ) const;
00318         const Surface&  getImage () const { return image;};
00319         Surface&  getImage () { return image;};
00320         
00321         int getMemoryFootprint() const;
00322 
00323         static BitSet convertOldFunctions( int abilities, const ASCString& location );
00324     private:
00325         void setupRemovableObjectsFromOldFileLayout();
00326  };
00327 
00328 
00329 extern ASCString getUnitReference ( Vehicle* veh );
00330 
00331 #endif
00332 
00333 
00334 

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