aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/PartyIssue.cpp
diff options
context:
space:
mode:
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