From c1b7cab254ac14a173477661047ad2492930ff8b Mon Sep 17 00:00:00 2001 From: hop311 Date: Tue, 31 Oct 2023 01:11:47 +0000 Subject: History loading changes + PROPERTY macro --- src/openvic-simulation/map/Map.cpp | 2 +- src/openvic-simulation/map/Province.cpp | 6 +++++- src/openvic-simulation/map/Province.hpp | 4 ++++ src/openvic-simulation/map/TerrainType.cpp | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/openvic-simulation/map') diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index 4790853..b1aea2c 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -514,7 +514,7 @@ bool Map::load_map_images(fs::path const& province_path, fs::path const& terrain goto set_terrain; } } - if (unrecognised_province_colours.find(province_colour) == unrecognised_province_colours.end()) { + if (!unrecognised_province_colours.contains(province_colour)) { unrecognised_province_colours.insert(province_colour); if (detailed_errors) { Logger::warning( diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp index 7b88ebf..66e4daf 100644 --- a/src/openvic-simulation/map/Province.cpp +++ b/src/openvic-simulation/map/Province.cpp @@ -5,7 +5,7 @@ using namespace OpenVic::NodeTools; Province::Province( std::string_view new_identifier, colour_t new_colour, index_t new_index -) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, index { new_index }, +) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, index { new_index }, buildings { "buildings", false } { assert(index != NULL_INDEX); } @@ -38,6 +38,10 @@ Province::life_rating_t Province::get_life_rating() const { return life_rating; } +Province::colony_status_t Province::get_colony_status() const { + return colony_status; +} + bool Province::load_positions(BuildingManager const& building_manager, ast::NodeCPtr root) { return expect_dictionary_keys( "text_position", ZERO_OR_ONE, expect_fvec2(assign_variable_callback(positions.text)), diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp index 10f3a9a..6c022b7 100644 --- a/src/openvic-simulation/map/Province.hpp +++ b/src/openvic-simulation/map/Province.hpp @@ -24,6 +24,8 @@ namespace OpenVic { using distance_t = uint16_t; using flags_t = uint16_t; + enum struct colony_status_t : int8_t { STATE, PROTECTORATE, COLONY }; + struct adjacency_t { friend struct Province; @@ -63,6 +65,7 @@ namespace OpenVic { Region* region = nullptr; bool on_map = false, has_region = false, water = false; life_rating_t life_rating = 0; + colony_status_t colony_status = colony_status_t::STATE; IdentifierRegistry buildings; // TODO - change this into a factory-like structure Good const* rgo = nullptr; @@ -90,6 +93,7 @@ namespace OpenVic { bool get_water() const; TerrainType const* get_terrain_type() const; life_rating_t get_life_rating() const; + colony_status_t get_colony_status() const; bool load_positions(BuildingManager const& building_manager, ast::NodeCPtr root); bool add_building(BuildingInstance&& building_instance); diff --git a/src/openvic-simulation/map/TerrainType.cpp b/src/openvic-simulation/map/TerrainType.cpp index 1753246..796089e 100644 --- a/src/openvic-simulation/map/TerrainType.cpp +++ b/src/openvic-simulation/map/TerrainType.cpp @@ -7,7 +7,7 @@ using namespace OpenVic::NodeTools; TerrainType::TerrainType( std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_modifier, bool new_is_water -) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, modifier { std::move(new_modifier) }, +) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, modifier { std::move(new_modifier) }, is_water { new_is_water } {} ModifierValue const& TerrainType::get_modifier() const { -- cgit v1.2.3-56-ga3b1