diff options
author | hop311 <hop3114@gmail.com> | 2024-06-27 21:28:34 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-06-27 21:30:21 +0200 |
commit | 45d66d887983177612d7cb8e715d5b28c1f87f31 (patch) | |
tree | c8d10e8c2b38208401f30e9b3acf7fc4a071583f /src/openvic-simulation/map | |
parent | 41d50b15ac978530a53ed99eea36f180e1d27b16 (diff) |
Use minimal PopBase for pop historypop-base
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r-- | src/openvic-simulation/map/ProvinceInstance.cpp | 10 | ||||
-rw-r--r-- | src/openvic-simulation/map/ProvinceInstance.hpp | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/openvic-simulation/map/ProvinceInstance.cpp b/src/openvic-simulation/map/ProvinceInstance.cpp index 967d72b..61b1527 100644 --- a/src/openvic-simulation/map/ProvinceInstance.cpp +++ b/src/openvic-simulation/map/ProvinceInstance.cpp @@ -39,8 +39,8 @@ bool ProvinceInstance::expand_building(size_t building_index) { return building->expand(); } -void ProvinceInstance::_add_pop(Pop pop) { - pop.set_location(this); +void ProvinceInstance::_add_pop(Pop&& pop) { + pop.set_location(*this); pops.push_back(std::move(pop)); } @@ -54,11 +54,11 @@ bool ProvinceInstance::add_pop(Pop&& pop) { } } -bool ProvinceInstance::add_pop_vec(std::vector<Pop> const& pop_vec) { +bool ProvinceInstance::add_pop_vec(std::vector<PopBase> const& pop_vec) { if (!province_definition.is_water()) { reserve_more(pops, pop_vec.size()); - for (Pop const& pop : pop_vec) { - _add_pop(pop); + for (PopBase const& pop : pop_vec) { + _add_pop(Pop { pop }); } return true; } else { diff --git a/src/openvic-simulation/map/ProvinceInstance.hpp b/src/openvic-simulation/map/ProvinceInstance.hpp index 8e8ec93..ca7f149 100644 --- a/src/openvic-simulation/map/ProvinceInstance.hpp +++ b/src/openvic-simulation/map/ProvinceInstance.hpp @@ -59,7 +59,7 @@ namespace OpenVic { ProvinceInstance(ProvinceDefinition const& new_province_definition); - void _add_pop(Pop pop); + void _add_pop(Pop&& pop); void _update_pops(); public: @@ -72,7 +72,7 @@ namespace OpenVic { bool expand_building(size_t building_index); bool add_pop(Pop&& pop); - bool add_pop_vec(std::vector<Pop> const& pop_vec); + bool add_pop_vec(std::vector<PopBase> const& pop_vec); size_t get_pop_count() const; void update_gamestate(Date today); |