-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcity.hpp
executable file
·89 lines (67 loc) · 2.08 KB
/
city.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
#ifndef CITY_HPP
#define CITY_HPP
#include <vector>
#include <map>
#include "map.hpp"
class City
{
private:
float currentTime;
float timePerDay;
std::vector<int> shuffledTiles;
/* Number of residents who are not in a residential zone */
double populationPool;
/* Number of residents who are not currently employed but can work */
double employmentPool;
/* Proportion of citizens who can work */
float propCanWork;
/* Proportion of residents who die/give birth each day
* Estimate for death rate = 1 / (life expectancy * 360)
* Current world values are 0.000055 and 0.000023, respectively */
double birthRate;
double deathRate;
double distributePool(double& pool, Tile& tile, double rate);
public:
Map map;
double population;
double employable;
double residentialTax;
double commercialTax;
double industrialTax;
/* Running total of city earnings (from tax etc) this month */
double earnings;
double funds;
int day;
City()
{
this->birthRate = 0.00055;
this->deathRate = 0.00023;
this->propCanWork = 0.50;
this->populationPool = 0;
this->population = populationPool;
this->employmentPool = 0;
this->employable = employmentPool;
this->residentialTax = 0.05;
this->commercialTax = 0.05;
this->industrialTax = 0.05;
this->earnings = 0;
this->funds = 0;
this->currentTime = 0.0;
this->timePerDay = 1.0;
this->day = 0;
}
City(std::string cityName, int tileSize, std::map<std::string, Tile>& tileAtlas) : City()
{
this->map.tileSize = tileSize;
load(cityName, tileAtlas);
}
void load(std::string cityName, std::map<std::string, Tile>& tileAtlas);
void save(std::string cityName);
void update(float dt);
void bulldoze(const Tile& tile);
void shuffleTiles();
void tileChanged();
double getHomeless() { return this->populationPool; }
double getUnemployed() { return this->employmentPool; }
};
#endif /* CITY_HPP */