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 weaponTypeNum 13
00064  extern const char*  cwaffentypen[weaponTypeNum] ;
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 ammoProductionCost[weaponTypeNum][3];  /*  Angabe: Waffentyp; energy - Material - Sprit ; jeweils fuer 5er Pack */
00093 
00094 
00095  extern const bool weaponAmmo[weaponTypeNum];
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         
00182         ASCString imageFilename;
00183         
00184     public:
00185         static const int legacyVehicleFunctionNum = 29;
00186         
00187         ASCString    getName() const;
00188 
00189         int armor;
00190 
00192         double     cargoMovementDivisor;
00193 
00195         bool         wait;
00196 
00198         int          fuelConsumption;
00199 
00201         vector<int>  movement;
00202 
00204         int          movemalustyp;
00205 
00207         int          maxwindspeedonwater;
00208 
00210         int          digrange;
00211 
00213         int          initiative;
00214 
00216         int           weight;
00217 
00219         TerrainAccess terrainaccess;
00220 
00222         int           bipicture;
00223 
00225         vector<IntRange> buildingsBuildable;
00226 
00228         vector<IntRange> vehiclesBuildable;
00229 
00231         vector<IntRange> objectsBuildable;
00232 
00234         vector<IntRange> objectsRemovable;
00235 
00237         vector<IntRange> objectGroupsBuildable;
00238 
00240         vector<IntRange> objectGroupsRemovable;
00241 
00243         vector<IntRange> objectLayedByMovement;
00244 
00246         UnitWeapon   weapons;
00247 
00249         int          autorepairrate;
00250 
00252         int  unitConstructionMoveCostPercentage;
00253         
00255         int unitConstructionMinDistance;
00257         int unitConstructionMaxDistance;
00258         
00260         vector<int> wreckageObject;
00261 
00263         mutable AiValue* aiparam[8];
00264 
00266         AiParameter::Job recommendedAIJob;
00267 
00269         int maxsize   ( void ) const ;
00270 
00272         ASCString    movementSoundLabel;
00273 
00275         ASCString    killSoundLabel;
00276 
00277         vector<int> guideSortHelp;
00278 
00279         int heightChangeMethodNum;
00280         class HeightChangeMethod{
00281             public:
00282               int startHeight;
00283               int heightDelta;
00284               int moveCost;
00285               bool canAttack;
00286               int dist;
00287 
00288               void runTextIO ( PropertyContainer& pc );
00289               void read ( tnstream& stream ) ;
00290               void write ( tnstream& stream ) const ;
00291         };
00292         vector<HeightChangeMethod> heightChangeMethod;
00293 
00294         int maxSpeed ( ) const;
00295 
00296         VehicleType ( void );
00297         void read ( tnstream& stream ) ;
00298         void write ( tnstream& stream ) const ;
00299         void runTextIO ( PropertyContainer& pc );
00300         ~VehicleType ( );
00301         Resources calcProductionCost();
00302 
00303         int getMoveMalusType() const {
00304            return movemalustyp;
00305         }
00306 
00307         struct JumpDrive {
00308            JumpDrive() : height(0), maxDistance(maxint) {};
00310            int height; 
00311            Resources consumption;
00312            TerrainAccess targetterrain;
00313            int maxDistance;
00314         } jumpDrive;
00315            
00316         
00317         
00318         void  paint ( Surface& s, SPoint pos, const PlayerColor& player, int direction = 0 ) const;
00319         void  paint ( Surface& s, SPoint pos ) const;
00320         const Surface&  getImage () const { return image;};
00321         Surface&  getImage () { return image;};
00322         
00323         int getMemoryFootprint() const;
00324 
00325         static BitSet convertOldFunctions( int abilities, const ASCString& location );
00326     private:
00327         void setupRemovableObjectsFromOldFileLayout();
00328         ASCString costCalculator;
00329  };
00330 
00331 
00332 extern ASCString getUnitReference ( Vehicle* veh );
00333 
00334 #endif
00335 
00336 
00337 

Generated on Mon May 21 01:26:39 2012 for Advanced Strategic Command by  doxygen 1.5.1