aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-07-19 21:35:31 +0200
committer GitHub <noreply@github.com>2024-07-19 21:35:31 +0200
commitd1f3a96b72dd06b5f97dd4643e5f016a02b42ea6 (patch)
tree38015e5729afbb98cf520e2cf26d8a4623d32f2f /src/openvic-simulation/politics
parente0518bee9b4c164f40716a8033b5e207c2060c0b (diff)
parent03647d2249f72b6545628bb844685f87c4581062 (diff)
Merge pull request #176 from OpenVicProject/format-cleanup
Cleanup: inheritance, const movable variables, code formatting
Diffstat (limited to 'src/openvic-simulation/politics')
-rw-r--r--src/openvic-simulation/politics/Government.hpp4
-rw-r--r--src/openvic-simulation/politics/Issue.hpp2
-rw-r--r--src/openvic-simulation/politics/NationalFocus.cpp2
-rw-r--r--src/openvic-simulation/politics/NationalValue.cpp2
-rw-r--r--src/openvic-simulation/politics/NationalValue.hpp6
-rw-r--r--src/openvic-simulation/politics/Rule.cpp4
-rw-r--r--src/openvic-simulation/politics/Rule.hpp7
7 files changed, 12 insertions, 15 deletions
diff --git a/src/openvic-simulation/politics/Government.hpp b/src/openvic-simulation/politics/Government.hpp
index f2a2318..ba2c437 100644
--- a/src/openvic-simulation/politics/Government.hpp
+++ b/src/openvic-simulation/politics/Government.hpp
@@ -9,11 +9,11 @@ namespace OpenVic {
friend struct GovernmentTypeManager;
private:
- const std::vector<Ideology const*> PROPERTY(ideologies);
+ std::vector<Ideology const*> PROPERTY(ideologies);
const bool PROPERTY_CUSTOM_PREFIX(elections, holds);
const bool PROPERTY_CUSTOM_PREFIX(appoint_ruling_party, can);
const Timespan PROPERTY(term_duration);
- const std::string PROPERTY_CUSTOM_NAME(flag_type_identifier, get_flag_type);
+ std::string PROPERTY_CUSTOM_NAME(flag_type_identifier, get_flag_type);
GovernmentType(
std::string_view new_identifier, std::vector<Ideology const*>&& new_ideologies, bool new_elections,
diff --git a/src/openvic-simulation/politics/Issue.hpp b/src/openvic-simulation/politics/Issue.hpp
index 25fa72e..70f082d 100644
--- a/src/openvic-simulation/politics/Issue.hpp
+++ b/src/openvic-simulation/politics/Issue.hpp
@@ -26,7 +26,7 @@ namespace OpenVic {
private:
IssueGroup const& PROPERTY(group);
- const RuleSet PROPERTY(rules);
+ RuleSet PROPERTY(rules);
const bool PROPERTY_CUSTOM_PREFIX(jingoism, is);
protected:
diff --git a/src/openvic-simulation/politics/NationalFocus.cpp b/src/openvic-simulation/politics/NationalFocus.cpp
index 818021e..3132c3e 100644
--- a/src/openvic-simulation/politics/NationalFocus.cpp
+++ b/src/openvic-simulation/politics/NationalFocus.cpp
@@ -18,7 +18,7 @@ NationalFocus::NationalFocus(
Ideology const* new_loyalty_ideology,
fixed_point_t new_loyalty_value,
ConditionScript&& new_limit
-) : Modifier { new_identifier, std::move(new_modifiers), 0 },
+) : Modifier { new_identifier, std::move(new_modifiers) },
group { new_group },
icon { new_icon },
has_flashpoint { new_has_flashpoint },
diff --git a/src/openvic-simulation/politics/NationalValue.cpp b/src/openvic-simulation/politics/NationalValue.cpp
index a149acf..b780195 100644
--- a/src/openvic-simulation/politics/NationalValue.cpp
+++ b/src/openvic-simulation/politics/NationalValue.cpp
@@ -4,7 +4,7 @@ using namespace OpenVic;
using namespace OpenVic::NodeTools;
NationalValue::NationalValue(std::string_view new_identifier, ModifierValue&& new_modifiers)
- : HasIdentifier { new_identifier }, modifiers { std::move(new_modifiers) } {}
+ : Modifier { new_identifier, std::move(new_modifiers) } {}
bool NationalValueManager::add_national_value(std::string_view identifier, ModifierValue&& modifiers) {
if (identifier.empty()) {
diff --git a/src/openvic-simulation/politics/NationalValue.hpp b/src/openvic-simulation/politics/NationalValue.hpp
index 3b92f4d..b896fd7 100644
--- a/src/openvic-simulation/politics/NationalValue.hpp
+++ b/src/openvic-simulation/politics/NationalValue.hpp
@@ -6,12 +6,10 @@
namespace OpenVic {
struct NationalValueManager;
- struct NationalValue : HasIdentifier {
+ struct NationalValue : Modifier {
friend struct NationalValueManager;
private:
- const ModifierValue PROPERTY(modifiers);
-
NationalValue(std::string_view new_identifier, ModifierValue&& new_modifiers);
public:
@@ -27,4 +25,4 @@ namespace OpenVic {
bool load_national_values_file(ModifierManager const& modifier_manager, ast::NodeCPtr root);
};
-} // namespace OpenVic
+}
diff --git a/src/openvic-simulation/politics/Rule.cpp b/src/openvic-simulation/politics/Rule.cpp
index ce0c319..37aa22a 100644
--- a/src/openvic-simulation/politics/Rule.cpp
+++ b/src/openvic-simulation/politics/Rule.cpp
@@ -6,8 +6,8 @@
using namespace OpenVic;
using namespace OpenVic::NodeTools;
-Rule::Rule(std::string_view new_identifier, rule_group_t new_group, size_t new_index)
- : HasIdentifier { new_identifier }, group { new_group }, index { new_index } {}
+Rule::Rule(std::string_view new_identifier, rule_group_t new_group, index_t new_index)
+ : HasIdentifier { new_identifier }, HasIndex { new_index }, group { new_group } {}
RuleSet::RuleSet(rule_group_map_t&& new_rule_groups) : rule_groups { std::move(new_rule_groups) } {}
diff --git a/src/openvic-simulation/politics/Rule.hpp b/src/openvic-simulation/politics/Rule.hpp
index 70a59e8..518c555 100644
--- a/src/openvic-simulation/politics/Rule.hpp
+++ b/src/openvic-simulation/politics/Rule.hpp
@@ -7,7 +7,8 @@ namespace OpenVic {
struct RuleManager;
struct BuildingTypeManager;
- struct Rule : HasIdentifier {
+ /* The index of the Rule within its group, used to determine precedence in mutually exclusive rule groups. */
+ struct Rule : HasIdentifier, HasIndex<> {
friend struct RuleManager;
enum class rule_group_t : uint8_t {
@@ -27,10 +28,8 @@ namespace OpenVic {
private:
const rule_group_t PROPERTY(group);
- /* The index of the Rule within its group, used to determine precedence in mutually exclusive rule groups. */
- const size_t PROPERTY(index);
- Rule(std::string_view new_identifier, rule_group_t new_group, size_t new_index);
+ Rule(std::string_view new_identifier, rule_group_t new_group, index_t new_index);
public:
Rule(Rule&&) = default;