From 1b35c3a4434873b98f8e3aa7770f0edd37ec053c Mon Sep 17 00:00:00 2001 From: ClarkeCode Date: Fri, 28 Apr 2023 17:34:45 -0400 Subject: Moved several type aliases to Types.hpp; Added HasColour class for items which need associated colours --- extension/src/openvic2/map/Province.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'extension/src/openvic2/map/Province.cpp') 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(); } -- cgit v1.2.3-56-ga3b1