Advanced Strategic Command
containerbase-functions.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * This program is free software; you can redistribute it and/or modify *
4  * it under the terms of the GNU General Public License as published by *
5  * the Free Software Foundation; either version 2 of the License, or *
6  * (at your option) any later version. *
7  * *
8  ***************************************************************************/
9 
10 #ifndef containerbasefunctionsH
11  #define containerbasefunctionsH
12 
13  #include <sigc++/sigc++.h>
14 
15  #include "typen.h"
16  #include "containerbase.h"
17  #include "graphics/surface.h"
18  #include "mapalgorithms.h"
19 
20 
22 {
23  ContainerBase* base;
24  Resources harvested;
25  Resources cost;
26  bool justQuery;
27  bool hasRun;
28  int fieldCounter;
29 
30  void harvestObject( const MapCoordinate& pos, const ObjectType* obj );
31  void processField( const MapCoordinate& pos );
32  void iterateField( const MapCoordinate& pos );
33  bool harvestOnPosition( const MapCoordinate& pos );
34 
35  public:
36  AutoHarvestObjects( ContainerBase* _bld, bool justQuery_ ) ;
37  virtual bool finished();
38  virtual bool run();
39  virtual Resources getPlus();
40  virtual Resources getUsage();
41 };
42 
44 {
45  ContainerBase* bld;
46  int percentage;
47  public:
49  virtual bool finished();
50  virtual bool run();
51  virtual Resources getPlus();
52  virtual Resources getUsage();
53 };
54 
55 
57 {
58  ContainerBase* bld;
59  Resources toGet;
60  public:
61  ResourceSink( ContainerBase* _bld ) ;
62  virtual bool finished();
63  virtual bool run();
64  virtual Resources getPlus();
65  virtual Resources getUsage();
66 };
67 
69 {
70  protected:
73  public:
75  virtual bool finished();
76  virtual bool run();
77  virtual Resources getUsage();
78 };
79 
81 {
82  public:
84  {
85  toProduce = getPlus();
86  };
87  virtual Resources getPlus();
88 };
89 
91 {
92  public:
94  {
95  toProduce = getPlus();
96  };
97  virtual Resources getPlus();
98 };
99 
101 {
102  public:
104  {
105  toProduce = getPlus();
106  };
107  virtual Resources getPlus();
108 };
109 
111 {
112  ContainerBase* bld;
113  bool justQuery;
114  bool hasRun;
115  Resources toExtract_thisTurn;
116  Resources spaceAvail;
117  Resources powerAvail;
118  Resources actuallyExtracted; // with increasing distance this gets lower and lower
119 
120  float consumed[3];
121  float usageRatio[3];
122  protected:
123  void testfield ( const MapCoordinate& mc );
124  public:
125  MiningStation( ContainerBase* _bld, bool justQuery_ ) ;
126  virtual bool finished();
127  virtual bool run();
128  virtual Resources getPlus();
129  virtual Resources getUsage();
130 };
131 
132 
134 class GetMiningInfo : public SearchFields {
135  const ContainerBase* miningStation;
136  void run();
137  protected:
138  void testfield ( const MapCoordinate& mc );
139  public:
140  class MiningInfo {
141  public:
142  MiningInfo ( );
145  Resources max[maxminingrange+2]; // the theoretical maximum of the mineral resources in the given distance
147  };
148  GetMiningInfo ( const ContainerBase* container );
149  const MiningInfo& getMiningInfo() {return miningInfo; };
150 // void run ( const ContainerBase* bld );
151  protected:
152  MiningInfo miningInfo;
153 };
154 
155 
156 #endif
calculates some mining statistics for a mining station
AutoHarvestObjects(ContainerBase *_bld, bool justQuery_)
The base class for buildings and vehicles.
BiResourceGeneration(ContainerBase *bld_)
virtual Resources getPlus()
int efficiency[maxminingrange+2]
void testfield(const MapCoordinate &mc)
WindPowerplant(ContainerBase *_bld)
Resources max[maxminingrange+2]
RegenerativePowerPlant(ContainerBase *_bld)
virtual Resources getPlus()
virtual Resources getPlus()
MatterConverter(ContainerBase *_bld)
const int maxminingrange
The maximum number of fields a mining station can extract mineral resources from; Counted from its en...
Definition: typen.h:542
virtual Resources getPlus()
An object that can be placed on fields. Roads, pipelines and ditches are examples of objects...
Definition: objecttype.h:30
Coordinate on the twodimensional map.
Definition: typen.h:202
SolarPowerplant(ContainerBase *_bld)
const MiningInfo & getMiningInfo()
searches fields in hexagonal "circles" around a field and calls testfield for each field ...
Definition: mapalgorithms.h:28
virtual Resources getPlus()
virtual Resources getPlus()
virtual Resources getUsage()
ResourceSink(ContainerBase *_bld)
GetMiningInfo(const ContainerBase *container)
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
Resources are basically the currency of ASC.
Definition: typen.h:97
void testfield(const MapCoordinate &mc)
Resources avail[maxminingrange+2]
virtual Resources getUsage()
virtual Resources getUsage()
virtual Resources getUsage()
MiningStation(ContainerBase *_bld, bool justQuery_)