From ddf75e39df90aedb25c32009211f56396865d28c Mon Sep 17 00:00:00 2001 From: zaaarf Date: Thu, 14 Dec 2023 01:35:53 +0100 Subject: feat: on_action dataloading --- src/openvic-simulation/misc/Event.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/openvic-simulation/misc/Event.hpp') diff --git a/src/openvic-simulation/misc/Event.hpp b/src/openvic-simulation/misc/Event.hpp index d1f7963..a518f78 100644 --- a/src/openvic-simulation/misc/Event.hpp +++ b/src/openvic-simulation/misc/Event.hpp @@ -63,9 +63,23 @@ namespace OpenVic { Event(Event&&) = default; }; + struct OnAction : HasIdentifier { + friend struct EventManager; + using weight_map_t = std::map; + + private: + weight_map_t PROPERTY(weighted_events); + + OnAction(std::string_view new_identifier, weight_map_t new_weighted_events); + + public: + OnAction(OnAction&&) = default; + }; + struct EventManager { private: IdentifierRegistry IDENTIFIER_REGISTRY(event); + IdentifierRegistry IDENTIFIER_REGISTRY(on_action); public: bool register_event( @@ -76,6 +90,9 @@ namespace OpenVic { std::vector&& options ); + bool add_on_action(std::string_view identifier, OnAction::weight_map_t new_weighted_events); + bool load_event_file(IssueManager const& issue_manager, ast::NodeCPtr root); + bool load_on_action_file(ast::NodeCPtr root); }; } // namespace OpenVic -- cgit v1.2.3-56-ga3b1