aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2018-07-18 17:48:15 +0200
committerTreeston <treeston.mmoc@gmail.com>2018-07-18 17:48:15 +0200
commit2ef9d301f0869b443122e2ba543af054c5b0e53c (patch)
treeb4386edef8f6409f39958aced5787e0cc994d3df /src/common/Utilities
parentf93cb448f1d8b8346dff13fffacfd3c9f85edde0 (diff)
Misc: Pass std::chrono types by value everywhere.
Diffstat (limited to 'src/common/Utilities')
-rw-r--r--src/common/Utilities/EventMap.cpp4
-rw-r--r--src/common/Utilities/EventMap.h16
-rw-r--r--src/common/Utilities/EventProcessor.h2
-rw-r--r--src/common/Utilities/Random.cpp2
-rw-r--r--src/common/Utilities/Random.h2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/common/Utilities/EventMap.cpp b/src/common/Utilities/EventMap.cpp
index b82507b5281..ae83ab0571f 100644
--- a/src/common/Utilities/EventMap.cpp
+++ b/src/common/Utilities/EventMap.cpp
@@ -33,7 +33,7 @@ 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*/)
+void EventMap::ScheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/)
{
ScheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase);
}
@@ -49,7 +49,7 @@ 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*/)
+void EventMap::RescheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/)
{
RescheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase);
}
diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h
index e8f062c54fe..6c99665126e 100644
--- a/src/common/Utilities/EventMap.h
+++ b/src/common/Utilities/EventMap.h
@@ -120,7 +120,7 @@ public:
* @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& time, uint32 group = 0, uint8 phase = 0)
+ void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group = 0, uint8 phase = 0)
{
ScheduleEvent(eventId, uint32(time.count()), group, phase);
}
@@ -134,7 +134,7 @@ public:
* @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);
+ void ScheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group = 0, uint32 phase = 0);
/**
* @name ScheduleEvent
@@ -154,7 +154,7 @@ public:
* @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& time, uint32 group = 0, uint8 phase = 0)
+ void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group = 0, uint8 phase = 0)
{
RescheduleEvent(eventId, uint32(time.count()), group, phase);
}
@@ -168,7 +168,7 @@ public:
* @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);
+ void RescheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group = 0, uint32 phase = 0);
/**
* @name RescheduleEvent
@@ -189,7 +189,7 @@ public:
* @brief Repeats the mostly recently executed event.
* @param time Time until in milliseconds as std::chrono::duration the event occurs.
*/
- void Repeat(Milliseconds const& time)
+ void Repeat(Milliseconds time)
{
Repeat(uint32(time.count()));
}
@@ -210,7 +210,7 @@ public:
* @param minTime Minimum time as std::chrono::duration until the event occurs.
* @param maxTime Maximum time as std::chrono::duration until the event occurs.
*/
- void Repeat(Milliseconds const& minTime, Milliseconds const& maxTime)
+ void Repeat(Milliseconds minTime, Milliseconds maxTime)
{
Repeat(uint32(minTime.count()), uint32(maxTime.count()));
}
@@ -235,7 +235,7 @@ public:
* @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
* @param delay Amount of delay in ms as std::chrono::duration.
*/
- void DelayEvents(Milliseconds const& delay)
+ void DelayEvents(Milliseconds delay)
{
DelayEvents(uint32(delay.count()));
}
@@ -256,7 +256,7 @@ public:
* @param delay Amount of delay in ms as std::chrono::duration.
* @param group Group of the events.
*/
- void DelayEvents(Milliseconds const& delay, uint32 group)
+ void DelayEvents(Milliseconds delay, uint32 group)
{
DelayEvents(uint32(delay.count()), group);
}
diff --git a/src/common/Utilities/EventProcessor.h b/src/common/Utilities/EventProcessor.h
index 57246a03831..62af07e6189 100644
--- a/src/common/Utilities/EventProcessor.h
+++ b/src/common/Utilities/EventProcessor.h
@@ -78,7 +78,7 @@ class TC_COMMON_API EventProcessor
void Update(uint32 p_time);
void KillAllEvents(bool force);
void AddEvent(BasicEvent* event, uint64 e_time, bool set_addtime = true);
- void AddEventAtOffset(BasicEvent* event, Milliseconds const& offset) { AddEvent(event, CalculateTime(offset.count())); }
+ void AddEventAtOffset(BasicEvent* event, Milliseconds offset) { AddEvent(event, CalculateTime(offset.count())); }
void ModifyEventTime(BasicEvent* event, uint64 newTime);
uint64 CalculateTime(uint64 t_offset) const { return m_time + t_offset; }
diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp
index ddb285436ec..a693cf486d9 100644
--- a/src/common/Utilities/Random.cpp
+++ b/src/common/Utilities/Random.cpp
@@ -62,7 +62,7 @@ float frand(float min, float max)
return float(GetRng()->Random() * (max - min) + min);
}
-Milliseconds randtime(Milliseconds const& min, Milliseconds const& max)
+Milliseconds randtime(Milliseconds min, Milliseconds max)
{
long long diff = max.count() - min.count();
ASSERT(diff >= 0);
diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h
index ab0dfc7e9e3..50b0578d032 100644
--- a/src/common/Utilities/Random.h
+++ b/src/common/Utilities/Random.h
@@ -35,7 +35,7 @@ TC_COMMON_API uint32 urandms(uint32 min, uint32 max);
TC_COMMON_API uint32 rand32();
/* Return a random time in the range min..max (up to millisecond precision). Only works for values where millisecond difference is a valid uint32. */
-TC_COMMON_API Milliseconds randtime(Milliseconds const& min, Milliseconds const& max);
+TC_COMMON_API Milliseconds randtime(Milliseconds min, Milliseconds max);
/* Return a random number in the range min..max */
TC_COMMON_API float frand(float min, float max);