From 79c3462396fd4e1dcb7d1c9a2ef7bad741afa3e3 Mon Sep 17 00:00:00 2001 From: hop311 Date: Fri, 22 Mar 2024 23:28:28 +0000 Subject: GFX objectTypes loading framework + Actor loading --- src/openvic-simulation/interface/UI.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/openvic-simulation/interface/UI.cpp') 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) -> 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); } -- cgit v1.2.3-56-ga3b1