aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/NationalFocus.hpp
blob: e1bf937d7fbbc03a41c761b760d3370daa478b23 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once

#include "openvic-simulation/economy/Good.hpp"
#include "openvic-simulation/misc/Modifier.hpp"
#include "openvic-simulation/politics/Ideology.hpp"
#include "openvic-simulation/pop/Pop.hpp"
#include "openvic-simulation/scripts/ConditionScript.hpp"
#include "openvic-simulation/types/IdentifierRegistry.hpp"
#include "openvic-simulation/utility/Getters.hpp"

namespace OpenVic {
   struct NationalFocusManager;

   struct NationalFocusGroup : HasIdentifier {
      friend struct NationalFocusManager;

   private:
      NationalFocusGroup(std::string_view new_identifier);
   };

   struct NationalFocus : HasIdentifier {
      friend struct NationalFocusManager;

   private:
      NationalFocusGroup const& PROPERTY(group);
      uint8_t PROPERTY(icon);
      bool PROPERTY(has_flashpoint);
      bool PROPERTY(own_provinces);
      bool PROPERTY(outliner_show_as_percent);
      ModifierValue PROPERTY(modifiers);
      Ideology const* PROPERTY(loyalty_ideology);
      fixed_point_t PROPERTY(loyalty_value);
      ConditionScript PROPERTY(limit);

      NationalFocus(
         std::string_view new_identifier,
         NationalFocusGroup const& new_group,
         uint8_t new_icon,
         bool new_has_flashpoint,
         bool new_own_provinces,
         bool new_outliner_show_as_percent,
         ModifierValue&& new_modifiers,
         Ideology const* new_loyalty_ideology,
         fixed_point_t new_loyalty_value,
         ConditionScript&& new_limit
      );

      bool parse_scripts(GameManager const& game_manager);

   public:
      NationalFocus(NationalFocus&&) = default;
   };

   struct NationalFocusManager {
   private:
      IdentifierRegistry<NationalFocusGroup> IDENTIFIER_REGISTRY(national_focus_group);
      IdentifierRegistry<NationalFocus> IDENTIFIER_REGISTRY_CUSTOM_PLURAL(national_focus, national_foci);

   public:
      inline bool add_national_focus_group(std::string_view identifier);

      inline bool add_national_focus(
         std::string_view identifier,
         NationalFocusGroup const& group,
         uint8_t icon,
         bool has_flashpoint,
         bool own_provinces,
         bool outliner_show_as_percent,
         ModifierValue&& modifiers,
         Ideology const* loyalty_ideology,
         fixed_point_t loyalty_value,
         ConditionScript&& limit
      );

      bool load_national_foci_file(
         PopManager const& pop_manager, IdeologyManager const& ideology_manager, GoodManager const& good_manager,
         ModifierManager const& modifier_manager, ast::NodeCPtr root
      );

      bool parse_scripts(GameManager const& game_manager);
   };
} // namespace OpenVic