aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
committer hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
commit572ac597d8b43c4c97be4b68aa40de0e7ae6bfe0 (patch)
treec529d60fe49fbcd167522c0fb21ca10139cb5cc7 /src/openvic-simulation/politics
parent35909d6e79d524f19f9b69dffd02fcf162be5093 (diff)
Require modifier type when parsing ModifierValues
Diffstat (limited to 'src/openvic-simulation/politics')
-rw-r--r--src/openvic-simulation/politics/Issue.cpp9
-rw-r--r--src/openvic-simulation/politics/NationalFocus.cpp3
-rw-r--r--src/openvic-simulation/politics/NationalValue.cpp5
3 files changed, 15 insertions, 2 deletions
diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp
index aa7fd60..1faa345 100644
--- a/src/openvic-simulation/politics/Issue.cpp
+++ b/src/openvic-simulation/politics/Issue.cpp
@@ -178,11 +178,15 @@ bool IssueManager::_load_issue(
ModifierManager const& modifier_manager, RuleManager const& rule_manager, std::string_view identifier,
IssueGroup const* group, ast::NodeCPtr node
) {
+ using enum Modifier::modifier_type_t;
+
ModifierValue values;
RuleSet rules;
bool jingoism = false;
- bool ret = modifier_manager.expect_modifier_value_and_keys(move_variable_callback(values),
+ bool ret = modifier_manager.expect_modifier_value_and_keys(
+ move_variable_callback(values),
+ ISSUE,
"is_jingoism", ZERO_OR_ONE, expect_bool(assign_variable_callback(jingoism)),
"rules", ZERO_OR_ONE, rule_manager.expect_rule_set(move_variable_callback(rules))
)(node);
@@ -215,6 +219,8 @@ bool IssueManager::_load_reform(
ModifierManager const& modifier_manager, RuleManager const& rule_manager, size_t ordinal, std::string_view identifier,
ReformGroup const* group, ast::NodeCPtr node
) {
+ using enum Modifier::modifier_type_t;
+
ModifierValue values;
RuleSet rules;
fixed_point_t administrative_multiplier = 0;
@@ -225,6 +231,7 @@ bool IssueManager::_load_reform(
bool ret = modifier_manager.expect_modifier_value_and_keys(
move_variable_callback(values),
+ REFORM,
"administrative_multiplier", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(administrative_multiplier)),
"technology_cost", ZERO_OR_ONE, expect_uint(assign_variable_callback(technology_cost)),
"allow", ZERO_OR_ONE, allow.expect_script(),
diff --git a/src/openvic-simulation/politics/NationalFocus.cpp b/src/openvic-simulation/politics/NationalFocus.cpp
index 81e6336..4d1546c 100644
--- a/src/openvic-simulation/politics/NationalFocus.cpp
+++ b/src/openvic-simulation/politics/NationalFocus.cpp
@@ -117,6 +117,8 @@ bool NationalFocusManager::load_national_foci_file(
[this, &group, &pop_manager, &ideology_manager, &good_definition_manager, &modifier_manager](
std::string_view identifier, ast::NodeCPtr node
) -> bool {
+ using enum Modifier::modifier_type_t;
+
uint8_t icon = 0;
bool has_flashpoint = false, own_provinces = true, outliner_show_as_percent = false;
fixed_point_t flashpoint_tension = 0;
@@ -132,6 +134,7 @@ bool NationalFocusManager::load_national_foci_file(
bool ret = modifier_manager.expect_modifier_value_and_keys_and_default(
move_variable_callback(modifiers),
+ NATIONAL_FOCUS,
[&good_definition_manager, &encourage_goods, &pop_manager, &encourage_pop_types](
std::string_view key, ast::NodeCPtr value
) -> bool {
diff --git a/src/openvic-simulation/politics/NationalValue.cpp b/src/openvic-simulation/politics/NationalValue.cpp
index 6dd4678..16f723b 100644
--- a/src/openvic-simulation/politics/NationalValue.cpp
+++ b/src/openvic-simulation/politics/NationalValue.cpp
@@ -21,11 +21,14 @@ bool NationalValueManager::load_national_values_file(ModifierManager const& modi
bool ret = expect_dictionary_reserve_length(
national_values,
[this, &modifier_manager](std::string_view national_value_identifier, ast::NodeCPtr value) -> bool {
+ using enum Modifier::modifier_type_t;
+
ModifierValue modifiers;
- bool ret = modifier_manager.expect_modifier_value(move_variable_callback(modifiers))(value);
+ bool ret = modifier_manager.expect_modifier_value(move_variable_callback(modifiers), NATIONAL_VALUE)(value);
ret &= add_national_value(national_value_identifier, std::move(modifiers));
+
return ret;
}
)(root);