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/Province.cpp | |
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/Province.cpp')
-rw-r--r-- | extension/src/openvic2/map/Province.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/extension/src/openvic2/map/Province.cpp b/extension/src/openvic2/map/Province.cpp index 4360bce..472cccb 100644 --- a/extension/src/openvic2/map/Province.cpp +++ b/extension/src/openvic2/map/Province.cpp @@ -7,25 +7,15 @@ using namespace OpenVic2; Province::Province(index_t new_index, std::string const& new_identifier, colour_t new_colour) : - HasIdentifier{ new_identifier }, index{ new_index }, colour{ new_colour }, buildings{ "buildings" } { + HasIdentifier{ new_identifier }, HasColour{ new_colour }, index{ new_index }, buildings{ "buildings" } { assert(index != NULL_INDEX); - assert(colour != NULL_COLOUR); + assert(new_colour != NULL_COLOUR); } -std::string Province::colour_to_hex_string(colour_t colour) { - std::ostringstream stream; - stream << std::hex << std::setfill('0') << std::setw(6) << colour; - return stream.str(); -} - -Province::index_t Province::get_index() const { +index_t Province::get_index() const { return index; } -Province::colour_t Province::get_colour() const { - return colour; -} - Region* Province::get_region() const { return region; } @@ -62,7 +52,7 @@ return_t Province::expand_building(std::string const& building_type_identifier) std::string Province::to_string() const { std::stringstream stream; - stream << "(#" << std::to_string(index) << ", " << get_identifier() << ", 0x" << colour_to_hex_string(colour) << ")"; + stream << "(#" << std::to_string(index) << ", " << get_identifier() << ", 0x" << colour_to_hex_string() << ")"; return stream.str(); } |