diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Utilities/EventMap.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index 961d6765240..edcc7a64455 100644 --- a/src/common/Utilities/EventMap.h +++ b/src/common/Utilities/EventMap.h @@ -116,7 +116,7 @@ public: * @name ScheduleEvent * @brief Creates new event entry in map. * @param eventId The id of the new event. - * @param time The time in milliseconds as std::chrono::duration until the event occurs. + * @param time The time until the event occurs as std::chrono type. * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ @@ -129,6 +129,20 @@ public: * @name ScheduleEvent * @brief Creates new event entry in map. * @param eventId The id of the new event. + * @param minTime The minimum time until the event occurs as std::chrono type. + * @param maxTime The maximum time until the event occurs as std::chrono type. + * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. + * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. + */ + void ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint32 phase = 0) + { + ScheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase); + } + + /** + * @name ScheduleEvent + * @brief Creates new event entry in map. + * @param eventId The id of the new event. * @param time The time in milliseconds until the event occurs. * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. @@ -139,7 +153,7 @@ public: * @name RescheduleEvent * @brief Cancels the given event and reschedules it. * @param eventId The id of the event. - * @param time The time in milliseconds as std::chrono::duration until the event occurs. + * @param time The time until the event occurs as std::chrono type. * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ @@ -152,6 +166,20 @@ public: * @name RescheduleEvent * @brief Cancels the given event and reschedules it. * @param eventId The id of the event. + * @param minTime The minimum time until the event occurs as std::chrono type. + * @param maxTime The maximum time until the event occurs as std::chrono type. + * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. + * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. + */ + void RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint32 phase = 0) + { + RescheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase); + } + + /** + * @name RescheduleEvent + * @brief Cancels the given event and reschedules it. + * @param eventId The id of the event. * @param time The time in milliseconds until the event occurs. * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. @@ -223,7 +251,7 @@ public: /** * @name DelayEvents - * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0. + * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be equal to internal timer. * @param delay Amount of delay. */ void DelayEvents(uint32 delay) |