diff options
author | hop311 <hop3114@gmail.com> | 2023-12-08 00:12:32 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-12-08 00:12:32 +0100 |
commit | 4320b37f7258c7e1f2585d67509045b5c9d6de06 (patch) | |
tree | 6789bacb931ccfd7c7dc9de9e22a17b78b725d09 /src/openvic-simulation/map/State.cpp | |
parent | 085fe94212c6f0ddbdfca1b2ba58223e7f6dcc8a (diff) |
Meta regions being used to make states fix
Diffstat (limited to 'src/openvic-simulation/map/State.cpp')
-rw-r--r-- | src/openvic-simulation/map/State.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/openvic-simulation/map/State.cpp b/src/openvic-simulation/map/State.cpp index 8da1e85..896008e 100644 --- a/src/openvic-simulation/map/State.cpp +++ b/src/openvic-simulation/map/State.cpp @@ -8,16 +8,15 @@ State::State( Country const* owner, Province const* capital, Region::provinces_t&& provinces, Province::colony_status_t colony_status ) : owner { owner }, capital { capital }, provinces { std::move(provinces) }, colony_status { colony_status } {} -StateSet::StateSet(Region const* new_region) { - if (region->get_meta()) { +StateSet::StateSet(Region const& new_region) : region { new_region } { + if (region.get_meta()) { Logger::error("Cannot use meta region as state template!"); } - region = new_region; std::vector<Region::provinces_t> temp_provinces; bool in_state = false; - for (Province* province : region->get_provinces()) { + for (Province* province : region.get_provinces()) { // add to existing state if shared owner & status... for (Region::provinces_t& provinces : temp_provinces) { if (provinces[0] == province) { @@ -77,7 +76,9 @@ void StateManager::generate_states(Map const& map) { regions.clear(); regions.reserve(map.get_region_count()); for(Region const& region : map.get_regions()) { - regions.push_back(StateSet(®ion)); + if (!region.get_meta()) { + regions.push_back(StateSet(region)); + } } Logger::info("Generated states."); } |