File: GameMap.hpp

package info (click to toggle)
spring 104.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 47,512 kB
  • sloc: cpp: 391,093; ansic: 79,943; python: 12,356; java: 12,201; awk: 5,889; sh: 1,826; xml: 655; makefile: 486; perl: 405; php: 211; objc: 194; sed: 2
file content (62 lines) | stat: -rw-r--r-- 1,617 bytes parent folder | download | duplicates (4)
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
#ifndef GAME_MAP
#define GAME_MAP

#include <list>

#include "System/float3.h"

// heightVariance(Altair_Crossing.smf)
#define KBOT_VEH_THRESHOLD 43.97f

class CGroup;
class AIClasses;

class GameMap {

public:
	GameMap(AIClasses*);

	static std::list<float3> metalspots;
	static std::list<float3> geospots;
	static std::list<float3> metalfeatures; // not used yet
	static std::list<float3> energyfeatures; // not used yet

	/** @return float, height variance */
	float GetHeightVariance() { return heightVariance; }
	/** @return float, amount of water in [0, 1] */
	float GetAmountOfWater() { return waterAmount; }
	/** @return float, amount of land in [0, 1] */
	float GetAmountOfLand() { return (1.0f - waterAmount); }

	bool HasGeoSpots() { return geospots.size() > 0; }
	bool HasMetalFeatures() { return metalfeatures.size() > 0; }
	bool HasEnergyFeatures() { return energyfeatures.size() > 0; }

	bool IsKbotMap() { return heightVariance > KBOT_VEH_THRESHOLD; }
	bool IsVehicleMap() { return !IsKbotMap(); }
	bool IsHooverMap() { return waterAmount > 0.2f; }
	bool IsWaterMap() { return waterAmount > 0.7f; }
	bool IsWaterFreeMap() { return waterAmount < 0.15f; }
	bool IsLandFreeMap() { return waterAmount > 0.9f; }
	bool IsMetalMap() { return metalCount > nonMetalCount && avgMetal > 80; }
	bool IsMetalFreeMap() { return metalCount == 0; }

protected:
    AIClasses* ai;

private:
	float heightVariance;
	float waterAmount;
	int metalCount;
	int nonMetalCount;
	int minMetal;
	int maxMetal;
	int avgMetal;
	bool debug;

	void CalcMetalSpots();
	void CalcGeoSpots();
	void CalcMapHeightFeatures();
};

#endif