From 33787f89686cd03a6ae7305bc51add5ac47fbde2 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Tue, 19 Sep 2023 21:58:29 +0200 Subject: feat: added PartyIssue and PoliticalReform structs --- src/openvic-simulation/politics/PartyIssue.cpp | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/openvic-simulation/politics/PartyIssue.cpp (limited to 'src/openvic-simulation/politics/PartyIssue.cpp') 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 -- cgit v1.2.3-56-ga3b1