WorldSim  inDev
2D tile-based sandbox RPG with procedurally generated fantasy world simulator 🌏
Location.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef WORLDSIM_LOCATION_HPP
3 #define WORLDSIM_LOCATION_HPP
4 
5 /* WorldSim: Location.hpp
6  #include "Location.hpp"
7 
8  Abstract locations. Later will be built into physical locations.
9 
10 */
11 
12 #include "Stockpile.hpp"
13 
14 #include <string>
15 #include <vector>
16 
17 class Character;
18 
20 {
21 private:
22  Vector <Character*> vCharacter; // Characters in this location.
23  Vector <Location*> vLinkedLocations; // Locations you can travel to from here.
24 
25 
26 public:
28  Vector <ItemType> vCanMake; // Items this location can make.
29 
30  bool isOutside;
31 
32  int capacity; // How many people can occupy the location. -1 = unlimited
33  int nIngress; // How many people can enter at once.
34  int darkness; // Dark areas spawn enemies
35 
37 
38  Location();
39 
40  void link(Location* location);
41  bool putCharacter(Character* c);
42  void removeCharacter(Character* c);
43  virtual std::string getName();
45  int availableBranches();
46 
47  bool hasRoom(); // returns true if there is room for another character here
48 };
49 
50 
51 // Far beyond the Settlement
53 {
54 public:
56 
57  virtual std::string getName() override;
58 };
59 
61 {
62 public:
64 
65  virtual std::string getName() override;
66 };
67 
69 {
70 public:
72 
73  virtual std::string getName() override;
74 };
75 
77 {
78 public:
80 
81  virtual std::string getName() override;
82 };
83 
84 class Location_Hall: public Location
85 {
86 public:
87  Location_Hall();
88 
89  virtual std::string getName() override;
90 };
91 
93 {
94 public:
96 
97 };
98 
99 class Location_Mine: public Location
100 {
101 public:
102  int size;
103  int nIron;
104  int nCopper;
105 
106  Location_Mine();
107 
108  virtual std::string getName() override;
109 };
110 
111 class Location_Farm: public Location
112 {
113 public:
114 
115  Location_Farm();
116 
117  virtual std::string getName() override;
118 };
119 
121 {
122 public:
123 
125 
126  virtual std::string getName() override;
127 };
128 
130 {
131 public:
132  Vector <Location*> vLocation;
133 
135 
136  LocationManager();
137 
138  void buildDwarvenFortress();
139  void putCharacter(Character* c, enumLocation location);
140  Vector <Location*>* getLocation(enumLocation location);
141  int totalAvailableBranches();
142  Location* getBuildableBranch();
143  int getMiningCapacity();
144  int getFarmingCapacity();
145  Location* addLocation(enumLocation locationType);
146  bool has(enumLocation locationType);
147  bool canBuild(enumLocation locationType);
148 
149  // Stores resource requirements for all locations in central location
150  // Compiler will optimize it anyway
151  static ResourceRequirement getResourceRequirement(const enumLocation locationType);
152 
153  Location* getLocationToMake(ItemType item);
154 
155  void printAll();
156  std::string toString();
157 
158 private:
159  std::string locationTypeToString(enumLocation type)
160  {
161  return locationToString(type);
162  }
163 
164 };
165 
166 #endif // WORLDSIM_LOCATION_HPP
int size
Definition: Location.hpp:102
int darkness
Definition: Location.hpp:34
Definition: Location.hpp:68
void link(Location *location)
Definition: Location.cpp:21
virtual ResourceRequirement getResourceRequirement()
Definition: Location.cpp:64
int nIron
Definition: Location.hpp:103
int capacity
Definition: Location.hpp:32
World_Biome * biome
Definition: Location.hpp:134
enumLocation
Definition: Driver_Settings_Enums.hpp:76
bool putCharacter(Character *c)
Definition: Location.cpp:27
Location()
Definition: Location.cpp:12
Definition: Location.hpp:99
enumLocation type
Definition: Location.hpp:27
const std::string locationToString(enumLocation location)
Definition: Driver_Settings_Enums.hpp:107
Definition: World_Biome.hpp:46
Definition: Location.hpp:129
Definition: Location.hpp:120
int nCopper
Definition: Location.hpp:104
bool hasRoom()
Definition: Location.cpp:44
int maxBranches
Definition: Location.hpp:36
bool isOutside
Definition: Location.hpp:30
Definition: Location.hpp:76
Vector< Location * > vLocation
Definition: Location.hpp:132
Definition: Location.hpp:52
Vector< ItemType > vCanMake
Definition: Location.hpp:28
Definition: Character.hpp:38
Definition: Location.hpp:111
void removeCharacter(Character *c)
Definition: Location.cpp:53
Definition: Stockpile.hpp:106
Definition: Location.hpp:84
virtual std::string getName()
Definition: Location.cpp:59
Definition: Location.hpp:19
Definition: Location.hpp:92
int availableBranches()
Definition: Location.cpp:69
int nIngress
Definition: Location.hpp:33
Definition: Stockpile.hpp:76
Definition: Location.hpp:60
ItemType
Definition: Driver_Settings_Enums.hpp:268