Advanced Strategic Command
resourceplacement.h
Go to the documentation of this file.
1 //
2 // C++ Interface: resourceplacement
3 //
4 // Description:
5 //
6 //
7 // Author: Martin Bickel <bickel@asc-hq.org>, (C) 2004
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 #ifndef RESOURCEPLACEMENT_H
13 #define RESOURCEPLACEMENT_H
14 
15 #include <list>
16 #include "gamemap.h"
17 
22 struct Rect {
23  MapField *a, *b, *c, *d;
24 
25 };
26 
27 typedef list<Rect> RectList;
34 private:
35  GameMap& map;
36  double fuelRoughness;
37  double materialRoughness;
38  bool placeFuel;
39  bool placeMaterial;
40  unsigned short maxFuelOffset;
41  unsigned short maxMaterialOffset;
42  int additionalResourceFreeFieldsPercentageFuel;
43  int additionalResourceFreeFieldsPercentageMaterial;
44 
45  int stepCount;
46 
47  unsigned short createRandomValue(int limit);
48  short createAlgebraicSign();
49 
50  void setFieldValueFuel(MapField* f);
51  void setFieldValueMaterial(MapField* f);
52  int calculateCornerValueFuel(MapField* a, MapField* b, MapField* c);
53  int calculateDiamondValueFuel(MapField* a, MapField* b, MapField* c, MapField* d);
54  int calculateCornerValueMaterial(MapField* a, MapField* b, MapField* c);
55  int calculateDiamondValueMaterial(MapField* a, MapField* b, MapField* c, MapField* d);
56  MapField* calculateCornerPoint(MapField* a, MapField* b, MapField* c);
57  MapField* calculateDiamondPoint(MapField* a, MapField* b, MapField* c, MapField* d);
58  int calculateCurrentOffset(int offset);
59  void step(Rect r);
60  void runDS();
61 
62 public:
73  ResourcePlacement(GameMap& map, double fuelRoughness, double materialRoughness, unsigned short maxFuelOffSet, unsigned short maxMaterialOffSet,
74  int additionalFreeFieldsPercFuel = 0, int additionalFreeFieldsPercMaterial = 0);
82  void placeResources();
86  void placeFuelResources();
91 
92  static const int MAXFUELVALUE;
93  static const int MINFUELVALUE;
94  static const int MAXMATERIALVALUE;
95  static const int MINMATERIALVALUE;
96 
97 };
98 
99 #endif
100 
101 
void placeResources()
Fills the map with all resources.
static const int MAXFUELVALUE
MapField * d
ResourcePlacement(GameMap &map, double fuelRoughness, double materialRoughness, unsigned short maxFuelOffSet, unsigned short maxMaterialOffSet, int additionalFreeFieldsPercFuel=0, int additionalFreeFieldsPercMaterial=0)
Constructor.
MapField * c
static const int MAXMATERIALVALUE
a single field of the map
Definition: mapfield.h:26
list< Rect > RectList
static const int MINMATERIALVALUE
void placeFuelResources()
Fills the map only with fuel resources.
MapField * b
Definition of THE central asc class: GameMap.
~ResourcePlacement()
Destructor.
void placeMaterialResources()
Fills the map only with material resources.
MapField * a
static const int MINFUELVALUE
Fills a map with resources using the diamond-square algorithm.
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182