diff options
author | ClarkeCode <clarke.john.robert@gmail.com> | 2023-04-28 23:34:45 +0200 |
---|---|---|
committer | ClarkeCode <clarke.john.robert@gmail.com> | 2023-04-28 23:34:45 +0200 |
commit | 1b35c3a4434873b98f8e3aa7770f0edd37ec053c (patch) | |
tree | d15169c42d04a09d6d1d74593fe21458cdb9f6df /extension/src/openvic2/map/Map.hpp | |
parent | 92d0f35b989b0164e2dd8c9a32213c6038e5d57f (diff) |
Moved several type aliases to Types.hpp; Added HasColour class for items which need associated colours
Diffstat (limited to 'extension/src/openvic2/map/Map.hpp')
-rw-r--r-- | extension/src/openvic2/map/Map.hpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/extension/src/openvic2/map/Map.hpp b/extension/src/openvic2/map/Map.hpp index ebc23be..9150772 100644 --- a/extension/src/openvic2/map/Map.hpp +++ b/extension/src/openvic2/map/Map.hpp @@ -3,13 +3,14 @@ #include <functional> #include "openvic2/map/Region.hpp" +#include "openvic2/Types.hpp" namespace OpenVic2 { struct Mapmode : HasIdentifier { friend struct Map; - using colour_func_t = std::function<Province::colour_t (Map const&, Province const&)>; + using colour_func_t = std::function<colour_t (Map const&, Province const&)>; using index_t = size_t; private: const index_t index; @@ -18,7 +19,7 @@ namespace OpenVic2 { Mapmode(index_t new_index, std::string const& new_identifier, colour_func_t new_colour_func); public: index_t get_index() const; - Province::colour_t get_colour(Map const& map, Province const& province) const; + colour_t get_colour(Map const& map, Province const& province) const; }; /* REQUIREMENTS: @@ -33,11 +34,11 @@ namespace OpenVic2 { size_t water_province_count = 0; size_t width = 0, height = 0; - std::vector<Province::index_t> province_index_image; + std::vector<index_t> province_index_image; public: Map(); - return_t add_province(std::string const& identifier, Province::colour_t colour); + return_t add_province(std::string const& identifier, colour_t colour); void lock_provinces(); return_t set_water_province(std::string const& identifier); void lock_water_provinces(); @@ -45,13 +46,13 @@ namespace OpenVic2 { void lock_regions(); size_t get_province_count() const; - Province* get_province_by_index(Province::index_t index); - Province const* get_province_by_index(Province::index_t index) const; + Province* get_province_by_index(index_t index); + Province const* get_province_by_index(index_t index) const; Province* get_province_by_identifier(std::string const& identifier); Province const* get_province_by_identifier(std::string const& identifier) const; - Province* get_province_by_colour(Province::colour_t colour); - Province const* get_province_by_colour(Province::colour_t colour) const; - Province::index_t get_province_index_at(size_t x, size_t y) const; + Province* get_province_by_colour(colour_t colour); + Province const* get_province_by_colour(colour_t colour) const; + index_t get_province_index_at(size_t x, size_t y) const; Region* get_region_by_identifier(std::string const& identifier); Region const* get_region_by_identifier(std::string const& identifier) const; @@ -59,7 +60,7 @@ namespace OpenVic2 { return_t generate_province_index_image(size_t new_width, size_t new_height, uint8_t const* colour_data); size_t get_width() const; size_t get_height() const; - std::vector<Province::index_t> const& get_province_index_image() const; + std::vector<index_t> const& get_province_index_image() const; return_t add_mapmode(std::string const& identifier, Mapmode::colour_func_t colour_func); void lock_mapmodes(); |