aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/Ideology.hpp
blob: b72c176f594ce27580697c261856477d041be9e0 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include "types/Date.hpp"
#include "types/IdentifierRegistry.hpp"
#include "dataloader/NodeTools.hpp"

namespace OpenVic {
   struct IdeologyManager;

   struct IdeologyGroup : HasIdentifier {
      friend struct IdeologyManager;

   private:
      IdeologyGroup(const std::string_view new_identifier);
   
   public:
      IdeologyGroup(IdeologyGroup&&) = default;
   };

   struct Ideology : HasIdentifierAndColour {
      friend struct IdeologyManager;

   private:
      IdeologyGroup const& group;
      const bool uncivilised;
      const Date spawn_date;

      //TODO - willingness to repeal/pass reforms (and its modifiers)

      Ideology(const std::string_view new_identifier, colour_t new_colour, IdeologyGroup const& new_group, bool uncivilised, Date spawn_date);

   public:
      Ideology(Ideology&&) = default;
      IdeologyGroup const& get_group() const;
      bool is_uncivilised() const;
      Date const& get_spawn_date() const;
   };

   struct IdeologyManager {
   private:
      IdentifierRegistry<IdeologyGroup> ideology_groups;
      IdentifierRegistry<Ideology> ideologies;

   public:
      IdeologyManager();
      
      bool add_ideology_group(const std::string_view identifier);
      IDENTIFIER_REGISTRY_ACCESSORS(IdeologyGroup, ideology_group)

      bool add_ideology(const std::string_view identifier, colour_t colour, IdeologyGroup const* group, bool uncivilised, Date spawn_date);
      IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(Ideology, ideology, ideologies)

      bool load_ideology_file(ast::NodeCPtr root);
   };
}