aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Event.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-12-14 08:37:35 +0100
committer GitHub <noreply@github.com>2023-12-14 08:37:35 +0100
commite6b455b8924948761dbd792756303efe18875c6d (patch)
tree36fcb92720eabeb18554aa934cac86ed9a9609ed /src/openvic-simulation/misc/Event.hpp
parentdf7c04079a7b5936e1701f37a845199bac94b1fb (diff)
parentddf75e39df90aedb25c32009211f56396865d28c (diff)
Merge pull request #92 from OpenVicProject/dataloading-onactions
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