aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/modifier/Modifier.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
committer hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
commit572ac597d8b43c4c97be4b68aa40de0e7ae6bfe0 (patch)
treec529d60fe49fbcd167522c0fb21ca10139cb5cc7 /src/openvic-simulation/modifier/Modifier.cpp
parent35909d6e79d524f19f9b69dffd02fcf162be5093 (diff)
Require modifier type when parsing ModifierValues
Diffstat (limited to 'src/openvic-simulation/modifier/Modifier.cpp')
-rw-r--r--src/openvic-simulation/modifier/Modifier.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/openvic-simulation/modifier/Modifier.cpp b/src/openvic-simulation/modifier/Modifier.cpp
index 962d2d4..3cec7df 100644
--- a/src/openvic-simulation/modifier/Modifier.cpp
+++ b/src/openvic-simulation/modifier/Modifier.cpp
@@ -2,6 +2,33 @@
using namespace OpenVic;
+std::string_view Modifier::modifier_type_to_string(modifier_type_t type) {
+ using enum Modifier::modifier_type_t;
+
+ switch (type) {
+#define _CASE(X) case X: return #X;
+ _CASE(EVENT)
+ _CASE(STATIC)
+ _CASE(TRIGGERED)
+ _CASE(CRIME)
+ _CASE(TERRAIN)
+ _CASE(CLIMATE)
+ _CASE(CONTINENT)
+ _CASE(BUILDING)
+ _CASE(LEADER)
+ _CASE(UNIT_TERRAIN)
+ _CASE(NATIONAL_VALUE)
+ _CASE(NATIONAL_FOCUS)
+ _CASE(ISSUE)
+ _CASE(REFORM)
+ _CASE(TECHNOLOGY)
+ _CASE(INVENTION)
+ _CASE(TECH_SCHOOL)
+#undef _CASE
+ default: return "INVALID MODIFIER TYPE";
+ }
+}
+
Modifier::Modifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type)
: HasIdentifier { new_identifier }, ModifierValue { std::move(new_values) }, type { new_type } {}