1 #ifndef __STRATEGIC_MINES_H
2 #define __STRATEGIC_MINES_H
3 
4 // the .h to the mine management system
5 
6 #include "Types.h"
7 
8 
9 // the mines
10 enum MineID
11 {
12 	MINE_SAN_MONA = 0,
13 	MINE_DRASSEN,
14 	MINE_ALMA,
15 	MINE_CAMBRIA,
16 	MINE_CHITZENA,
17 	MINE_GRUMM,
18 	MAX_NUMBER_OF_MINES,
19 };
20 
21 enum{
22 	MINER_FRED = 0,
23 	MINER_MATT,
24 	MINER_OSWALD,
25 	MINER_CALVIN,
26 	MINER_CARL,
27 	NUM_HEAD_MINERS,
28 };
29 
30 // different types of mines
31 enum{
32 	SILVER_MINE=0,
33 	GOLD_MINE,
34 	NUM_MINE_TYPES,
35 };
36 
37 
38 // head miner quote types
39 enum HeadMinerQuote
40 {
41 	HEAD_MINER_STRATEGIC_QUOTE_RUNNING_OUT = 0,
42 	HEAD_MINER_STRATEGIC_QUOTE_CREATURES_ATTACK,
43 	HEAD_MINER_STRATEGIC_QUOTE_CREATURES_GONE,
44 	HEAD_MINER_STRATEGIC_QUOTE_CREATURES_AGAIN,
45 	NUM_HEAD_MINER_STRATEGIC_QUOTES
46 };
47 
48 
49 // the strategic mine structures
50 struct MINE_STATUS_TYPE
51 {
52 	UINT8    ubMineType;								// type of mine (silver or gold)
53 	UINT32   uiMaxRemovalRate;					// fastest rate we can move ore from this mine in period
54 
55 	UINT32   uiRemainingOreSupply;			// the total value left to this mine (-1 means unlimited)
56 	UINT32   uiOreRunningOutPoint;			// when supply drop below this, workers tell player the mine is running out of ore
57 
58 	BOOLEAN  fEmpty;										// whether no longer minable
59 	BOOLEAN  fRunningOut;								// whether mine is beginning to run out
60 	BOOLEAN  fWarnedOfRunningOut;				// whether mine foreman has already told player the mine's running out
61 	BOOLEAN  fShutDownIsPermanent;			// means will never produce again in the game (head miner was attacked & died/quit)
62 	BOOLEAN  fShutDown;									// TRUE means mine production has been shut off
63 	BOOLEAN  fPrevInvadedByMonsters;		// whether or not mine has been previously invaded by monsters
64 	BOOLEAN  fSpokeToHeadMiner;					// player doesn't receive income from mine without speaking to the head miner first
65 	BOOLEAN  fMineHasProducedForPlayer;	// player has earned income from this mine at least once
66 
67 	BOOLEAN  fQueenRetookProducingMine;	// whether or not queen ever retook a mine after a player had produced from it
68 	BOOLEAN  fAttackedHeadMiner;				// player has attacked the head miner, shutting down mine & decreasing loyalty
69 	UINT32   uiTimePlayerProductionStarted;		// time in minutes when 'fMineHasProducedForPlayer' was first set
70 };
71 
72 
73 // init mines
74 void InitializeMines( void );
75 
76 void HourlyMinesUpdate(void);
77 
78 // get total left in this mine
79 INT32 GetTotalLeftInMine( UINT8 ubMineIndex );
80 
81 // get max rates for this mine (per period, per day)
82 UINT32 GetMaxPeriodicRemovalFromMine( UINT8 ubMineIndex );
83 
84 // Get the max amount that can be mined in one day.
85 UINT32 GetMaxDailyRemovalFromMine(UINT8 mine_id);
86 
87 // which town does this mine belong to?
88 INT8 GetTownAssociatedWithMine( UINT8 ubMineIndex );
89 
90 // posts the actual mine production events daily
91 void PostEventsForMineProduction(void);
92 
93 // the periodic checking for income from mines
94 void HandleIncomeFromMines( void );
95 
96 // predict income from mines
97 INT32 PredictIncomeFromPlayerMines( void );
98 
99 // predict income from a mine
100 UINT32 PredictDailyIncomeFromAMine(INT8 mine_id);
101 
102 /* Calculate how much player could make daily if he owned all mines with 100%
103  * control and 100% loyalty. */
104 INT32 CalcMaxPlayerIncomeFromMines();
105 
106 // get index of this mine, return -1 if no mine found
107 INT8 GetMineIndexForSector(UINT8 sector);
108 
109 // get the sector value for the mine associated with this town
110 INT16 GetMineSectorForTown(INT8 town_id);
111 
112 //Save the mine status to the save game file
113 void SaveMineStatusToSaveGameFile(HWFILE);
114 
115 //Load the mine status from the saved game file
116 void LoadMineStatusFromSavedGameFile(HWFILE);
117 
118 // if the player controls a given mine
119 bool PlayerControlsMine(INT8 mine_id);
120 
121 void ShutOffMineProduction( UINT8 ubMineIndex );
122 void RestartMineProduction( UINT8 ubMineIndex );
123 
124 BOOLEAN IsMineShutDown( UINT8 ubMineIndex );
125 
126 // Find the sector location of a mine
127 UINT8 GetMineSector(UINT8 ubMineIndex);
128 
129 void IssueHeadMinerQuote(UINT8 ubMineIndex, HeadMinerQuote);
130 
131 UINT8 GetHeadMinersMineIndex(UINT8 ubMinerProfileId);
132 
133 void PlayerSpokeToHeadMiner(UINT8 ubMinerProfile );
134 
135 BOOLEAN IsHisMineRunningOut(UINT8 ubMinerProfileId );
136 BOOLEAN IsHisMineEmpty(UINT8 ubMinerProfileId );
137 BOOLEAN IsHisMineDisloyal(UINT8 ubMinerProfileId );
138 BOOLEAN IsHisMineInfested(UINT8 ubMinerProfileId );
139 BOOLEAN IsHisMineLostAndRegained(UINT8 ubMinerProfileId );
140 BOOLEAN IsHisMineAtMaxProduction(UINT8 ubMinerProfileId );
141 void ResetQueenRetookMine( UINT8 ubMinerProfileId );
142 
143 void QueenHasRegainedMineSector(UINT8 ubMineIndex);
144 
145 BOOLEAN HasAnyMineBeenAttackedByMonsters(void);
146 
147 void PlayerAttackedHeadMiner( UINT8 ubMinerProfileId );
148 
149 BOOLEAN HasHisMineBeenProducingForPlayerForSomeTime( UINT8 ubMinerProfileId );
150 
151 // Get the id of the mine for this sector x,y,z; -1 is invalid
152 INT8 GetIdOfMineForSector(INT16 x, INT16 y, INT8 z);
153 
154 // use this to determine whether or not to place miners into a underground mine level
155 BOOLEAN AreThereMinersInsideThisMine( UINT8 ubMineIndex );
156 
157 // use this to determine whether or not the player has spoken to a head miner
158 BOOLEAN SpokenToHeadMiner( UINT8 ubMineIndex );
159 
160 extern std::vector<MINE_STATUS_TYPE> gMineStatus;
161 
162 #endif
163