aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/pop/Religion.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-09-09 23:49:54 +0200
committer GitHub <noreply@github.com>2023-09-09 23:49:54 +0200
commit6278a35f4704574933464700026d8deb997da5c1 (patch)
treeeb36a9b030b263d825eb93638e64deb0dbd38a78 /src/openvic/pop/Religion.cpp
parentbec619fc8f554cb075fcef2428f3b6bdb5e88e82 (diff)
parent3d7fbd9b376811ca0ed226fa78bcc8b6279ba8dc (diff)
Merge pull request #14 from OpenVicProject/dataloading
Dataloading scaffolding + basic culture and pop history loading
Diffstat (limited to 'src/openvic/pop/Religion.cpp')
-rw-r--r--src/openvic/pop/Religion.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/openvic/pop/Religion.cpp b/src/openvic/pop/Religion.cpp
deleted file mode 100644
index 0cfc7a6..0000000
--- a/src/openvic/pop/Religion.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "Religion.hpp"
-
-#include <cassert>
-
-using namespace OpenVic;
-
-ReligionGroup::ReligionGroup(const std::string_view new_identifier) : HasIdentifier { new_identifier } {}
-
-Religion::Religion(const std::string_view new_identifier, colour_t new_colour,
- ReligionGroup const& new_group, icon_t new_icon, bool new_pagan)
- : HasIdentifierAndColour { new_identifier, new_colour, true },
- group { new_group },
- icon { new_icon },
- pagan { new_pagan } {
- assert(icon > 0);
-}
-
-ReligionGroup const& Religion::get_group() const {
- return group;
-}
-
-Religion::icon_t Religion::get_icon() const {
- return icon;
-}
-
-bool Religion::get_pagan() const {
- return pagan;
-}
-
-ReligionManager::ReligionManager()
- : religion_groups { "religion groups" },
- religions { "religions" } {}
-
-return_t ReligionManager::add_religion_group(const std::string_view identifier) {
- if (identifier.empty()) {
- Logger::error("Invalid religion group identifier - empty!");
- return FAILURE;
- }
- return religion_groups.add_item({ identifier });
-}
-
-void ReligionManager::lock_religion_groups() {
- religion_groups.lock();
-}
-
-ReligionGroup const* ReligionManager::get_religion_group_by_identifier(const std::string_view identifier) const {
- return religion_groups.get_item_by_identifier(identifier);
-}
-
-return_t ReligionManager::add_religion(const std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan) {
- if (!religion_groups.is_locked()) {
- Logger::error("Cannot register religions until religion groups are locked!");
- return FAILURE;
- }
- if (identifier.empty()) {
- Logger::error("Invalid religion identifier - empty!");
- return FAILURE;
- }
- if (group == nullptr) {
- Logger::error("Null religion group for ", identifier);
- return FAILURE;
- }
- if (colour > MAX_COLOUR_RGB) {
- Logger::error("Invalid religion colour for ", identifier, ": ", Religion::colour_to_hex_string(colour));
- return FAILURE;
- }
- if (icon <= 0) {
- Logger::error("Invalid religion icon for ", identifier, ": ", icon);
- return FAILURE;
- }
- return religions.add_item({ identifier, colour, *group, icon, pagan });
-}
-
-void ReligionManager::lock_religions() {
- religions.lock();
-}
-
-Religion const* ReligionManager::get_religion_by_identifier(const std::string_view identifier) const {
- return religions.get_item_by_identifier(identifier);
-}