aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/interface/UI.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-24 01:47:16 +0100
committer GitHub <noreply@github.com>2024-01-24 01:47:16 +0100
commit6bcb1e70a15755ceb0aaa13a080f85f8edb50911 (patch)
treeb30e9b5774130552fe97e27deaf0370d83920c43 /src/openvic-simulation/interface/UI.cpp
parentd4e597da089a81f719a9c33b46111d1c2c590124 (diff)
parent268a6948c0400905dfc335427395519689f067f5 (diff)
Merge pull request #137 from OpenVicProject/reserve_more
Added reserve_more, expect_dictionary_key[s|_map]_reserve_length[_and_default]
Diffstat (limited to 'src/openvic-simulation/interface/UI.cpp')
-rw-r--r--src/openvic-simulation/interface/UI.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/openvic-simulation/interface/UI.cpp b/src/openvic-simulation/interface/UI.cpp
index 344fc15..b977406 100644
--- a/src/openvic-simulation/interface/UI.cpp
+++ b/src/openvic-simulation/interface/UI.cpp
@@ -39,7 +39,8 @@ bool UIManager::_load_font(ast::NodeCPtr node) {
bool UIManager::load_gfx_file(ast::NodeCPtr root) {
return expect_dictionary_keys(
- "spriteTypes", ZERO_OR_ONE, Sprite::expect_sprite(
+ "spriteTypes", ZERO_OR_ONE, Sprite::expect_sprites(
+ NodeTools::reserve_length_callback(sprites),
[this](std::unique_ptr<Sprite>&& sprite) -> bool {
/* TODO - more checks on duplicates (the false here reduces them from
* errors to warnings). The repeats in vanilla are identical (simple
@@ -64,7 +65,8 @@ bool UIManager::load_gfx_file(ast::NodeCPtr root) {
return sprites.add_item(std::move(sprite), duplicate_warning_callback);
}
),
- "bitmapfonts", ZERO_OR_ONE, expect_dictionary(
+ "bitmapfonts", ZERO_OR_ONE, expect_dictionary_reserve_length(
+ fonts,
[this](std::string_view key, ast::NodeCPtr node) -> bool {
if (key != "bitmapfont") {
Logger::error("Invalid bitmapfonts key: ", key);