From 212d591c31f4200b06d38e98b23c5c2bccde1772 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Mon, 22 May 2023 10:26:37 +0100 Subject: Formatting / style cleanup --- src/openvic/map/Map.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/openvic/map/Map.cpp') diff --git a/src/openvic/map/Map.cpp b/src/openvic/map/Map.cpp index af1ea8a..8d5b9e7 100644 --- a/src/openvic/map/Map.cpp +++ b/src/openvic/map/Map.cpp @@ -9,7 +9,9 @@ using namespace OpenVic; Mapmode::Mapmode(index_t new_index, std::string const& new_identifier, colour_func_t new_colour_func) - : HasIdentifier{ new_identifier }, index{ new_index }, colour_func{ new_colour_func } { + : HasIdentifier { new_identifier }, + index { new_index }, + colour_func { new_colour_func } { assert(colour_func != nullptr); } @@ -21,7 +23,9 @@ colour_t Mapmode::get_colour(Map const& map, Province const& province) const { return colour_func ? colour_func(map, province) : NULL_COLOUR; } -Map::Map() : provinces{ "provinces" }, regions{ "regions" }, mapmodes{ "mapmodes" } {} +Map::Map() : provinces { "provinces" }, + regions { "regions" }, + mapmodes { "mapmodes" } {} return_t Map::add_province(std::string const& identifier, colour_t colour) { if (provinces.get_item_count() >= MAX_INDEX) { @@ -36,7 +40,7 @@ return_t Map::add_province(std::string const& identifier, colour_t colour) { Logger::error("Invalid province colour: ", Province::colour_to_hex_string(colour)); return FAILURE; } - Province new_province{ static_cast(provinces.get_item_count() + 1), identifier, colour }; + Province new_province { static_cast(provinces.get_item_count() + 1), identifier, colour }; const index_t index = get_index_from_colour(colour); if (index != NULL_INDEX) { Logger::error("Duplicate province colours: ", get_province_by_index(index)->to_string(), " and ", new_province.to_string()); @@ -79,7 +83,7 @@ return_t Map::add_region(std::string const& identifier, std::vector Logger::error("Invalid region identifier - empty!"); return FAILURE; } - Region new_region{ identifier }; + Region new_region { identifier }; return_t ret = SUCCESS; for (std::string const& province_identifier : province_identifiers) { Province* province = get_province_by_identifier(province_identifier); @@ -330,7 +334,8 @@ return_t Map::generate_mapmode_colours(Mapmode::index_t index, uint8_t* target) return_t Map::setup(GoodManager const& good_manager, BuildingManager const& building_manager) { return_t ret = SUCCESS; for (Province& province : provinces.get_items()) { - if (!province.is_water()) // Set all land provinces to have an RGO based on their index to test them + // Set all land provinces to have an RGO based on their index to test them + if (!province.is_water()) province.rgo = good_manager.get_good_by_index(province.get_index() % good_manager.get_good_count()); if (building_manager.generate_province_buildings(province) != SUCCESS) ret = FAILURE; } -- cgit v1.2.3-56-ga3b1