aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/PartyIssue.cpp
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-09-19 21:58:29 +0200
committer zaaarf <zaaarf@proton.me>2023-09-19 21:58:29 +0200
commit33787f89686cd03a6ae7305bc51add5ac47fbde2 (patch)
treee9f370f392839f0315b01722a61e09085c49458e /src/openvic-simulation/politics/PartyIssue.cpp
parentb1349e8dfa0c840ca82472fb7f342de08ed8804b (diff)
feat: added PartyIssue and PoliticalReform structs
Diffstat (limited to 'src/openvic-simulation/politics/PartyIssue.cpp')
-rw-r--r--src/openvic-simulation/politics/PartyIssue.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/openvic-simulation/politics/PartyIssue.cpp b/src/openvic-simulation/politics/PartyIssue.cpp
new file mode 100644
index 0000000..04e0f2f
--- /dev/null
+++ b/src/openvic-simulation/politics/PartyIssue.cpp
@@ -0,0 +1,33 @@
+#include "PartyIssue.hpp"
+
+using namespace OpenVic;
+
+PartyIssueGroup::PartyIssueGroup(const std::string_view new_identifier) : HasIdentifier { new_identifier } {}
+
+PartyIssue::PartyIssue(const std::string_view new_identifier, PartyIssueGroup const& new_group)
+ : HasIdentifier { new_identifier }, group { new_group } {}
+
+PartyIssueManager::PartyIssueManager() : party_issue_groups { "party issue groups" }, party_issues { "party issues" } {}
+
+bool PartyIssueManager::add_party_issue_group(const std::string_view identifier) {
+ if (identifier.empty()) {
+ Logger::error("Invalid party issue group identifier - empty!");
+ return false;
+ }
+
+ return party_issue_groups.add_item({ identifier });
+}
+
+bool PartyIssueManager::add_party_issue(const std::string_view identifier, PartyIssueGroup const* group) {
+ if (identifier.empty()) {
+ Logger::error("Invalid party issue identifier - empty!");
+ return false;
+ }
+
+ if (group == nullptr) {
+ Logger::error("Null party issue group for ", identifier);
+ return false;
+ }
+
+ return party_issues.add_item({ identifier, *group });
+} \ No newline at end of file