From caa2f31d536f568e485f15537db5e2f79f7616d5 Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 22 Jan 2024 19:17:38 +0000 Subject: Miscellaneous bug fixes and format cleanup --- src/openvic-simulation/military/Deployment.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/openvic-simulation/military') diff --git a/src/openvic-simulation/military/Deployment.cpp b/src/openvic-simulation/military/Deployment.cpp index d4a092b..c06ed95 100644 --- a/src/openvic-simulation/military/Deployment.cpp +++ b/src/openvic-simulation/military/Deployment.cpp @@ -82,22 +82,26 @@ bool DeploymentManager::load_oob_file( "name", ONE_EXACTLY, expect_identifier_or_string(assign_variable_callback(leader_name)), "date", ONE_EXACTLY, expect_identifier_or_string(expect_date_str(assign_variable_callback(leader_date))), "type", ONE_EXACTLY, expect_identifier(UnitManager::expect_type_str(assign_variable_callback(leader_type))), - "personality", ONE_EXACTLY, game_manager.get_military_manager().get_leader_trait_manager() - .expect_leader_trait_identifier(assign_variable_callback_pointer(leader_personality)), - "background", ONE_EXACTLY, game_manager.get_military_manager().get_leader_trait_manager() - .expect_leader_trait_identifier(assign_variable_callback_pointer(leader_background)), + "personality", ONE_EXACTLY, + game_manager.get_military_manager().get_leader_trait_manager().expect_leader_trait_identifier_or_string( + assign_variable_callback_pointer(leader_personality) + ), + "background", ONE_EXACTLY, + game_manager.get_military_manager().get_leader_trait_manager().expect_leader_trait_identifier_or_string( + assign_variable_callback_pointer(leader_background) + ), "prestige", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(leader_prestige)), "picture", ZERO_OR_ONE, expect_identifier_or_string(assign_variable_callback(picture)) )(node); - if (!leader_personality->is_personality_trait()) { + if (leader_personality != nullptr && !leader_personality->is_personality_trait()) { Logger::error( "Leader ", leader_name, " has personality ", leader_personality->get_identifier(), " which is not a personality trait!" ); ret = false; } - if (!leader_background->is_background_trait()) { + if (leader_background != nullptr && !leader_background->is_background_trait()) { Logger::error( "Leader ", leader_name, " has background ", leader_background->get_identifier(), " which is not a background trait!" -- cgit v1.2.3-56-ga3b1