From 4ef33d4df6198e613b0f27406d49978c8ea2fb97 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sun, 10 Dec 2023 23:15:41 +0100 Subject: feat: improved identifier registry macro --- src/openvic-simulation/map/Map.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/openvic-simulation/map/Map.hpp') diff --git a/src/openvic-simulation/map/Map.hpp b/src/openvic-simulation/map/Map.hpp index bb760e6..16d12a8 100644 --- a/src/openvic-simulation/map/Map.hpp +++ b/src/openvic-simulation/map/Map.hpp @@ -53,9 +53,9 @@ namespace OpenVic { private: using colour_index_map_t = std::map; - IdentifierRegistry provinces; - IdentifierRegistry regions; - IdentifierRegistry mapmodes; + IdentifierRegistry IDENTIFIER_REGISTRY_CUSTOM_INDEX_OFFSET(province, 1); + IdentifierRegistry IDENTIFIER_REGISTRY(region); + IdentifierRegistry IDENTIFIER_REGISTRY(mapmode); ProvinceSet water_provinces; TerrainTypeManager PROPERTY_REF(terrain_type_manager); @@ -73,10 +73,7 @@ namespace OpenVic { StateManager PROPERTY_REF(state_manager); public: - Map(); - bool add_province(std::string_view identifier, colour_t colour); - IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_INDEX_OFFSET(province, 1) IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS_CUSTOM_INDEX_OFFSET(province, 1); bool set_water_province(std::string_view identifier); @@ -95,11 +92,9 @@ namespace OpenVic { std::vector const& get_province_shape_image() const; bool add_region(std::string_view identifier, std::vector const& province_identifiers); - IDENTIFIER_REGISTRY_ACCESSORS(region) IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS(region) bool add_mapmode(std::string_view identifier, Mapmode::colour_func_t colour_func); - IDENTIFIER_REGISTRY_ACCESSORS(mapmode) /* The mapmode colour image contains of a list of base colours and stripe colours. Each colour is four bytes * in RGBA format, with the alpha value being used to interpolate with the terrain colour, so A = 0 is fully terrain -- cgit v1.2.3-56-ga3b1