-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLocation.hpp
166 lines (119 loc) · 3.08 KB
/
Location.hpp
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#pragma once
#ifndef WORLDSIM_LOCATION_HPP
#define WORLDSIM_LOCATION_HPP
/* WorldSim: Location.hpp
#include "Location.hpp"
Abstract locations. Later will be built into physical locations.
*/
#include "Stockpile.hpp"
#include <string>
#include <vector>
class Character;
class Location: public HasResourceRequirement
{
private:
Vector <Character*> vCharacter; // Characters in this location.
Vector <Location*> vLinkedLocations; // Locations you can travel to from here.
public:
enumLocation type;
Vector <ItemType> vCanMake; // Items this location can make.
bool isOutside;
int capacity; // How many people can occupy the location. -1 = unlimited
int nIngress; // How many people can enter at once.
int darkness; // Dark areas spawn enemies
int maxBranches;
Location();
void link(Location* location);
bool putCharacter(Character* c);
void removeCharacter(Character* c);
virtual std::string getName();
virtual ResourceRequirement getResourceRequirement();
int availableBranches();
bool hasRoom(); // returns true if there is room for another character here
};
// Far beyond the Settlement
class Location_Wilderness: public Location
{
public:
Location_Wilderness();
virtual std::string getName() override;
};
class Location_Settlement_Exterior: public Location
{
public:
Location_Settlement_Exterior();
virtual std::string getName() override;
};
class Location_Settlement_Walls: public Location
{
public:
Location_Settlement_Walls();
virtual std::string getName() override;
};
class Location_Main_Hall: public Location
{
public:
Location_Main_Hall();
virtual std::string getName() override;
};
class Location_Hall: public Location
{
public:
Location_Hall();
virtual std::string getName() override;
};
class Location_Dwelling: public Location
{
public:
Location_Dwelling();
};
class Location_Mine: public Location
{
public:
int size;
int nIron;
int nCopper;
Location_Mine();
virtual std::string getName() override;
};
class Location_Farm: public Location
{
public:
Location_Farm();
virtual std::string getName() override;
};
class Location_Weaponsmith: public Location
{
public:
Location_Weaponsmith();
virtual std::string getName() override;
};
class LocationManager
{
public:
Vector <Location*> vLocation;
World_Biome* biome;
LocationManager();
void buildDwarvenFortress();
void putCharacter(Character* c, enumLocation location);
Vector <Location*>* getLocation(enumLocation location);
int totalAvailableBranches();
Location* getBuildableBranch();
int getMiningCapacity();
int getFarmingCapacity();
Location* addLocation(enumLocation locationType);
bool has(enumLocation locationType);
bool canBuild(enumLocation locationType);
// Stores resource requirements for all locations in central location
// Compiler will optimize it anyway
static ResourceRequirement getResourceRequirement(const enumLocation locationType);
Location* getLocationToMake(ItemType item);
void printAll();
std::string toString();
private:
std::string locationTypeToString(enumLocation type)
{
return locationToString(type);
}
};
#endif // WORLDSIM_LOCATION_HPP