aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/EventMap.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-05-11 22:29:51 +0200
committerShauren <shauren.trinity@gmail.com>2017-05-11 22:29:51 +0200
commit3a418a0bbc8e155e5395595c5e25c038d3c7c773 (patch)
tree45359566bd6e360dd133e7ef43bc2a42e26baf56 /src/common/Utilities/EventMap.cpp
parent8abc56c540b5d2c583e40ad3d302c43068778ed1 (diff)
Core/Common: Include cleanup
Diffstat (limited to 'src/common/Utilities/EventMap.cpp')
-rw-r--r--src/common/Utilities/EventMap.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/Utilities/EventMap.cpp b/src/common/Utilities/EventMap.cpp
index d4ea70174c4..e1c46d0ae65 100644
--- a/src/common/Utilities/EventMap.cpp
+++ b/src/common/Utilities/EventMap.cpp
@@ -16,6 +16,7 @@
*/
#include "EventMap.h"
+#include "Random.h"
void EventMap::Reset()
{
@@ -32,6 +33,11 @@ void EventMap::SetPhase(uint8 phase)
_phase = uint8(1 << (phase - 1));
}
+void EventMap::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);
+}
+
void EventMap::ScheduleEvent(uint32 eventId, uint32 time, uint32 group /*= 0*/, uint8 phase /*= 0*/)
{
if (group && group <= 8)
@@ -43,6 +49,16 @@ void EventMap::ScheduleEvent(uint32 eventId, uint32 time, uint32 group /*= 0*/,
_eventMap.insert(EventStore::value_type(_time + time, eventId));
}
+void EventMap::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);
+}
+
+void EventMap::Repeat(uint32 minTime, uint32 maxTime)
+{
+ Repeat(urand(minTime, maxTime));
+}
+
uint32 EventMap::ExecuteEvent()
{
while (!Empty())