From 1683859e333f98fb63f1c72d926bb366a3b89f0b Mon Sep 17 00:00:00 2001 From: zaaarf Date: Wed, 22 Nov 2023 17:16:34 +0100 Subject: chore: use PROPERTY and its variants when possible --- src/openvic-simulation/map/Map.cpp | 4 ---- src/openvic-simulation/map/Map.hpp | 3 +-- src/openvic-simulation/map/TerrainType.cpp | 25 +------------------------ src/openvic-simulation/map/TerrainType.hpp | 20 ++++++-------------- 4 files changed, 8 insertions(+), 44 deletions(-) (limited to 'src/openvic-simulation/map') diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index 6df7537..549e539 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -21,10 +21,6 @@ const Mapmode Mapmode::ERROR_MAPMODE { "mapmode_error", 0, [](Map const& map, Province const& province) -> colour_t { return 0xFFFF0000; } }; -Mapmode::index_t Mapmode::get_index() const { - return index; -} - Mapmode::base_stripe_t Mapmode::get_base_stripe_colours(Map const& map, Province const& province) const { return colour_func ? colour_func(map, province) : NULL_COLOUR; } diff --git a/src/openvic-simulation/map/Map.hpp b/src/openvic-simulation/map/Map.hpp index 189713c..4f87237 100644 --- a/src/openvic-simulation/map/Map.hpp +++ b/src/openvic-simulation/map/Map.hpp @@ -21,7 +21,7 @@ namespace OpenVic { using index_t = size_t; private: - const index_t index; + const index_t PROPERTY(index); const colour_func_t colour_func; Mapmode(std::string_view new_identifier, index_t new_index, colour_func_t new_colour_func); @@ -31,7 +31,6 @@ namespace OpenVic { Mapmode(Mapmode&&) = default; - index_t get_index() const; base_stripe_t get_base_stripe_colours(Map const& map, Province const& province) const; }; diff --git a/src/openvic-simulation/map/TerrainType.cpp b/src/openvic-simulation/map/TerrainType.cpp index f138cb2..3048b66 100644 --- a/src/openvic-simulation/map/TerrainType.cpp +++ b/src/openvic-simulation/map/TerrainType.cpp @@ -10,36 +10,13 @@ TerrainType::TerrainType( ) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, modifier { std::move(new_modifier) }, is_water { new_is_water } {} -ModifierValue const& TerrainType::get_modifier() const { - return modifier; -} - -bool TerrainType::get_is_water() const { - return is_water; -} TerrainTypeMapping::TerrainTypeMapping( std::string_view new_identifier, TerrainType const& new_type, std::vector&& new_terrain_indicies, index_t new_priority, bool new_has_texture -) : HasIdentifier { new_identifier }, type { new_type }, terrain_indicies { std::move(new_terrain_indicies) }, +) : HasIdentifier { new_identifier }, type { new_type }, terrain_indices { std::move(new_terrain_indicies) }, priority { new_priority }, has_texture { new_has_texture } {} -TerrainType const& TerrainTypeMapping::get_type() const { - return type; -} - -std::vector const& TerrainTypeMapping::get_terrain_indicies() const { - return terrain_indicies; -} - -TerrainTypeMapping::index_t TerrainTypeMapping::get_priority() const { - return priority; -} - -bool TerrainTypeMapping::get_has_texture() const { - return has_texture; -} - TerrainTypeManager::TerrainTypeManager() : terrain_types { "terrain types" }, terrain_type_mappings { "terrain type mappings" } {} diff --git a/src/openvic-simulation/map/TerrainType.hpp b/src/openvic-simulation/map/TerrainType.hpp index 92f78dd..0fd5157 100644 --- a/src/openvic-simulation/map/TerrainType.hpp +++ b/src/openvic-simulation/map/TerrainType.hpp @@ -9,16 +9,13 @@ namespace OpenVic { friend struct TerrainTypeManager; private: - const ModifierValue modifier; - const bool is_water; + const ModifierValue PROPERTY(modifier); + const bool PROPERTY(is_water); TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_modifier, bool new_is_water); public: TerrainType(TerrainType&&) = default; - - ModifierValue const& get_modifier() const; - bool get_is_water() const; }; struct TerrainTypeMapping : HasIdentifier { @@ -27,10 +24,10 @@ namespace OpenVic { using index_t = uint8_t; private: - TerrainType const& type; - const std::vector terrain_indicies; - const index_t priority; - const bool has_texture; + TerrainType const& PROPERTY(type); + const std::vector PROPERTY(terrain_indices); + const index_t PROPERTY(priority); + const bool PROPERTY(has_texture); TerrainTypeMapping( std::string_view new_identifier, TerrainType const& new_type, std::vector&& new_terrain_indicies, @@ -39,11 +36,6 @@ namespace OpenVic { public: TerrainTypeMapping(TerrainTypeMapping&&) = default; - - TerrainType const& get_type() const; - std::vector const& get_terrain_indicies() const; - index_t get_priority() const; - bool get_has_texture() const; }; struct TerrainTypeManager { -- cgit v1.2.3-56-ga3b1