1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef containerbasefunctionsH
#define containerbasefunctionsH
#include <sigc++/sigc++.h>
#include "typen.h"
#include "containerbase.h"
#include "graphics/surface.h"
#include "mapalgorithms.h"
class AutoHarvestObjects : public ContainerBase::Work
{
ContainerBase* base;
Resources harvested;
Resources cost;
bool justQuery;
bool hasRun;
int fieldCounter;
void harvestObject( const MapCoordinate& pos, const ObjectType* obj );
void processField( const MapCoordinate& pos );
void iterateField( const MapCoordinate& pos );
bool harvestOnPosition( const MapCoordinate& pos );
public:
AutoHarvestObjects( ContainerBase* _bld, bool justQuery_ ) ;
virtual bool finished();
virtual bool run();
virtual Resources getPlus();
virtual Resources getUsage();
};
class MatterConverter : public ContainerBase::Work
{
ContainerBase* bld;
int percentage;
public:
MatterConverter( ContainerBase* _bld ) ;
virtual bool finished();
virtual bool run();
virtual Resources getPlus();
virtual Resources getUsage();
};
class ResourceSink : public ContainerBase::Work
{
ContainerBase* bld;
Resources toGet;
public:
ResourceSink( ContainerBase* _bld ) ;
virtual bool finished();
virtual bool run();
virtual Resources getPlus();
virtual Resources getUsage();
};
class RegenerativePowerPlant : public ContainerBase::Work
{
protected:
ContainerBase* bld;
Resources toProduce;
public:
RegenerativePowerPlant( ContainerBase* _bld ) ;
virtual bool finished();
virtual bool run();
virtual Resources getUsage();
};
class WindPowerplant : public RegenerativePowerPlant
{
public:
WindPowerplant( ContainerBase* _bld ) : RegenerativePowerPlant ( _bld )
{
toProduce = getPlus();
};
virtual Resources getPlus();
};
class SolarPowerplant : public RegenerativePowerPlant
{
public:
SolarPowerplant( ContainerBase* _bld ) : RegenerativePowerPlant ( _bld )
{
toProduce = getPlus();
};
virtual Resources getPlus();
};
class BiResourceGeneration: public RegenerativePowerPlant
{
public:
BiResourceGeneration ( ContainerBase* bld_ ) : RegenerativePowerPlant ( bld_ )
{
toProduce = getPlus();
};
virtual Resources getPlus();
};
class MiningStation : public ContainerBase::Work, protected SearchFields
{
ContainerBase* bld;
bool justQuery;
bool hasRun;
Resources toExtract_thisTurn;
Resources spaceAvail;
Resources powerAvail;
Resources actuallyExtracted; // with increasing distance this gets lower and lower
float consumed[3];
float usageRatio[3];
protected:
void testfield ( const MapCoordinate& mc );
public:
MiningStation( ContainerBase* _bld, bool justQuery_ ) ;
virtual bool finished();
virtual bool run();
virtual Resources getPlus();
virtual Resources getUsage();
};
//! calculates some mining statistics for a mining station
class GetMiningInfo : public SearchFields {
const ContainerBase* miningStation;
void run();
protected:
void testfield ( const MapCoordinate& mc );
public:
class MiningInfo {
public:
MiningInfo ( );
Resources avail[maxminingrange+2];
int efficiency[maxminingrange+2];
Resources max[maxminingrange+2]; // the theoretical maximum of the mineral resources in the given distance
int nextMiningDistance;
};
GetMiningInfo ( const ContainerBase* container );
const MiningInfo& getMiningInfo() {return miningInfo; };
// void run ( const ContainerBase* bld );
protected:
MiningInfo miningInfo;
};
#endif
|