aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Decision.hpp
diff options
context:
space:
mode:
author zaaarf <me@zaaarf.foo>2023-12-10 21:16:53 +0100
committer zaaarf <me@zaaarf.foo>2023-12-10 21:16:53 +0100
commit13ffc9a12725b9dbcd3b957c74471356540ee716 (patch)
tree911563514c661e9bdb5bad1e2c38f200ce4b5428 /src/openvic-simulation/misc/Decision.hpp
parentba390fec5a923f7c4b4ab7f85e803eb50bbf9e3a (diff)
feat: decision dataloading
Diffstat (limited to 'src/openvic-simulation/misc/Decision.hpp')
-rw-r--r--src/openvic-simulation/misc/Decision.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/openvic-simulation/misc/Decision.hpp b/src/openvic-simulation/misc/Decision.hpp
new file mode 100644
index 0000000..e477f64
--- /dev/null
+++ b/src/openvic-simulation/misc/Decision.hpp
@@ -0,0 +1,47 @@
+#pragma once
+
+#include "openvic-simulation/types/IdentifierRegistry.hpp"
+
+namespace OpenVic {
+ struct DecisionManager;
+
+ struct Decision : HasIdentifier {
+ friend struct DecisionManager;
+
+ private:
+ const bool PROPERTY_CUSTOM_PREFIX(alert, has);
+ const bool PROPERTY_CUSTOM_PREFIX(news, is);
+ const std::string PROPERTY(news_title);
+ const std::string PROPERTY(news_desc_long);
+ const std::string PROPERTY(news_desc_medium);
+ const std::string PROPERTY(news_desc_short);
+ const std::string PROPERTY(picture);
+
+ Decision(
+ std::string_view new_identifier, bool new_alert, bool new_news,
+ std::string_view new_news_title, std::string_view new_news_desc_long,
+ std::string_view new_news_desc_medium, std::string_view new_news_desc_short,
+ std::string_view new_picture
+ );
+
+ public:
+ Decision(Decision&&) = default;
+ };
+
+ struct DecisionManager {
+ private:
+ IdentifierRegistry<Decision> decisions;
+
+ public:
+ DecisionManager();
+
+ bool add_decision(
+ std::string_view identifier, bool alert, bool news, std::string_view news_title,
+ std::string_view news_desc_long, std::string_view news_desc_medium,
+ std::string_view news_desc_short, std::string_view picture
+ );
+ IDENTIFIER_REGISTRY_ACCESSORS(decision)
+
+ bool load_decision_file(ast::NodeCPtr root);
+ };
+}