aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Event.hpp
diff options
context:
space:
mode:
author zaaarf <me@zaaarf.foo>2023-12-14 01:35:53 +0100
committer zaaarf <me@zaaarf.foo>2023-12-14 01:35:53 +0100
commitddf75e39df90aedb25c32009211f56396865d28c (patch)
treef487c10ac28b1551edfe80b4891f6d929b6cf030 /src/openvic-simulation/misc/Event.hpp
parent34fbe27857d77d6f193d6d1848b953a4596cedd2 (diff)
feat: on_action dataloading
Diffstat (limited to 'src/openvic-simulation/misc/Event.hpp')
-rw-r--r--src/openvic-simulation/misc/Event.hpp17
1 files changed, 17 insertions, 0 deletions
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<Event const*, uint64_t>;
+
+ 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<Event> IDENTIFIER_REGISTRY(event);
+ IdentifierRegistry<OnAction> IDENTIFIER_REGISTRY(on_action);
public:
bool register_event(
@@ -76,6 +90,9 @@ namespace OpenVic {
std::vector<Event::EventOption>&& 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