aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/Government.hpp
diff options
context:
space:
mode:
author Joel Machens <ajmach6@gmail.com>2023-10-03 04:27:51 +0200
committer Joel Machens <ajmach6@gmail.com>2023-10-03 23:55:48 +0200
commitc7eac74bb550c28be9eb75742f25d974b7742634 (patch)
treed616d3a13da06511614b49853570524da62c5cbe /src/openvic-simulation/politics/Government.hpp
parentb62e4d1b83f25c4ceb59455f953b6d32514ab726 (diff)
Initial Government Type Loading
Diffstat (limited to 'src/openvic-simulation/politics/Government.hpp')
-rw-r--r--src/openvic-simulation/politics/Government.hpp42
1 files changed, 42 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..a124780
--- /dev/null
+++ b/src/openvic-simulation/politics/Government.hpp
@@ -0,0 +1,42 @@
+#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:
+ const std::vector<std::string> ideologies;
+ const bool elections, appoint_ruling_party;
+ const uint16_t election_duration;
+ const std::string_view flag_type_identifier;
+
+ GovernmentType(std::string_view new_identifier, std::vector<std::string> new_ideologies, bool new_elections, bool new_appoint_ruling_party, uint16_t new_election_duration, std::string_view new_flag_type_identifier);
+
+ public:
+ GovernmentType(GovernmentType&&) = default;
+
+ bool is_ideology_compatible(std::string_view ideology) const;
+ bool holds_elections() const;
+ bool can_appoint_ruling_party() const;
+ uint16_t 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<std::string> ideologies, bool elections, bool appoint_ruling_party, uint16_t election_duration, std::string_view flag_type);
+ IDENTIFIER_REGISTRY_ACCESSORS(GovernmentType, government_type)
+
+ bool load_government_types_file(ast::NodeCPtr root);
+ };
+} // namespace OpenVic