From 928c521599b2b18e8964aeb445c3ca5a55bacbd1 Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 17 Jul 2024 00:01:03 +0100 Subject: Use IndexedMap + helper function support --- .../src/openvic-extension/singletons/ModelSingleton.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'extension/src/openvic-extension/singletons/ModelSingleton.cpp') diff --git a/extension/src/openvic-extension/singletons/ModelSingleton.cpp b/extension/src/openvic-extension/singletons/ModelSingleton.cpp index 7dea1bd..5fb9cf8 100644 --- a/extension/src/openvic-extension/singletons/ModelSingleton.cpp +++ b/extension/src/openvic-extension/singletons/ModelSingleton.cpp @@ -4,6 +4,8 @@ #include +#include + #include "openvic-extension/singletons/GameSingleton.hpp" #include "openvic-extension/utility/ClassBindings.hpp" #include "openvic-extension/utility/Utilities.hpp" @@ -180,8 +182,12 @@ Dictionary ModelSingleton::make_model_dict(GFX::Actor const& actor) const { /* Returns false if an error occurs while trying to add a unit model for the province, true otherwise. * Returning true doesn't necessarily mean a unit was added, e.g. when units is empty. */ -template T> -bool ModelSingleton::add_unit_dict(ordered_set const& units, TypedArray& unit_array) const { +template +bool ModelSingleton::add_unit_dict( + ordered_set*> const& units, TypedArray& unit_array +) const { + using _UnitInstanceGroup = UnitInstanceGroupBranched; + GameSingleton const* game_singleton = GameSingleton::get_singleton(); ERR_FAIL_NULL_V(game_singleton, false); @@ -204,7 +210,7 @@ bool ModelSingleton::add_unit_dict(ordered_set const& units, TypedArrayget_country_definition(); @@ -220,7 +226,7 @@ bool ModelSingleton::add_unit_dict(ordered_set const& units, TypedArrayget_sprite(); std::string_view mount_actor_name, mount_attach_node_name; - if constexpr (std::same_as) { + if constexpr (Branch == UnitType::branch_t::LAND) { RegimentType const* regiment_type = reinterpret_cast(display_unit_type); if (!regiment_type->get_sprite_override().empty()) { -- cgit v1.2.3-56-ga3b1