aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/PartyIssue.cpp
blob: 04e0f2f3b16a847e0e23621b0383bcb1ab18b2f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 });
}