aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/Government.hpp
diff options
context:
space:
mode:
author BrickPi <49528459+BrickPi@users.noreply.github.com>2023-10-04 15:52:16 +0200
committer GitHub <noreply@github.com>2023-10-04 15:52:16 +0200
commit5b4c5b19897a94f6c9a6213733b096007221a83f (patch)
tree8d7501f0fa823ae2e71f409a7ccbf6248fb974c5 /src/openvic-simulation/politics/Government.hpp
parentb62e4d1b83f25c4ceb59455f953b6d32514ab726 (diff)
parentf15504062abfc24c1e65b660315198fe7838db8c (diff)
Merge pull request #42 from OpenVicProject/government-type-loading
Diffstat (limited to 'src/openvic-simulation/politics/Government.hpp')
-rw-r--r--src/openvic-simulation/politics/Government.hpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/openvic-simulation/politics/Government.hpp b/src/openvic-simulation/politics/Government.hpp
new file mode 100644
index 0000000..a8fc00f
--- /dev/null
+++ b/src/openvic-simulation/politics/Government.hpp
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "openvic-simulation/types/IdentifierRegistry.hpp"
+#include "openvic-simulation/politics/Ideology.hpp"
+
+namespace OpenVic {
+ struct GovernmentTypeManager;
+
+ struct GovernmentType : HasIdentifier {
+ friend struct GovernmentTypeManager;
+
+ private:
+ std::vector<Ideology const*> ideologies;
+ const bool elections, appoint_ruling_party;
+ const Timespan election_duration;
+ const std::string flag_type_identifier;
+
+ GovernmentType(std::string_view new_identifier, std::vector<Ideology const*> new_ideologies, bool new_elections, bool new_appoint_ruling_party, Timespan new_election_duration, std::string_view new_flag_type_identifier);
+
+ public:
+ GovernmentType(GovernmentType&&) = default;
+
+ bool is_ideology_compatible(Ideology const* ideology) const;
+ std::vector<Ideology const*> const& get_ideologies() const;
+ bool holds_elections() const;
+ bool can_appoint_ruling_party() const;
+ Timespan get_election_duration() const;
+ std::string_view get_flag_type() const;
+ };
+
+ struct GovernmentTypeManager {
+ private:
+ IdentifierRegistry<GovernmentType> government_types;
+
+ public:
+ GovernmentTypeManager();
+
+ bool add_government_type(std::string_view identifier, std::vector<Ideology const*> ideologies, bool elections, bool appoint_ruling_party, Timespan election_duration, std::string_view flag_type);
+ IDENTIFIER_REGISTRY_ACCESSORS(GovernmentType, government_type)
+
+ bool load_government_types_file(IdeologyManager const& ideology_manager, ast::NodeCPtr root);
+ };
+} // namespace OpenVic