aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/Dataloader.cpp
diff options
context:
space:
mode:
author Arturo <69714460+Jarturog@users.noreply.github.com>2024-02-18 21:27:58 +0100
committer Arturo <69714460+Jarturog@users.noreply.github.com>2024-02-22 16:34:52 +0100
commit35b4fa2e5c6c7fd082493ec143cf236da69f7ba1 (patch)
treed3721476d72d0c25d52b51ec9845025f4e044384 /src/openvic-simulation/dataloader/Dataloader.cpp
parent5216e893ebc5253b123bbf15b7509745d38f5a80 (diff)
Regions are now coloured from colors.txtregion-colours
Diffstat (limited to 'src/openvic-simulation/dataloader/Dataloader.cpp')
-rw-r--r--src/openvic-simulation/dataloader/Dataloader.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.cpp b/src/openvic-simulation/dataloader/Dataloader.cpp
index 157ff04..e1bf093 100644
--- a/src/openvic-simulation/dataloader/Dataloader.cpp
+++ b/src/openvic-simulation/dataloader/Dataloader.cpp
@@ -683,6 +683,8 @@ bool Dataloader::_load_map_dir(GameManager& game_manager) const {
static constexpr std::string_view default_province_flag_sprite = "province_flag_sprites"; /* Canal sprite/model names. */
static constexpr std::string_view climate_file = "climate.txt";
+ static constexpr std::string_view region_colours = "interface/colors.txt"; /* This file is not in map_directory */
+
/* Parser stored so the filename string_views persist until the end of this function. */
const v2script::Parser parser = parse_defines(lookup_file(append_string_views(map_directory, defaults_filename)));
@@ -735,9 +737,21 @@ bool Dataloader::_load_map_dir(GameManager& game_manager) const {
ret = false;
}
- if (!map.load_region_file(parse_defines(lookup_file(append_string_views(map_directory, region))).get_file_node())) {
- Logger::error("Failed to load region file!");
- ret = false;
+ {
+ std::vector<colour_t> colours;
+ if (!Map::load_region_colours(parse_defines(lookup_file(region_colours)).get_file_node(), colours)) {
+ Logger::error("Failed to load region colours file!");
+ ret = false;
+ }
+
+ using namespace OpenVic::colour_literals;
+ colours.push_back(0xFFFFFF_rgb); /* This ensures there is always at least one region colour. */
+
+ if (!map.load_region_file(
+ parse_defines(lookup_file(append_string_views(map_directory, region))).get_file_node(), colours)) {
+ Logger::error("Failed to load region file!");
+ ret = false;
+ }
}
if (!map.set_water_province_list(water_province_identifiers)) {