From 932b43953d623557236a31b30899b706307260ed Mon Sep 17 00:00:00 2001 From: Hop311 Date: Mon, 25 Sep 2023 21:52:57 +0100 Subject: Added review comments --- src/openvic-simulation/GameManager.cpp | 5 +++-- src/openvic-simulation/map/Map.cpp | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/openvic-simulation') diff --git a/src/openvic-simulation/GameManager.cpp b/src/openvic-simulation/GameManager.cpp index 1d95aa4..d9dc3d9 100644 --- a/src/openvic-simulation/GameManager.cpp +++ b/src/openvic-simulation/GameManager.cpp @@ -134,10 +134,11 @@ bool GameManager::expand_building(Province::index_t province_index, const std::s static constexpr colour_t LOW_ALPHA_VALUE = float_to_alpha_value(0.4f); static constexpr colour_t HIGH_ALPHA_VALUE = float_to_alpha_value(0.7f); -static constexpr colour_t LAND_COLOUR = 0x0D7017; -static constexpr colour_t WATER_COLOUR = 0x4287F5; static colour_t default_colour(Province const& province) { + /* Nice looking colours to blend with the terrain textures */ + static constexpr colour_t LAND_COLOUR = 0x0D7017; + static constexpr colour_t WATER_COLOUR = 0x4287F5; return LOW_ALPHA_VALUE | (province.get_water() ? WATER_COLOUR : LAND_COLOUR); } diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index 936feba..e29f104 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -404,6 +404,10 @@ bool Map::load_region_file(ast::NodeCPtr root) { } static constexpr colour_t colour_at(uint8_t const* colour_data, int32_t idx) { + /* colour_data is filled with BGR byte triplets - to get pixel idx as a + * single RGB value, multiply idx by 3 to get the index of the corresponding + * triplet, then combine the bytes in reverse order. + */ idx *= 3; return (colour_data[idx + 2] << 16) | (colour_data[idx + 1] << 8) | colour_data[idx]; } -- cgit v1.2.3-56-ga3b1