diff options
author | hop311 <hop3114@gmail.com> | 2024-03-23 00:28:28 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-03-23 00:28:28 +0100 |
commit | 79c3462396fd4e1dcb7d1c9a2ef7bad741afa3e3 (patch) | |
tree | 4bf3a3318880609d6fdf2e96944bf84cdd2b8cdb /src/openvic-simulation/interface/UI.cpp | |
parent | 020ada6c8f0f1bf4486fd9e76ec29673044794d6 (diff) |
GFX objectTypes loading framework + Actor loadinggfx-object
Diffstat (limited to 'src/openvic-simulation/interface/UI.cpp')
-rw-r--r-- | src/openvic-simulation/interface/UI.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/openvic-simulation/interface/UI.cpp b/src/openvic-simulation/interface/UI.cpp index 2646bb7..479948d 100644 --- a/src/openvic-simulation/interface/UI.cpp +++ b/src/openvic-simulation/interface/UI.cpp @@ -83,9 +83,21 @@ bool UIManager::load_gfx_file(ast::NodeCPtr root) { return sprites.add_item(std::move(sprite), duplicate_warning_callback); } ), + "bitmapfonts", ZERO_OR_ONE, _load_fonts("bitmapfont"), "fonts", ZERO_OR_ONE, _load_fonts("font"), - "objectTypes", ZERO_OR_ONE, success_callback, + + "objectTypes", ZERO_OR_ONE, Object::expect_objects( + NodeTools::reserve_length_callback(objects), + [this](std::unique_ptr<Object>&& object) -> bool { + /* There are various models with the same name but slight differences, e.g. Prussian and German variants + * of PrussianGCCavalry (the latter added in a spritepack). Currently we default to using the first loaded + * model of each name, but we may want to switch to using the last loaded or allow multiple models per name + * (e.g. by grouping them per gfx file). */ + return objects.add_item(std::move(object), duplicate_warning_callback); + } + ), + "lightTypes", ZERO_OR_ONE, success_callback )(root); } |