aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Province.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-03-21 00:31:05 +0100
committer GitHub <noreply@github.com>2024-03-21 00:31:05 +0100
commit020ada6c8f0f1bf4486fd9e76ec29673044794d6 (patch)
tree5dc9698964d3980680dad3127fb53ecd4a600c5f /src/openvic-simulation/map/Province.cpp
parenteece77afebf0e4d36b4c9ace3b1044f2c3da50f1 (diff)
parent6a99bd8237fa61bd740ba482b59ff428a7e2f123 (diff)
Merge pull request #152 from OpenVicProject/pop-menu
GUI and Pop attribute work for Population Menu
Diffstat (limited to 'src/openvic-simulation/map/Province.cpp')
-rw-r--r--src/openvic-simulation/map/Province.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp
index 94c8dcb..d1183f5 100644
--- a/src/openvic-simulation/map/Province.cpp
+++ b/src/openvic-simulation/map/Province.cpp
@@ -65,9 +65,14 @@ bool Province::expand_building(size_t building_index) {
return building->expand();
}
+void Province::_add_pop(Pop pop) {
+ pop.set_location(this);
+ pops.push_back(std::move(pop));
+}
+
bool Province::add_pop(Pop&& pop) {
if (!is_water()) {
- pops.push_back(std::move(pop));
+ _add_pop(std::move(pop));
return true;
} else {
Logger::error("Trying to add pop to water province ", get_identifier());
@@ -79,7 +84,7 @@ bool Province::add_pop_vec(std::vector<Pop> const& pop_vec) {
if (!is_water()) {
reserve_more(pops, pop_vec.size());
for (Pop const& pop : pop_vec) {
- pops.push_back(pop);
+ _add_pop(pop);
}
return true;
} else {
@@ -104,7 +109,7 @@ void Province::update_pops() {
for (Pop const& pop : pops) {
total_population += pop.get_size();
pop_type_distribution[&pop.get_type()] += pop.get_size();
- //ideology_distribution[&pop.get_???()] += pop.get_size();
+ ideology_distribution += pop.get_ideologies();
culture_distribution[&pop.get_culture()] += pop.get_size();
religion_distribution[&pop.get_religion()] += pop.get_size();
}
@@ -257,3 +262,11 @@ bool Province::apply_history_to_province(ProvinceHistoryEntry const* entry) {
// TODO: party loyalties for each POP when implemented on POP side
return ret;
}
+
+void Province::setup_pop_test_values(
+ IdeologyManager const& ideology_manager, IssueManager const& issue_manager, Country const& country
+) {
+ for (Pop& pop : pops) {
+ pop.setup_pop_test_values(ideology_manager, issue_manager, country);
+ }
+}