-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCrop.cpp
99 lines (82 loc) · 1.7 KB
/
Crop.cpp
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
#include "Crop.h"
using namespace std;
void Crop::LoadGame() {
ifstream IFS;
IFS.open("savegame.txt");
if (!IFS.is_open()) {
cout << "savegame.txt not found. Make sure to save the game before loading!" << endl << endl;
exit(-1);
}
int temp;
//statistics
IFS >> temp;
isNormal = temp;
IFS >> temp;
health = temp;
IFS >> temp;
maxHealth = temp;
IFS >> temp;
currentMaturity = temp;
IFS >> temp;
maxMaturity = temp;
IFS >> temp;
currentEnergyLevel = temp;
IFS >> temp;
maxEnergyLevel = temp;
IFS >> temp;
criticalEnergy = temp;
IFS >> temp;
lowerEnergy = temp;
IFS >> temp;
currentWaterLevel = temp;
IFS >> temp;
maxWaterLevel = temp;
IFS >> temp;
criticalWater = temp;
IFS >> temp;
lowerWater = temp;
IFS >> temp;
upperWater = temp;
IFS >> temp;
currentFertilizerLevel = temp;
IFS >> temp;
maxFertilizerLevel = temp;
IFS >> temp;
criticalFertilizer = temp;
IFS >> temp;
lowerFertilizer = temp;
IFS >> temp;
upperFertilizer = temp;
IFS >> temp;
status_drought = temp;
IFS >> temp;
droughtCounter = temp;
IFS >> temp;
status_heavyrain = temp;
IFS >> temp;
heavyrainCounter = temp;
IFS >> temp;
status_heatwave = temp;
IFS >> temp;
heatwaveCounter = temp;
IFS >> temp;
status_coldsnap = temp;
IFS >> temp;
coldsnapCounter = temp;
IFS >> temp;
status_buginfest = temp;
IFS >> temp;
buginfestUniqueStatus = temp;
//Player interactions values (watering plants, fertilizing)
IFS >> temp;
watering = temp;
IFS >> temp;
fertilizing = temp;
//Token to end the game.
IFS >> temp;
loseToken = temp;
IFS >> temp;
winToken = temp;
IFS.close();
return;
}