aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/EventMap.h
diff options
context:
space:
mode:
authorCarbenium <carbenium@outlook.com>2020-07-22 00:19:33 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-23 23:59:32 +0100
commit7847589d9ca35de80dce68ac5cf5cf42c77b39a4 (patch)
treee25a3dd63dd23b2b0bb86a7ab1e45cc2a592b058 /src/common/Utilities/EventMap.h
parenta28bc7faaadb6ef7b69eaa8adeec75c970e6eaf3 (diff)
EventMap: Switch internal timer over to std::chrono type
Adds the EventMap::Update(Milliseconds time) overload (cherry picked from commit b9795e44824c7cab58445e4a72d2113ddb451caa)
Diffstat (limited to 'src/common/Utilities/EventMap.h')
-rw-r--r--src/common/Utilities/EventMap.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h
index 820e7539649..8d69524f2be 100644
--- a/src/common/Utilities/EventMap.h
+++ b/src/common/Utilities/EventMap.h
@@ -26,7 +26,7 @@ class TC_COMMON_API EventMap
{
/**
* Internal storage type.
- * Key: Time as uint32 when the event should occur.
+ * Key: Time as TimePoint when the event should occur.
* Value: The event data as uint32.
*
* Structure of event data:
@@ -35,10 +35,10 @@ class TC_COMMON_API EventMap
* - Bit 24 - 31: Phase
* - Pattern: 0xPPGGEEEE
*/
- typedef std::multimap<uint32, uint32> EventStore;
+ typedef std::multimap<TimePoint, uint32> EventStore;
public:
- EventMap() : _time(0), _phase(0), _lastEvent(0) { }
+ EventMap() : _time(TimePoint::min()), _phase(0), _lastEvent(0) { }
/**
* @name Reset
@@ -53,6 +53,16 @@ public:
*/
void Update(uint32 time)
{
+ Update(Milliseconds(time));
+ }
+
+ /**
+ * @name Update
+ * @brief Updates the timer of the event map.
+ * @param time Value in ms to be added to time.
+ */
+ void Update(Milliseconds time)
+ {
_time += time;
}
@@ -226,7 +236,7 @@ private:
* has reached their time value. Its value is changed in the
* Update method.
*/
- uint32 _time;
+ TimePoint _time;
/**
* @name _phase