aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/map/Province.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic/map/Province.cpp')
-rw-r--r--src/openvic/map/Province.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/openvic/map/Province.cpp b/src/openvic/map/Province.cpp
index 06f1c98..75612ad 100644
--- a/src/openvic/map/Province.cpp
+++ b/src/openvic/map/Province.cpp
@@ -30,8 +30,8 @@ Province::life_rating_t Province::get_life_rating() const {
return life_rating;
}
-return_t Province::add_building(BuildingType const& type) {
- return buildings.add_item({ type });
+return_t Province::add_building(Building&& building) {
+ return buildings.add_item(std::move(building));
}
void Province::lock_buildings() {
@@ -66,9 +66,28 @@ std::string Province::to_string() const {
return stream.str();
}
+void Province::add_pop(Pop&& pop) {
+ pops.push_back(std::move(pop));
+}
+
+/* REQUIREMENTS:
+ * MAP-65
+ */
+void Province::update_total_population() {
+ total_population = 0;
+ for (Pop const& pop : pops) {
+ total_population += pop.get_size();
+ }
+}
+
+Pop::pop_size_t Province::get_total_population() const {
+ return total_population;
+}
+
void Province::update_state(Date const& today) {
for (Building& building : buildings.get_items())
building.update_state(today);
+ update_total_population();
}
void Province::tick(Date const& today) {