diff options
author | hop311 <hop3114@gmail.com> | 2024-01-22 21:02:58 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-01-23 23:14:53 +0100 |
commit | 268a6948c0400905dfc335427395519689f067f5 (patch) | |
tree | b30e9b5774130552fe97e27deaf0370d83920c43 /src/openvic-simulation/interface/UI.cpp | |
parent | d4e597da089a81f719a9c33b46111d1c2c590124 (diff) |
Added reserve_more, expect_dictionary_key[s|_map]_reserve_length[_and_default]reserve_more
Diffstat (limited to 'src/openvic-simulation/interface/UI.cpp')
-rw-r--r-- | src/openvic-simulation/interface/UI.cpp | 6 |
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); |