From 4320b37f7258c7e1f2585d67509045b5c9d6de06 Mon Sep 17 00:00:00 2001 From: hop311 Date: Thu, 7 Dec 2023 23:12:32 +0000 Subject: Meta regions being used to make states fix --- src/openvic-simulation/map/State.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/openvic-simulation/map/State.cpp') 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 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."); } -- cgit v1.2.3-56-ga3b1