aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Event.hpp
diff options
context:
space:
mode:
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