![]() |
TrinityCore
|
#include <EventMap.h>
Classes | |
| struct | Event |
Public Member Functions | |||||||||||
| EventMap () | |||||||||||
Reset | |||||||||||
Removes all scheduled events and resets time and phase. | |||||||||||
| void | Reset () | ||||||||||
Update | |||||||||||
Updates the timer of the event map.
| |||||||||||
| void | Update (uint32 time) | ||||||||||
| void | Update (Milliseconds time) | ||||||||||
GetPhaseMask | |||||||||||
| |||||||||||
| PhaseMask | GetPhaseMask () const | ||||||||||
Empty | |||||||||||
| |||||||||||
| bool | Empty () const | ||||||||||
SetPhase | |||||||||||
Sets the phase of the map (absolute).
| |||||||||||
| void | SetPhase (PhaseIndex phase) | ||||||||||
AddPhase | |||||||||||
Activates the given phase (absolute).
| |||||||||||
| void | AddPhase (PhaseIndex phase) | ||||||||||
RemovePhase | |||||||||||
Deactivates the given phase (absolute).
| |||||||||||
| void | RemovePhase (PhaseIndex phase) | ||||||||||
ScheduleEvent | |||||||||||
Creates new event entry in map.
| |||||||||||
| void | ScheduleEvent (EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u) | ||||||||||
| void | ScheduleEvent (EventId eventId, Milliseconds minTime, Milliseconds maxTime, GroupIndex group=0u, PhaseIndex phase=0u) | ||||||||||
RescheduleEvent | |||||||||||
Cancels the given event and reschedules it.
| |||||||||||
| void | RescheduleEvent (EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u) | ||||||||||
| void | RescheduleEvent (EventId eventId, Milliseconds minTime, Milliseconds maxTime, GroupIndex group=0u, PhaseIndex phase=0u) | ||||||||||
RepeatEvent | |||||||||||
Repeats the most recently executed event.
| |||||||||||
| void | Repeat (Milliseconds time) | ||||||||||
| void | Repeat (Milliseconds minTime, Milliseconds maxTime) | ||||||||||
ExecuteEvent | |||||||||||
Returns the next event to execute and removes it from map.
| |||||||||||
| EventId | ExecuteEvent () | ||||||||||
DelayEvents | |||||||||||
Delay all events of the same group.
| |||||||||||
| void | DelayEvents (Milliseconds delay) | ||||||||||
| void | DelayEvents (Milliseconds delay, GroupIndex group) | ||||||||||
SetMinimalDelay | |||||||||||
Increase event delay if smaller than given delay.
| |||||||||||
| void | SetMinimalDelay (EventId eventId, Milliseconds delay) | ||||||||||
CancelEvent | |||||||||||
Cancels all events of the specified id.
| |||||||||||
| void | CancelEvent (EventId eventId) | ||||||||||
CancelEventGroup | |||||||||||
Cancel events belonging to specified group.
| |||||||||||
| void | CancelEventGroup (GroupIndex group) | ||||||||||
IsInPhase | |||||||||||
Returns whether event map is in specified phase or not.
| |||||||||||
| bool | IsInPhase (PhaseIndex phase) const | ||||||||||
GetTimeUntilEvent | |||||||||||
Returns time as std::chrono type until next event.
| |||||||||||
| Milliseconds | GetTimeUntilEvent (EventId eventId) const | ||||||||||
HasEventScheduled | |||||||||||
Returns whether an event is scheduled
| |||||||||||
| bool | HasEventScheduled (EventId eventId) const | ||||||||||
Private Types | |
| using | EventId = uint16 |
| using | GroupIndex = uint8 |
| using | GroupMask = uint8 |
| using | PhaseIndex = uint8 |
| using | PhaseMask = uint8 |
| using | EventStore = std::multimap< TimePoint, Event > |
Private Attributes | |
_time | |
Internal timer. This does not represent the real date/time value. It's more like a stopwatch: It can run, it can be stopped, it can be resetted and so on. Events occur when this timer has reached their time value. Its value is changed in the Update method. | |
| TimePoint | _time |
_phaseMask | |
Phase mask of the event map. Contains the phases the event map is in. Multiple phases from 1 to 8 can be set with SetPhase or AddPhase. RemovePhase deactives a phase. | |
| PhaseMask | _phaseMask |
_eventMap | |
Internal event storage map. Contains the scheduled events. See typedef at the beginning of the class for more details. | |
| EventStore | _eventMap |
_lastEvent | |
Stores information on the most recently executed event | |
| Event | _lastEvent |
Definition at line 25 of file EventMap.h.
|
private |
Definition at line 27 of file EventMap.h.
|
private |
Internal storage type. Key: Time as TimePoint when the event should occur.
Definition at line 51 of file EventMap.h.
|
private |
Definition at line 28 of file EventMap.h.
|
private |
Definition at line 29 of file EventMap.h.
|
private |
Definition at line 30 of file EventMap.h.
|
private |
Definition at line 31 of file EventMap.h.
|
inline |
Definition at line 54 of file EventMap.h.
|
inline |
Definition at line 112 of file EventMap.h.
| void EventMap::CancelEvent | ( | EventId | eventId | ) |
Definition at line 151 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::CancelEventGroup | ( | GroupIndex | group | ) |
Definition at line 165 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::DelayEvents | ( | Milliseconds | delay | ) |
Definition at line 95 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::DelayEvents | ( | Milliseconds | delay, |
| GroupIndex | group | ||
| ) |
|
inline |
| EventMap::EventId EventMap::ExecuteEvent | ( | ) |
|
inline |
| Milliseconds EventMap::GetTimeUntilEvent | ( | EventId | eventId | ) | const |
| bool EventMap::HasEventScheduled | ( | EventId | eventId | ) | const |
Definition at line 188 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
|
inline |
Definition at line 123 of file EventMap.h.
| void EventMap::Repeat | ( | Milliseconds | minTime, |
| Milliseconds | maxTime | ||
| ) |
| void EventMap::Repeat | ( | Milliseconds | time | ) |
Definition at line 63 of file EventMap.cpp.
| void EventMap::RescheduleEvent | ( | EventId | eventId, |
| Milliseconds | minTime, | ||
| Milliseconds | maxTime, | ||
| GroupIndex | group = 0u, |
||
| PhaseIndex | phase = 0u |
||
| ) |
| void EventMap::RescheduleEvent | ( | EventId | eventId, |
| Milliseconds | time, | ||
| GroupIndex | group = 0u, |
||
| PhaseIndex | phase = 0u |
||
| ) |
Definition at line 52 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::Reset | ( | ) |
Definition at line 21 of file EventMap.cpp.
| void EventMap::ScheduleEvent | ( | EventId | eventId, |
| Milliseconds | minTime, | ||
| Milliseconds | maxTime, | ||
| GroupIndex | group = 0u, |
||
| PhaseIndex | phase = 0u |
||
| ) |
| void EventMap::ScheduleEvent | ( | EventId | eventId, |
| Milliseconds | time, | ||
| GroupIndex | group = 0u, |
||
| PhaseIndex | phase = 0u |
||
| ) |
Definition at line 36 of file EventMap.cpp.
| void EventMap::SetMinimalDelay | ( | EventId | eventId, |
| Milliseconds | delay | ||
| ) |
| void EventMap::SetPhase | ( | PhaseIndex | phase | ) |
Definition at line 28 of file EventMap.cpp.
|
inline |
Definition at line 77 of file EventMap.h.
|
inline |
Definition at line 67 of file EventMap.h.
|
private |
Definition at line 288 of file EventMap.h.
|
private |
Definition at line 294 of file EventMap.h.
|
private |
Definition at line 279 of file EventMap.h.
|
private |
Definition at line 269 of file EventMap.h.