containerbasetype.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           containerbasetype.h  -  description
00003                              -------------------
00004     begin                : Sun Feb 18 2001
00005     copyright            : (C) 2001 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 containerbasetypeH
00019  #define containerbasetypeH
00020 
00021  #include "objects.h"
00022  #include "typen.h"
00023  #include "research.h"
00024  #include "mapitemtype.h"
00025  #include "memsize_interface.h"
00026 
00027 class ContainerBaseType: public MapItemType, public LoadableItemType, public MemorySizeQueryInterface {
00028    protected:
00029       std::bitset<64> features;
00030    public:
00031      ContainerBaseType ();
00032 
00033      enum ContainerFunctions { TrainingCenter,
00034         InternalVehicleProduction,
00035         AmmoProduction,
00036         InternalUnitRepair,
00037         RecycleUnits,
00038         Research,
00039         Sonar,
00040         SatelliteView,
00041         MineView,
00042         WindPowerPlant,
00043         SolarPowerPlant,
00044         MatterConverter,
00045         MiningStation,
00046         ProduceNonLeavableUnits,
00047         ResourceSink,
00048         ExternalEnergyTransfer,
00049         ExternalMaterialTransfer,
00050         ExternalFuelTransfer,
00051         ExternalAmmoTransfer,
00052         ExternalRepair,
00053         NoObjectChaining,
00054         SelfDestructOnConquer,
00055         Paratrooper,
00056         PlaceMines,
00057         CruiserLanding,
00058         ConquerBuildings,
00059         MoveAfterAttack,
00060         ExternalVehicleProduction,
00061         ConstructBuildings,
00062         IceBreaker,
00063         NoInairRefuelling,
00064         MakesTracks,
00065         DetectsMineralResources,
00066         NoReactionfire,
00067         AutoRepair,
00068         KamikazeOnly,
00069         ImmuneToMines,
00070         JamsOnlyOwnField,
00071         MoveWithReactionFire,
00072         OnlyMoveToAndFromTransports,
00073         AutoHarvestObjects,
00074         NoProductionCustomization,
00075         ManualSelfDestruct,
00076         NoMineRemoval };
00077 
00078      
00079      static const int functionNum = 44;
00080 
00081      bool hasFunction( ContainerFunctions function ) const;
00082      bool hasAnyFunction( std::bitset<64> functions ) const;
00083      static const char* getFunctionName( ContainerFunctions function );
00084 
00085    protected:
00086       void setFunction( ContainerFunctions function );
00087    public:
00088      
00089      int id;
00090 
00092      vector<int> secondaryIDs;
00093 
00094 
00096      ASCString    name;
00097 
00099      ASCString    description;
00100      
00101      ASCString getName() const { return name; };
00102      int getID() const { return id; };
00103      
00104      
00106      ASCString    infotext;
00107 
00109      int          jamming;
00110 
00112      int          view;
00113 
00115      int          height;
00116      int getHeight() const { return height; };
00117 
00118      Resources productionCost;
00119      virtual ~ContainerBaseType() {};
00120 
00122      int maxLoadableUnits;
00123 
00125      int maxLoadableUnitSize;
00126 
00128      int maxLoadableWeight;
00129 
00131      int vehicleCategoriesStorable;
00132 
00134      int vehicleCategoriesProduceable;
00135 
00138      vector<IntRange> vehiclesInternallyProduceable;
00139 
00140      class TransportationIO {
00141          public:
00142             TransportationIO ();
00143             static const int entranceModeNum = 3;
00144             enum { In = 1, Out = 2, Docking = 4 };
00145             int mode;
00146 
00147             // int functionbits
00148 
00150             int height_abs;
00151 
00153             int height_rel;
00154 
00156             int container_height;
00157 
00159             int vehicleCategoriesLoadable;
00160 
00161             int dockingHeight_abs;
00162 
00163             int dockingHeight_rel;
00164 
00165             std::bitset<64> requiresUnitFeature;
00166 
00167             int movecost;
00168 
00169             bool disableAttack;
00170 
00171             void runTextIO ( PropertyContainer& pc );
00172             void read ( tnstream& stream ) ;
00173             void write ( tnstream& stream ) const ;
00174      };
00175 
00176      typedef vector<TransportationIO> EntranceSystems;
00177      EntranceSystems   entranceSystems;
00178 
00179      TechAdapterDependency techDependency;
00180 
00182      ASCString infoImageFilename;
00183      ASCString infoImageSmallFilename;
00184 
00185      void runTextIO ( PropertyContainer& pc );
00186 
00188      bool vehicleFit ( const VehicleType* type ) const ;
00189 
00195      int  vehicleUnloadable ( const VehicleType* vehicleType, int carrierHeight ) const;
00196 
00197 
00198      void read ( tnstream& stream ) ;
00199      void write ( tnstream& stream ) const ;
00200 
00201      
00202 
00204      int          efficiencyfuel;
00205 
00207      int          efficiencymaterial;
00208 
00210      int          maxresearchpoints;
00211 
00213      int          defaultMaxResearchpoints;
00214 
00216      int          nominalresearchpoints;
00217 
00220      int  minFieldRepairDamage;
00221      
00222      Resources    maxplus;
00223 
00225      Resources    defaultProduction;
00226 
00227      virtual int getMoveMalusType() const = 0;
00228      
00232      Resources   getStorageCapacity( int mode ) const;
00233    protected:
00234      Resources    asc_mode_tank;
00235      Resources    bi_mode_tank;
00236      
00237    public:
00238 
00239       ResourceMatrix productionEfficiency;
00240       
00241       struct {
00242          int range;
00243          
00244          int maxFieldsPerTurn;
00245          
00247         vector<IntRange> objectsHarvestable;
00248 
00250         vector<IntRange> objectGroupsHarvestable;
00251       } autoHarvest;
00252      
00253  };
00254 
00255 #endif

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