aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/Deployment.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-22 21:18:53 +0100
committer GitHub <noreply@github.com>2024-01-22 21:18:53 +0100
commit10f1f250883529e809d18a369f3668cfacd3bfd1 (patch)
tree7cd8a379963af18c24f8dabfe7525b39f2333e0c /src/openvic-simulation/military/Deployment.cpp
parent8205732a1b95f018f0898a2a4bc62e22f5bee0d3 (diff)
parentcaa2f31d536f568e485f15537db5e2f79f7616d5 (diff)
Merge pull request #135 from OpenVicProject/misc-changes
Miscellaneous bug fixes and format cleanup
Diffstat (limited to 'src/openvic-simulation/military/Deployment.cpp')
-rw-r--r--src/openvic-simulation/military/Deployment.cpp16
1 files changed, 10 insertions, 6 deletions
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!"