aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/NationalFocus.hpp
diff options
context:
space:
mode:
author BrickPi <49528459+BrickPi@users.noreply.github.com>2023-11-14 22:12:00 +0100
committer BrickPi <49528459+BrickPi@users.noreply.github.com>2023-11-15 18:06:48 +0100
commit4794eeedd9abc1393526a97253bf9d59b5ecd179 (patch)
tree1100ec41f85e3030d553a3447c1688467c7a8214 /src/openvic-simulation/politics/NationalFocus.hpp
parentf572664cbe1aa5ec2cb6907de3083f058c20af7e (diff)
Implement National Foci
Diffstat (limited to 'src/openvic-simulation/politics/NationalFocus.hpp')
-rw-r--r--src/openvic-simulation/politics/NationalFocus.hpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/openvic-simulation/politics/NationalFocus.hpp b/src/openvic-simulation/politics/NationalFocus.hpp
new file mode 100644
index 0000000..7c5e40a
--- /dev/null
+++ b/src/openvic-simulation/politics/NationalFocus.hpp
@@ -0,0 +1,76 @@
+#pragma once
+
+#include "openvic-simulation/types/IdentifierRegistry.hpp"
+#include "openvic-simulation/utility/Getters.hpp"
+#include "openvic-simulation/Modifier.hpp"
+#include "openvic-simulation/pop/Pop.hpp"
+#include "openvic-simulation/politics/Ideology.hpp"
+#include "openvic-simulation/economy/Good.hpp"
+
+#include <optional>
+
+namespace OpenVic {
+ struct NationalFocusManager;
+
+ struct NationalFocusGroup : HasIdentifier {
+ friend struct NationalFocusManager;
+
+ private:
+ NationalFocusGroup(std::string_view new_identifier);
+ };
+
+ struct NationalFocus : HasIdentifier {
+ friend struct NationalFocusManager;
+
+ public:
+ using pop_promotion_map_t = std::map<PopType const*, fixed_point_t>;
+ using party_loyalty_map_t = std::map<Ideology const*, fixed_point_t>;
+ using production_map_t = std::map<Good const*, fixed_point_t>;
+
+ private:
+ uint8_t PROPERTY(icon);
+ NationalFocusGroup const& PROPERTY(group);
+ ModifierValue PROPERTY(modifiers);
+ pop_promotion_map_t PROPERTY(encouraged_promotion);
+ party_loyalty_map_t PROPERTY(encouraged_loyalty);
+ production_map_t PROPERTY(encouraged_production);
+
+ NationalFocus(
+ std::string_view new_identifier,
+ uint8_t new_icon,
+ NationalFocusGroup const& new_group,
+ ModifierValue&& new_modifiers,
+ pop_promotion_map_t&& new_encouraged_promotion,
+ party_loyalty_map_t&& new_encouraged_loyalty,
+ production_map_t&& new_encouraged_production
+ );
+
+ public:
+ NationalFocus(NationalFocus&&) = default;
+ };
+
+ struct NationalFocusManager {
+ private:
+ IdentifierRegistry<NationalFocusGroup> national_focus_groups;
+ IdentifierRegistry<NationalFocus> national_foci;
+
+ public:
+ NationalFocusManager();
+
+ inline bool add_national_focus_group(std::string_view identifier);
+ IDENTIFIER_REGISTRY_ACCESSORS(national_focus_group)
+
+ inline bool add_national_focus(
+ std::string_view identifier,
+ uint8_t icon,
+ NationalFocusGroup const& group,
+ ModifierValue&& modifiers,
+ NationalFocus::pop_promotion_map_t&& encouraged_promotion,
+ NationalFocus::party_loyalty_map_t&& encouraged_loyalty,
+ NationalFocus::production_map_t&& encouraged_production
+ );
+ IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(national_focus, national_foci);
+
+ bool load_national_foci_file(PopManager const& pop_manager, IdeologyManager const& ideology_manager, GoodManager const& good_manager, ModifierManager const& modifier_manager, ast::NodeCPtr root);
+ };
+} // namespace OpenVic