forked from gecube/opencaesar3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcity.hpp
114 lines (89 loc) · 3.1 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
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
// This file is part of openCaesar3.
//
// openCaesar3 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// openCaesar3 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with openCaesar3. If not, see <http://www.gnu.org/licenses/>.
//
// Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com
#ifndef CITY_HPP
#define CITY_HPP
#include "tilemap.hpp"
#include "walker.hpp"
#include "building.hpp"
#include "service_building.hpp"
#include "factory_building.hpp"
#include "house.hpp"
#include "enums.hpp"
#include "serializer.hpp"
#include <list>
class City : public Serializable
{
public:
City();
void timeStep(); // performs one simulation step
void monthStep();
std::list<Walker*>& getWalkerList();
std::list<Walker*> getWalkerList( const WalkerType type );
std::list<LandOverlay*>& getOverlayList();
std::list<LandOverlay*> getBuildingList( const BuildingType buildingType );
void setRoadEntryIJ(const int i, const int j);
void setRoadExitIJ(const int i, const int j);
void setBoatEntryIJ(const int i, const int j);
void setBoatExitIJ(const int i, const int j);
int getRoadEntryI() const;
int getRoadEntryJ() const;
TilePos getRoadEntryIJ() const;
int getRoadExitI() const;
int getRoadExitJ() const;
TilePos getRoadExitIJ() const;
int getBoatEntryI() const;
int getBoatEntryJ() const;
int getBoatExitI() const;
int getBoatExitJ() const;
ClimateType getClimate() const;
void setClimate(const ClimateType);
int getTaxRate() const;
void setTaxRate(const int taxRate);
long getFunds() const;
void setFunds(const long funds);
long getPopulation() const;
void setPopulation(const long population);
unsigned long getMonth() const {return _month;}
Tilemap& getTilemap();
void serialize(OutputSerialStream &stream);
void unserialize(InputSerialStream &stream);
// add construction
void build(Construction &buildInstance, const int i, const int j);
// remove construction
void clearLand(const int i, const int j);
// collect taxes from all houses
void collectTaxes();
unsigned long getTime();
private:
int _roadEntryI, _roadEntryJ;
int _roadExitI, _roadExitJ;
int _boatEntryI, _boatEntryJ;
int _boatExitI, _boatExitJ;
ClimateType _climate;
Tilemap _tilemap;
std::list<Walker*> _walkerList;
std::list<LandOverlay*> _overlayList;
unsigned long _time; // number of timesteps since start
unsigned long _month; // number of months since start
long _funds; // amount of money
long _population; // number of inhabitants
int _taxRate;
void calculatePopulation();
void _createImigrants();
void recomputeRoadsForAll();
};
#endif