File: BuildUp.h

package info (click to toggle)
spring 106.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 55,260 kB
  • sloc: cpp: 543,946; ansic: 44,800; python: 12,575; java: 12,201; awk: 5,889; sh: 1,796; asm: 1,546; xml: 655; perl: 405; php: 211; objc: 194; makefile: 76; sed: 2
file content (99 lines) | stat: -rw-r--r-- 1,446 bytes parent folder | download | duplicates (6)
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
#ifndef KAIK_BUILDUP_HDR
#define KAIK_BUILDUP_HDR

#include "Defines.h"
struct AIClasses;

enum BuildState {
	BUILD_INIT,
	BUILD_NUKE,
	BUILD_M_STALL,
	BUILD_E_STALL,
	BUILD_E_EXCESS,
	BUILD_DEFENSE,
	BUILD_FACTORY
};

struct EconState {
	float mIncome;
	float eIncome;
	float mLevel;
	float eLevel;
	float mStorage;
	float eStorage;
	float mUsage;
	float eUsage;
	bool makersOn;

	float m1;
	float m2;
	float e1;
	float e2;

	bool mLevel50;
	bool eLevel50;
	bool eLevel80;

	bool mStall;
	bool eStall;
	bool mOverflow;

	bool eLevelMed;
	bool mLevelLow;

	bool factFeasM;
	bool factFeasE;
	bool factFeas;

	bool b1;
	bool b2;
	bool b3;

	bool buildNukeSilo;

	int numM;
	int numE;

	int numDefenses;
	int numFactories;

	int nIdleBuilders;
	int builderID;
	const UnitDef* builderDef;
	const UnitDef* factoryDef;
};

class CBuildUp {
	public:
		CR_DECLARE(CBuildUp)

		CBuildUp(AIClasses* ai);
		~CBuildUp();

		void Update(int);

	private:
		BuildState GetBuildState(int, const EconState*) const;
		void GetEconState(EconState*) const;

		void Buildup(int);
		void FactoryCycle(int);
		void NukeSiloCycle(void);
		void FallbackBuild(int, int);
		bool BuildNow(int, UnitCategory, const UnitDef*);
		const UnitDef* GetLeastBuiltBuilder(void);
		bool BuildUpgradeExtractor(int);
		bool BuildUpgradeReactor(int);

		int factoryTimer;
		int builderTimer;
		int storageTimer;
		int nukeSiloTimer;

		EconState econState;

		AIClasses* ai;
};


#endif