aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/politics')
-rw-r--r--src/openvic-simulation/politics/Government.cpp6
-rw-r--r--src/openvic-simulation/politics/Government.hpp2
-rw-r--r--src/openvic-simulation/politics/Rebel.cpp9
-rw-r--r--src/openvic-simulation/politics/Rebel.hpp2
4 files changed, 14 insertions, 5 deletions
diff --git a/src/openvic-simulation/politics/Government.cpp b/src/openvic-simulation/politics/Government.cpp
index a226518..fc93cc3 100644
--- a/src/openvic-simulation/politics/Government.cpp
+++ b/src/openvic-simulation/politics/Government.cpp
@@ -111,3 +111,9 @@ bool GovernmentTypeManager::load_government_types_file(IdeologyManager const& id
return ret;
}
+
+bool GovernmentTypeManager::is_valid_flag_type(std::string_view type) const {
+ return std::any_of(flag_types.begin(), flag_types.end(), [type](std::string const& flag_type) -> bool {
+ return flag_type == type;
+ });
+}
diff --git a/src/openvic-simulation/politics/Government.hpp b/src/openvic-simulation/politics/Government.hpp
index 4682bbf..34a9194 100644
--- a/src/openvic-simulation/politics/Government.hpp
+++ b/src/openvic-simulation/politics/Government.hpp
@@ -38,5 +38,7 @@ namespace OpenVic {
);
bool load_government_types_file(IdeologyManager const& ideology_manager, ast::NodeCPtr root);
+
+ bool is_valid_flag_type(std::string_view type) const;
};
} // namespace OpenVic
diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp
index a00b4a8..6850e83 100644
--- a/src/openvic-simulation/politics/Rebel.cpp
+++ b/src/openvic-simulation/politics/Rebel.cpp
@@ -142,16 +142,17 @@ bool RebelManager::load_rebels_file(
return ret;
}
-bool RebelManager::generate_modifiers(ModifierManager& modifier_manager) {
+bool RebelManager::generate_modifiers(ModifierManager& modifier_manager) const {
bool ret = true;
- modifier_manager.register_complex_modifier("rebel_org_gain");
+ ret &= modifier_manager.register_complex_modifier("rebel_org_gain");
ret &= modifier_manager.add_modifier_effect("rebel_org_gain_all", false);
for (RebelType const& rebel_type : get_rebel_types()) {
- std::string modifier_name = StringUtils::append_string_views("rebel_org_gain_", rebel_type.get_identifier());
- ret &= modifier_manager.add_modifier_effect(modifier_name, false);
+ ret &= modifier_manager.add_modifier_effect(
+ StringUtils::append_string_views("rebel_org_gain_", rebel_type.get_identifier()), false
+ );
}
return ret;
} \ No newline at end of file
diff --git a/src/openvic-simulation/politics/Rebel.hpp b/src/openvic-simulation/politics/Rebel.hpp
index c0fc9ff..29ae3ae 100644
--- a/src/openvic-simulation/politics/Rebel.hpp
+++ b/src/openvic-simulation/politics/Rebel.hpp
@@ -77,6 +77,6 @@ namespace OpenVic {
);
bool load_rebels_file(IdeologyManager const& ideology_manager, GovernmentTypeManager const& government_type_manager, ast::NodeCPtr root);
- bool generate_modifiers(ModifierManager& modifier_manager);
+ bool generate_modifiers(ModifierManager& modifier_manager) const;
};
} \ No newline at end of file