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

containerbase-functions.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  ***************************************************************************/
00009 
00010 #ifndef containerbasefunctionsH
00011  #define containerbasefunctionsH
00012 
00013  #include <sigc++/sigc++.h>
00014 
00015  #include "typen.h"
00016  #include "containerbase.h"
00017  #include "graphics/surface.h"
00018  #include "mapalgorithms.h"
00019 
00020 
00021 class AutoHarvestObjects : public ContainerBase::Work
00022 {
00023       ContainerBase* base;
00024       Resources harvested;
00025       Resources cost;
00026                         bool justQuery;
00027                         bool hasRun;
00028          int fieldCounter;
00029          
00030       void harvestObject( const MapCoordinate& pos, const ObjectType* obj );
00031       void processField( const MapCoordinate& pos );
00032       void iterateField( const MapCoordinate& pos );
00033       bool harvestOnPosition( const MapCoordinate& pos );
00034 
00035    public:
00036       AutoHarvestObjects( ContainerBase* _bld, bool justQuery_ ) ;
00037       virtual bool finished();
00038       virtual bool run();
00039       virtual Resources getPlus();
00040       virtual Resources getUsage();
00041 };
00042 
00043 class MatterConverter : public ContainerBase::Work
00044 {
00045       ContainerBase* bld;
00046       int percentage;
00047    public:
00048       MatterConverter( ContainerBase* _bld ) ;
00049       virtual bool finished();
00050       virtual bool run();
00051       virtual Resources getPlus();
00052       virtual Resources getUsage();
00053 };
00054 
00055 
00056 class ResourceSink : public ContainerBase::Work
00057 {
00058    ContainerBase* bld;
00059    Resources toGet;
00060    public:
00061       ResourceSink( ContainerBase* _bld ) ;
00062       virtual bool finished();
00063       virtual bool run();
00064       virtual Resources getPlus();
00065       virtual Resources getUsage();
00066 };
00067 
00068 class RegenerativePowerPlant : public ContainerBase::Work
00069 {
00070    protected:
00071       ContainerBase* bld;
00072       Resources toProduce;
00073    public:
00074       RegenerativePowerPlant( ContainerBase* _bld ) ;
00075       virtual bool finished();
00076       virtual bool run();
00077       virtual Resources getUsage();
00078 };
00079 
00080 class WindPowerplant : public RegenerativePowerPlant
00081 {
00082    public:
00083       WindPowerplant( ContainerBase* _bld ) : RegenerativePowerPlant ( _bld )
00084       {
00085          toProduce = getPlus();
00086       };
00087       virtual Resources getPlus();
00088 };
00089 
00090 class SolarPowerplant : public RegenerativePowerPlant
00091 {
00092    public:
00093       SolarPowerplant( ContainerBase* _bld ) : RegenerativePowerPlant ( _bld )
00094       {
00095          toProduce = getPlus();
00096       };
00097       virtual Resources getPlus();
00098 };
00099 
00100 class BiResourceGeneration: public RegenerativePowerPlant
00101 {
00102    public:
00103       BiResourceGeneration ( ContainerBase* bld_ ) : RegenerativePowerPlant ( bld_ )
00104       {
00105          toProduce = getPlus();
00106       };
00107       virtual Resources getPlus();
00108 };
00109 
00110 class MiningStation : public ContainerBase::Work, protected SearchFields
00111 {
00112    ContainerBase* bld;
00113    bool justQuery;
00114    bool hasRun;
00115    Resources toExtract_thisTurn;
00116    Resources spaceAvail;
00117    Resources powerAvail;
00118    Resources actuallyExtracted; // with increasing distance this gets lower and lower
00119 
00120    float consumed[3];
00121    float usageRatio[3];
00122    protected:
00123       void testfield ( const MapCoordinate& mc );
00124    public:
00125       MiningStation( ContainerBase* _bld, bool justQuery_ ) ;
00126       virtual bool finished();
00127       virtual bool run();
00128       virtual Resources getPlus();
00129       virtual Resources getUsage();
00130 };
00131 
00132 
00134 class GetMiningInfo : public SearchFields {
00135       const ContainerBase* miningStation;
00136       void run();
00137    protected:
00138       void testfield ( const MapCoordinate& mc );
00139    public:
00140       class MiningInfo {
00141          public:
00142             MiningInfo ( );
00143             Resources avail[maxminingrange+2];
00144             int efficiency[maxminingrange+2];
00145             Resources max[maxminingrange+2];            // the theoretical maximum of the mineral resources in the given distance
00146             int nextMiningDistance;
00147       };
00148       GetMiningInfo ( const ContainerBase* container );
00149       const MiningInfo& getMiningInfo() {return miningInfo; };
00150 //      void run ( const ContainerBase* bld );
00151    protected:
00152       MiningInfo miningInfo;
00153 };
00154 
00155 
00156 #endif

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