aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/interface/UI.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-08-19 23:17:13 +0200
committer hop311 <hop3114@gmail.com>2024-08-19 23:17:13 +0200
commit2ee5e74365fb6214b4c6a1a14ebc54d00e36288f (patch)
tree02893ccea513ef56d66e8ac6080885eb018a7950 /src/openvic-simulation/interface/UI.cpp
parent53bf0ac14be0fd7a049306d6e20c01030916fdc6 (diff)
Store universal colour codes (first loaded)universal-colour-codes
Diffstat (limited to 'src/openvic-simulation/interface/UI.cpp')
-rw-r--r--src/openvic-simulation/interface/UI.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/openvic-simulation/interface/UI.cpp b/src/openvic-simulation/interface/UI.cpp
index db7e78a..03166b1 100644
--- a/src/openvic-simulation/interface/UI.cpp
+++ b/src/openvic-simulation/interface/UI.cpp
@@ -23,10 +23,20 @@ bool UIManager::add_font(
Logger::error("Invalid fontname for font ", identifier, " - empty!");
return false;
}
- return fonts.add_item(
+ const bool ret = fonts.add_item(
{ identifier, colour, fontname, charset, height, std::move(colour_codes) },
duplicate_warning_callback
);
+
+ if (universal_colour_codes.empty() && ret) {
+ GFX::Font::colour_codes_t const& loaded_colour_codes = get_fonts().back().get_colour_codes();
+ if (!loaded_colour_codes.empty()) {
+ universal_colour_codes = loaded_colour_codes;
+ Logger::info("Loaded universal colour codes from font: \"", identifier, "\"");
+ }
+ }
+
+ return ret;
}
bool UIManager::_load_font(ast::NodeCPtr node) {