diff options
author | Hop311 <hop3114@gmail.com> | 2023-09-08 18:12:22 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-09-08 18:12:22 +0200 |
commit | 7772f8871348b7b52cb0a478bb76df68d8799a07 (patch) | |
tree | fd8c4626b2cee69a9fe9250365af6b18eea63c70 /src/openvic-simulation/pop/Religion.hpp | |
parent | 7f9a9a8241ba81be9213e6606b8be4a48f1cbaab (diff) |
More refactoring and duplicate code removal
Diffstat (limited to 'src/openvic-simulation/pop/Religion.hpp')
-rw-r--r-- | src/openvic-simulation/pop/Religion.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/openvic-simulation/pop/Religion.hpp b/src/openvic-simulation/pop/Religion.hpp new file mode 100644 index 0000000..bd65321 --- /dev/null +++ b/src/openvic-simulation/pop/Religion.hpp @@ -0,0 +1,56 @@ +#pragma once + +#include "openvic-simulation/types/IdentifierRegistry.hpp" +#include "openvic-simulation/dataloader/NodeTools.hpp" + +namespace OpenVic { + + struct ReligionManager; + + struct ReligionGroup : HasIdentifier { + friend struct ReligionManager; + + private: + ReligionGroup(const std::string_view new_identifier); + + public: + ReligionGroup(ReligionGroup&&) = default; + }; + + struct Religion : HasIdentifierAndColour { + friend struct ReligionManager; + + using icon_t = uint8_t; + + private: + ReligionGroup const& group; + const icon_t icon; + const bool pagan; + + Religion(const std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon, bool new_pagan); + + public: + Religion(Religion&&) = default; + + ReligionGroup const& get_group() const; + icon_t get_icon() const; + bool get_pagan() const; + }; + + struct ReligionManager { + private: + IdentifierRegistry<ReligionGroup> religion_groups; + IdentifierRegistry<Religion> religions; + + public: + ReligionManager(); + + bool add_religion_group(const std::string_view identifier); + IDENTIFIER_REGISTRY_ACCESSORS(ReligionGroup, religion_group) + + bool add_religion(const std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan); + IDENTIFIER_REGISTRY_ACCESSORS(Religion, religion) + + bool load_religion_file(ast::NodeCPtr root); + }; +} |