summaryrefslogtreecommitdiff
path: root/src/common/Utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Utilities')
-rw-r--r--src/common/Utilities/AsyncCallbackProcessor.h10
-rw-r--r--src/common/Utilities/ByteConverter.h10
-rw-r--r--src/common/Utilities/CircularBuffer.h2
-rw-r--r--src/common/Utilities/Containers.h10
-rw-r--r--src/common/Utilities/DataMap.h2
-rw-r--r--src/common/Utilities/Duration.h10
-rw-r--r--src/common/Utilities/EnumFlag.h10
-rw-r--r--src/common/Utilities/EventEmitter.h10
-rw-r--r--src/common/Utilities/EventMap.cpp187
-rw-r--r--src/common/Utilities/EventMap.h189
-rw-r--r--src/common/Utilities/EventProcessor.cpp18
-rw-r--r--src/common/Utilities/EventProcessor.h32
-rw-r--r--src/common/Utilities/Geometry.h10
-rw-r--r--src/common/Utilities/IteratorPair.h10
-rw-r--r--src/common/Utilities/MathUtil.h10
-rw-r--r--src/common/Utilities/MessageBuffer.h10
-rw-r--r--src/common/Utilities/Optional.h10
-rw-r--r--src/common/Utilities/Physics.h10
-rw-r--r--src/common/Utilities/Random.cpp10
-rw-r--r--src/common/Utilities/Random.h10
-rw-r--r--src/common/Utilities/SFMTRand.cpp10
-rw-r--r--src/common/Utilities/SFMTRand.h10
-rw-r--r--src/common/Utilities/SignalHandler.h10
-rw-r--r--src/common/Utilities/SmartEnum.h10
-rw-r--r--src/common/Utilities/StartProcess.cpp10
-rw-r--r--src/common/Utilities/StartProcess.h10
-rw-r--r--src/common/Utilities/StringConvert.h10
-rw-r--r--src/common/Utilities/StringFormat.cpp10
-rw-r--r--src/common/Utilities/StringFormat.h10
-rw-r--r--src/common/Utilities/TaskScheduler.cpp10
-rw-r--r--src/common/Utilities/TaskScheduler.h10
-rw-r--r--src/common/Utilities/Timer.cpp10
-rw-r--r--src/common/Utilities/Timer.h10
-rw-r--r--src/common/Utilities/Tokenize.cpp10
-rw-r--r--src/common/Utilities/Tokenize.h10
-rw-r--r--src/common/Utilities/Tuples.h10
-rw-r--r--src/common/Utilities/Types.h10
-rw-r--r--src/common/Utilities/Util.cpp10
-rw-r--r--src/common/Utilities/Util.h10
-rw-r--r--src/common/Utilities/advstd.h10
40 files changed, 338 insertions, 432 deletions
diff --git a/src/common/Utilities/AsyncCallbackProcessor.h b/src/common/Utilities/AsyncCallbackProcessor.h
index 68566809a6..2ca6674a5a 100644
--- a/src/common/Utilities/AsyncCallbackProcessor.h
+++ b/src/common/Utilities/AsyncCallbackProcessor.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/ByteConverter.h b/src/common/Utilities/ByteConverter.h
index 0c972ba47f..cce9312705 100644
--- a/src/common/Utilities/ByteConverter.h
+++ b/src/common/Utilities/ByteConverter.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/CircularBuffer.h b/src/common/Utilities/CircularBuffer.h
index 4c23099c9e..55681c87ba 100644
--- a/src/common/Utilities/CircularBuffer.h
+++ b/src/common/Utilities/CircularBuffer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE
+# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>
*
* This file was based on
* https://embeddedartistry.com/blog/2017/05/17/creating-a-circular-buffer-in-c-and-c/
diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h
index ca89e7de09..22e133d027 100644
--- a/src/common/Utilities/Containers.h
+++ b/src/common/Utilities/Containers.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/DataMap.h b/src/common/Utilities/DataMap.h
index 170539a673..31910f9453 100644
--- a/src/common/Utilities/DataMap.h
+++ b/src/common/Utilities/DataMap.h
@@ -1,5 +1,5 @@
/*
- * Originally written by Rochet2 - Copyright (C) 2018+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: http://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE
+ * Originally written by Rochet2 - Copyright (C) 2018+ AzerothCore <www.azerothcore.org>
*/
#ifndef _DATA_MAP_H_
diff --git a/src/common/Utilities/Duration.h b/src/common/Utilities/Duration.h
index ed6bbf8817..d5138b6a67 100644
--- a/src/common/Utilities/Duration.h
+++ b/src/common/Utilities/Duration.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/EnumFlag.h b/src/common/Utilities/EnumFlag.h
index d02232cfce..dea8d253e7 100644
--- a/src/common/Utilities/EnumFlag.h
+++ b/src/common/Utilities/EnumFlag.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/EventEmitter.h b/src/common/Utilities/EventEmitter.h
index 77755935bd..1b72e472bc 100644
--- a/src/common/Utilities/EventEmitter.h
+++ b/src/common/Utilities/EventEmitter.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/EventMap.cpp b/src/common/Utilities/EventMap.cpp
index 00dac4a6db..1b175a47ef 100644
--- a/src/common/Utilities/EventMap.cpp
+++ b/src/common/Utilities/EventMap.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -21,113 +21,81 @@
void EventMap::Reset()
{
_eventMap.clear();
- _time = 0;
- _phase = 0;
+ _time = TimePoint::min();
+ _phaseMask = 0;
}
-void EventMap::SetPhase(uint8 phase)
+void EventMap::SetPhase(PhaseIndex phase)
{
if (!phase)
- {
- _phase = 0;
- }
- else if (phase <= 8)
- {
- _phase = (1 << (phase - 1));
- }
+ _phaseMask = 0;
+ else if (phase <= sizeof(PhaseMask) * 8)
+ _phaseMask = PhaseMask(1u << (phase - 1u));
}
-void EventMap::AddPhase(uint8 phase)
+void EventMap::AddPhase(PhaseIndex phase)
{
- if (phase && phase <= 8)
- {
- _phase |= (1 << (phase - 1));
- }
+ if (phase && phase <= sizeof(PhaseMask) * 8)
+ _phaseMask |= PhaseMask(1u << (phase - 1u));
}
-void EventMap::RemovePhase(uint8 phase)
+void EventMap::RemovePhase(PhaseIndex phase)
{
- if (phase && phase <= 8)
- {
- _phase &= ~(1 << (phase - 1));
- }
+ if (phase && phase <= sizeof(PhaseMask) * 8)
+ _phaseMask &= PhaseMask(~(1u << (phase - 1u)));
}
-void EventMap::ScheduleEvent(uint32 eventId, uint32 time, uint32 group /*= 0*/, uint32 phase /*= 0*/)
+void EventMap::ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group /*= 0u*/, PhaseIndex phase /*= 0u*/)
{
- if (group && group <= 8)
- {
- eventId |= (1 << (group + 15));
- }
-
- if (phase && phase <= 8)
- {
- eventId |= (1 << (phase + 23));
- }
-
- _eventMap.emplace(_time + time, eventId);
-}
+ if (group > sizeof(GroupMask) * 8)
+ return;
-void EventMap::ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group /*= 0*/, uint8 phase /* = 0*/)
-{
- ScheduleEvent(eventId, time.count(), group, phase);
-}
+ if (phase > sizeof(PhaseMask) * 8)
+ return;
-void EventMap::ScheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/)
-{
- ScheduleEvent(eventId, randtime(minTime, maxTime).count(), group, phase);
+ _eventMap.emplace(_time + time, Event(eventId, group, phase));
}
-void EventMap::RescheduleEvent(uint32 eventId, uint32 time, uint32 groupId /*= 0*/, uint32 phase/* = 0*/)
+void EventMap::ScheduleEvent(EventId eventId, Milliseconds minTime, Milliseconds maxTime, GroupIndex group /*= 0u*/, PhaseIndex phase /*= 0u*/)
{
- CancelEvent(eventId);
- ScheduleEvent(eventId, time, groupId, phase);
+ ScheduleEvent(eventId, randtime(minTime, maxTime), group, phase);
}
-void EventMap::RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group /*= 0*/, uint8 phase /* = 0*/)
+void EventMap::RescheduleEvent(EventId eventId, Milliseconds minTime, Milliseconds maxTime, GroupIndex group /*= 0u*/, PhaseIndex phase /*= 0u*/)
{
CancelEvent(eventId);
- ScheduleEvent(eventId, time.count(), group, phase);
+ ScheduleEvent(eventId, randtime(minTime, maxTime), group, phase);
}
-void EventMap::RescheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/)
+void EventMap::RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group /*= 0u*/, PhaseIndex phase /*= 0u*/)
{
CancelEvent(eventId);
- ScheduleEvent(eventId, randtime(minTime, maxTime).count(), group, phase);
-}
-
-void EventMap::RepeatEvent(uint32 time)
-{
- _eventMap.emplace(_time + time, _lastEvent);
+ ScheduleEvent(eventId, time, group, phase);
}
void EventMap::Repeat(Milliseconds time)
{
- RepeatEvent(time.count());
+ _eventMap.emplace(_time + time, _lastEvent);
}
void EventMap::Repeat(Milliseconds minTime, Milliseconds maxTime)
{
- RepeatEvent(randtime(minTime, maxTime).count());
+ Repeat(randtime(minTime, maxTime));
}
-uint32 EventMap::ExecuteEvent()
+EventMap::EventId EventMap::ExecuteEvent()
{
while (!Empty())
{
auto const& itr = _eventMap.begin();
if (itr->first > _time)
- {
return 0;
- }
- else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase))
- {
+ else if (_phaseMask && itr->second._phaseMask && !(itr->second._phaseMask & _phaseMask))
_eventMap.erase(itr);
- }
else
{
- uint32 eventId = (itr->second & 0x0000FFFF);
+ auto eventId = itr->second._id;
_lastEvent = itr->second;
_eventMap.erase(itr);
return eventId;
@@ -137,30 +105,32 @@ uint32 EventMap::ExecuteEvent()
return 0;
}
-void EventMap::DelayEvents(uint32 delay)
-{
- _time = delay < _time ? _time - delay : 0;
-}
-
void EventMap::DelayEvents(Milliseconds delay)
{
- DelayEvents(delay.count());
+ if (Empty())
+ return;
+
+ EventStore delayed = std::move(_eventMap);
+ for (auto itr = delayed.begin(); itr != delayed.end();)
+ {
+ auto node = delayed.extract(itr++);
+ node.key() = node.key() + delay;
+ _eventMap.insert(_eventMap.end(), std::move(node));
+ }
}
-void EventMap::DelayEvents(uint32 delay, uint32 group)
+void EventMap::DelayEvents(Milliseconds delay, GroupIndex group)
{
- if (group > 8 || Empty())
- {
+ if (group > sizeof(GroupMask) * 8 || Empty())
return;
- }
EventStore delayed;
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ for (auto itr = _eventMap.begin(); itr != _eventMap.end();)
{
- if (!group || (itr->second & (1 << (group + 15))))
+ if (!group || (itr->second._groupMask & GroupMask(1u << (group - 1u))))
{
- delayed.insert(EventStore::value_type(itr->first + delay, itr->second));
+ delayed.emplace(itr->first + delay, itr->second);
itr = _eventMap.erase(itr);
continue;
}
@@ -171,13 +141,13 @@ void EventMap::DelayEvents(uint32 delay, uint32 group)
_eventMap.insert(delayed.begin(), delayed.end());
}
-void EventMap::DelayEventsToMax(uint32 delay, uint32 group)
+void EventMap::DelayEventsToMax(Milliseconds delay, GroupIndex group)
{
for (auto itr = _eventMap.begin(); itr != _eventMap.end();)
{
- if (itr->first < _time + delay && (group == 0 || ((1 << (group + 15)) & itr->second)))
+ if (itr->first < _time + delay && (!group || (itr->second._groupMask & GroupMask(1u << (group - 1u)))))
{
- ScheduleEvent(itr->second, delay);
+ ScheduleEvent(itr->second._id, delay, group);
_eventMap.erase(itr);
itr = _eventMap.begin();
continue;
@@ -187,16 +157,14 @@ void EventMap::DelayEventsToMax(uint32 delay, uint32 group)
}
}
-void EventMap::CancelEvent(uint32 eventId)
+void EventMap::CancelEvent(EventId eventId)
{
if (Empty())
- {
return;
- }
for (auto itr = _eventMap.begin(); itr != _eventMap.end();)
{
- if (eventId == (itr->second & 0x0000FFFF))
+ if (eventId == itr->second._id)
{
itr = _eventMap.erase(itr);
continue;
@@ -206,17 +174,14 @@ void EventMap::CancelEvent(uint32 eventId)
}
}
-void EventMap::CancelEventGroup(uint32 group)
+void EventMap::CancelEventGroup(GroupIndex group)
{
- if (!group || group > 8 || Empty())
- {
+ if (!group || group > sizeof(GroupMask) * 8 || Empty())
return;
- }
- uint32 groupMask = (1 << (group + 15));
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ for (auto itr = _eventMap.begin(); itr != _eventMap.end();)
{
- if (itr->second & groupMask)
+ if (itr->second._groupMask & GroupMask(1u << (group - 1u)))
{
_eventMap.erase(itr);
itr = _eventMap.begin();
@@ -227,39 +192,21 @@ void EventMap::CancelEventGroup(uint32 group)
}
}
-uint32 EventMap::GetNextEventTime(uint32 eventId) const
+bool EventMap::IsInPhase(PhaseIndex phase) const
{
- if (Empty())
- {
- return 0;
- }
-
- for (auto const& itr : _eventMap)
- {
- if (eventId == (itr.second & 0x0000FFFF))
- {
- return itr.first;
- }
- }
-
- return 0;
+ return phase <= sizeof(PhaseIndex) * 8 && (!phase || _phaseMask & PhaseMask(1u << (phase - 1u)));
}
-uint32 EventMap::GetNextEventTime() const
+Milliseconds EventMap::GetTimeUntilEvent(EventId eventId) const
{
- return Empty() ? 0 : _eventMap.begin()->first;
-}
+ for (auto const& [time, event] : _eventMap)
+ if (eventId == event._id)
+ return std::chrono::duration_cast<Milliseconds>(time - _time);
-bool EventMap::IsInPhase(uint8 phase)
-{
- return phase <= 8 && (!phase || _phase & (1 << (phase - 1)));
+ return Milliseconds::max();
}
-Milliseconds EventMap::GetTimeUntilEvent(uint32 eventId) const
+bool EventMap::HasTimeUntilEvent(EventId eventId) const
{
- for (std::pair<uint32 const, uint32> const& itr : _eventMap)
- if (eventId == (itr.second & 0x0000FFFF))
- return std::chrono::duration_cast<Milliseconds>(Milliseconds(itr.first) - Milliseconds(_time));
-
- return Milliseconds::max();
+ return GetTimeUntilEvent(eventId) != Milliseconds::max();
}
diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h
index 1d3df6222e..a382910b82 100644
--- a/src/common/Utilities/EventMap.h
+++ b/src/common/Utilities/EventMap.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -24,18 +24,31 @@
class EventMap
{
- /**
- * Internal storage type.
- * Key: Time as TimePoint when the event should occur.
- * Value: The event data as uint32.
- *
- * Structure of event data:
- * - Bit 0 - 15: Event Id.
- * - Bit 16 - 23: Group
- * - Bit 24 - 31: Phase
- * - Pattern: 0xPPGGEEEE
- */
- typedef std::multimap<uint32, uint32> EventStore;
+ using EventId = uint16;
+ using GroupIndex = uint8;
+ using GroupMask = uint8;
+ using PhaseIndex = uint8;
+ using PhaseMask = uint8;
+ struct Event
+ {
+ Event() = default;
+ Event(EventId id, GroupIndex groupIndex, PhaseIndex phaseIndex) :
+ _id(id),
+ _groupMask(groupIndex ? GroupMask(1u << (groupIndex - 1u)) : 0u),
+ _phaseMask(phaseIndex ? PhaseMask(1u << (phaseIndex - 1u)) : 0u)
+ {
+ }
+
+ EventId _id = 0u;
+ GroupMask _groupMask = 0u;
+ PhaseMask _phaseMask = 0u;
+ };
+
+ /**
+ * Internal storage type.
+ * Key: Time as TimePoint when the event should occur.
+ */
+ using EventStore = std::multimap<TimePoint, Event>;
public:
EventMap() { }
@@ -47,13 +60,13 @@ public:
void Reset();
/**
- * @name Update
- * @brief Updates the timer of the event map.
- * @param time Value to be added to time.
- */
+ * @name Update
+ * @brief Updates the timer of the event map.
+ * @param time Value to be added to time.
+ */
void Update(uint32 time)
{
- _time += time;
+ Update(Milliseconds(time));
}
/**
@@ -63,37 +76,23 @@ public:
*/
void Update(Milliseconds time)
{
- _time += static_cast<uint32>(time.count());
- }
-
- /**
- * @name GetTimer
- * @return Current timer value.
- */
- [[nodiscard]] uint32 GetTimer() const
- {
- return _time;
- }
-
- void SetTimer(uint32 time)
- {
- _time = time;
+ _time += time;
}
/**
* @name GetPhaseMask
* @return Active phases as mask.
*/
- [[nodiscard]] uint8 GetPhaseMask() const
+ PhaseMask GetPhaseMask() const
{
- return _phase;
+ return _phaseMask;
}
/**
* @name Empty
* @return True, if there are no events scheduled.
*/
- [[nodiscard]] bool Empty() const
+ bool Empty() const
{
return _eventMap.empty();
}
@@ -103,31 +102,21 @@ public:
* @brief Sets the phase of the map (absolute).
* @param phase Phase which should be set. Values: 1 - 8. 0 resets phase.
*/
- void SetPhase(uint8 phase);
+ void SetPhase(PhaseIndex phase);
/**
* @name AddPhase
- * @brief Activates the given phase (bitwise).
+ * @brief Activates the given phase (absolute).
* @param phase Phase which should be activated. Values: 1 - 8
*/
- void AddPhase(uint8 phase);
+ void AddPhase(PhaseIndex phase);
/**
* @name RemovePhase
- * @brief Deactivates the given phase (bitwise).
+ * @brief Deactivates the given phase (absolute).
* @param phase Phase which should be deactivated. Values: 1 - 8.
*/
- void RemovePhase(uint8 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.
- */
- void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint32 phase = 0);
+ void RemovePhase(PhaseIndex phase);
/**
* @name ScheduleEvent
@@ -137,7 +126,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 time, uint32 group = 0, uint8 phase = 0);
+ void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group = 0u, PhaseIndex phase = 0u);
/**
* @name ScheduleEvent
@@ -148,17 +137,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 minTime, Milliseconds maxTime, uint32 group = 0, uint32 phase = 0);
-
- /**
- * @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.
- */
- void RescheduleEvent(uint32 eventId, uint32 time, uint32 groupId = 0, uint32 phase = 0);
+ void ScheduleEvent(EventId eventId, Milliseconds minTime, Milliseconds maxTime, GroupIndex group = 0u, PhaseIndex phase = 0u);
/**
* @name RescheduleEvent
@@ -168,7 +147,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 time, uint32 group = 0, uint8 phase = 0);
+ void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group = 0u, PhaseIndex phase = 0u);
/**
* @name RescheduleEvent
@@ -179,25 +158,17 @@ 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 minTime, Milliseconds maxTime, uint32 group = 0, uint32 phase = 0);
-
- /**
- * @name RepeatEvent
- * @brief Repeats the most recently executed event.
- * @param time Time until the event occurs as std::chrono type.
- */
- void RepeatEvent(uint32 time);
+ void RescheduleEvent(EventId eventId, Milliseconds minTime, Milliseconds maxTime, GroupIndex group = 0u, PhaseIndex phase = 0u);
/**
- * @name RepeatEvent
+ * @name Repeat
* @brief Repeats the most recently executed event.
* @param time Time until the event occurs as std::chrono type.
*/
void Repeat(Milliseconds time);
/**
-
- * @name RepeatEvent
+ * @name Repeat
* @brief Repeats the most recently executed 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.
@@ -209,14 +180,7 @@ public:
* @brief Returns the next event to execute and removes it from map.
* @return Id of the event to execute.
*/
- uint32 ExecuteEvent();
-
- /**
- * @name DelayEvents
- * @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.
- */
- void DelayEvents(uint32 delay);
+ EventId ExecuteEvent();
/**
* @name DelayEvents
@@ -228,62 +192,57 @@ public:
/**
* @name DelayEvents
* @brief Delay all events of the same group.
- * @param delay Amount of delay.
+ * @param delay Amount of delay as std::chrono type.
* @param group Group of the events.
*/
- void DelayEvents(uint32 delay, uint32 group);
+ void DelayEvents(Milliseconds delay, GroupIndex group);
/**
* @name EventsEvents
* @brief Delay all events of the same group.
- * @param delay Amount of delay.
+ * @param delay Amount of delay as std::chrono type.
* @param group Group of the events.
*/
- void DelayEventsToMax(uint32 delay, uint32 group);
+ void DelayEventsToMax(Milliseconds delay, GroupIndex group);
/**
* @name CancelEvent
* @brief Cancels all events of the specified id.
* @param eventId Event id to cancel.
*/
- void CancelEvent(uint32 eventId);
+ void CancelEvent(EventId eventId);
/**
* @name CancelEventGroup
* @brief Cancel events belonging to specified group.
* @param group Group to cancel.
*/
- void CancelEventGroup(uint32 group);
-
- /**
- * @name GetNextEventTime
- * @brief Returns closest occurence of specified event.
- * @param eventId Wanted event id.
- * @return Time of found event.
- */
- [[nodiscard]] uint32 GetNextEventTime(uint32 eventId) const;
-
- /**
- * @name GetNextEventTime
- * @return Time of next event.
- */
- [[nodiscard]] uint32 GetNextEventTime() const;
+ void CancelEventGroup(GroupIndex group);
/**
* @name IsInPhase
- * @brief Returns wether event map is in specified phase or not.
+ * @brief Returns whether event map is in specified phase or not.
* @param phase Wanted phase.
* @return True, if phase of event map contains specified phase.
*/
- bool IsInPhase(uint8 phase);
+ bool IsInPhase(PhaseIndex phase) const;
/**
* @name GetTimeUntilEvent
* @brief Returns time as std::chrono type until next event.
- * @param eventId of the event.
+ * @param eventId The id of the event.
* @return Time of next event. If event is not scheduled returns Milliseconds::max()
+ * @return Time of next event.
*/
- Milliseconds GetTimeUntilEvent(uint32 eventId) const;
+ Milliseconds GetTimeUntilEvent(EventId eventId) const;
+
+ /**
+ * @name HasTimeUntilEvent
+ * @brief Returns whether an event is scheduled
+ * @param eventId The id of the event.
+ * @return True if event is scheduled
+ */
+ bool HasTimeUntilEvent(EventId eventId) const;
private:
/**
@@ -296,23 +255,23 @@ private:
* has reached their time value. Its value is changed in the
* Update method.
*/
- uint32 _time{ 0 };
+ TimePoint _time{ TimePoint::min() };
/**
- * @name _phase
+ * @name _phaseMask
* @brief 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.
*/
- uint32 _phase{0};
+ PhaseMask _phaseMask{ 0 };
/**
* @name _lastEvent
* @brief Stores information on the most recently executed event
*/
- uint32 _lastEvent{0};
+ Event _lastEvent;
/**
* @name _eventMap
diff --git a/src/common/Utilities/EventProcessor.cpp b/src/common/Utilities/EventProcessor.cpp
index 3943a09b8d..5d3fb3427a 100644
--- a/src/common/Utilities/EventProcessor.cpp
+++ b/src/common/Utilities/EventProcessor.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -75,7 +75,7 @@ void EventProcessor::Update(uint32 p_time)
// Reschedule non deletable events to be checked at
// the next update tick
- AddEvent(event, CalculateTime(1), false, 0);
+ AddEvent(event, CalculateTime(1), false);
}
}
@@ -133,13 +133,13 @@ void EventProcessor::CancelEventGroup(uint8 group)
}
}
-void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime, uint8 eventGroup)
+void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime /*= true*/, uint8 eventGroup /*= 0*/)
{
if (set_addtime)
Event->m_addTime = m_time;
Event->m_execTime = e_time;
Event->m_eventGroup = eventGroup;
- m_events.insert(std::pair<uint64, BasicEvent*>(e_time, Event));
+ m_events.emplace(e_time, Event);
}
void EventProcessor::ModifyEventTime(BasicEvent* event, Milliseconds newTime)
@@ -151,7 +151,7 @@ void EventProcessor::ModifyEventTime(BasicEvent* event, Milliseconds newTime)
event->m_execTime = newTime.count();
m_events.erase(itr);
- m_events.insert(std::pair<uint64, BasicEvent*>(newTime.count(), event));
+ m_events.emplace(newTime.count(), event);
break;
}
}
diff --git a/src/common/Utilities/EventProcessor.h b/src/common/Utilities/EventProcessor.h
index 3e7896bb33..644c2b643b 100644
--- a/src/common/Utilities/EventProcessor.h
+++ b/src/common/Utilities/EventProcessor.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -100,20 +100,19 @@ class EventProcessor
void Update(uint32 p_time);
void KillAllEvents(bool force);
- void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true) { AddEvent(Event, e_time, set_addtime, 0); };
- void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime, uint8 eventGroup);
- template<typename T>
- is_lambda_event<T> AddEvent(T&& event, Milliseconds e_time, bool set_addtime = true) { AddEvent(new LambdaBasicEvent<T>(std::move(event)), e_time, set_addtime); }
- void AddEventAtOffset(BasicEvent* event, Milliseconds offset) { AddEvent(event, CalculateTime(offset.count()), true, 0); }
- void AddEventAtOffset(BasicEvent* event, Milliseconds offset, Milliseconds offset2) { AddEvent(event, CalculateTime(randtime(offset, offset2).count()), true, false); }
- template<typename T>
- is_lambda_event<T> AddEventAtOffset(T&& event, Milliseconds offset, uint8 eventGroup) { AddEvent(new LambdaBasicEvent<T>(std::move(event)), CalculateTime(offset.count()), true, eventGroup); };
+
+ void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true, uint8 eventGroup = 0);
template<typename T>
- is_lambda_event<T> AddEventAtOffset(T&& event, Milliseconds offset, Milliseconds offset2, uint8 eventGroup) { AddEvent(new LambdaBasicEvent<T>(std::move(event)), CalculateTime(randtime(offset, offset2).count()), true, eventGroup); };
+ is_lambda_event<T> AddEvent(T&& event, Milliseconds e_time, bool set_addtime = true, uint8 eventGroup = 0) { AddEvent(new LambdaBasicEvent<T>(std::move(event)), e_time.count(), set_addtime, eventGroup); }
+
+ void AddEventAtOffset(BasicEvent* event, Milliseconds offset, uint8 eventGroup = 0) { AddEvent(event, CalculateTime(offset.count()), true, eventGroup); }
template<typename T>
- is_lambda_event<T> AddEventAtOffset(T&& event, Milliseconds offset) { AddEventAtOffset(new LambdaBasicEvent<T>(std::move(event)), offset); }
+ is_lambda_event<T> AddEventAtOffset(T&& event, Milliseconds offset, uint8 eventGroup = 0) { AddEventAtOffset(new LambdaBasicEvent<T>(std::move(event)), offset, eventGroup); };
+
+ void AddEventAtOffset(BasicEvent* event, Milliseconds offset, Milliseconds offset2, uint8 eventGroup = 0) { AddEvent(event, CalculateTime(randtime(offset, offset2).count()), true, eventGroup); }
template<typename T>
- is_lambda_event<T> AddEventAtOffset(T&& event, Milliseconds offset, Milliseconds offset2) { AddEventAtOffset(new LambdaBasicEvent<T>(std::move(event)), offset, offset2); }
+ is_lambda_event<T> AddEventAtOffset(T&& event, Milliseconds offset, Milliseconds offset2, uint8 eventGroup = 0) { AddEventAtOffset(new LambdaBasicEvent<T>(std::move(event)), offset, offset2, eventGroup); };
+
void ModifyEventTime(BasicEvent* event, Milliseconds newTime);
[[nodiscard]] uint64 CalculateTime(uint64 t_offset) const;
@@ -121,6 +120,7 @@ class EventProcessor
[[nodiscard]] uint64 CalculateQueueTime(uint64 delay) const;
void CancelEventGroup(uint8 group);
+ bool HasEvents() const { return !m_events.empty(); }
protected:
uint64 m_time{0};
diff --git a/src/common/Utilities/Geometry.h b/src/common/Utilities/Geometry.h
index 75affe53bc..8220479f87 100644
--- a/src/common/Utilities/Geometry.h
+++ b/src/common/Utilities/Geometry.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/IteratorPair.h b/src/common/Utilities/IteratorPair.h
index 9ecef39e6f..bbb920a3f7 100644
--- a/src/common/Utilities/IteratorPair.h
+++ b/src/common/Utilities/IteratorPair.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/MathUtil.h b/src/common/Utilities/MathUtil.h
index f1df43e7db..cd5bbc7da4 100644
--- a/src/common/Utilities/MathUtil.h
+++ b/src/common/Utilities/MathUtil.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/MessageBuffer.h b/src/common/Utilities/MessageBuffer.h
index f0b3db9ff3..87bd79f424 100644
--- a/src/common/Utilities/MessageBuffer.h
+++ b/src/common/Utilities/MessageBuffer.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Optional.h b/src/common/Utilities/Optional.h
index 594827bcfd..5c75752b9c 100644
--- a/src/common/Utilities/Optional.h
+++ b/src/common/Utilities/Optional.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Physics.h b/src/common/Utilities/Physics.h
index 3f4d93a67d..cee3046db3 100644
--- a/src/common/Utilities/Physics.h
+++ b/src/common/Utilities/Physics.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp
index babf235005..4794b75606 100644
--- a/src/common/Utilities/Random.cpp
+++ b/src/common/Utilities/Random.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h
index 654b1817d2..e689079579 100644
--- a/src/common/Utilities/Random.h
+++ b/src/common/Utilities/Random.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/SFMTRand.cpp b/src/common/Utilities/SFMTRand.cpp
index d21432bc94..b0125f5b76 100644
--- a/src/common/Utilities/SFMTRand.cpp
+++ b/src/common/Utilities/SFMTRand.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/SFMTRand.h b/src/common/Utilities/SFMTRand.h
index e24cfe198d..61e704162d 100644
--- a/src/common/Utilities/SFMTRand.h
+++ b/src/common/Utilities/SFMTRand.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/SignalHandler.h b/src/common/Utilities/SignalHandler.h
index 42283f51cd..a8426e2e23 100644
--- a/src/common/Utilities/SignalHandler.h
+++ b/src/common/Utilities/SignalHandler.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/SmartEnum.h b/src/common/Utilities/SmartEnum.h
index 0d9fe30662..a3ce5608a0 100644
--- a/src/common/Utilities/SmartEnum.h
+++ b/src/common/Utilities/SmartEnum.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/StartProcess.cpp b/src/common/Utilities/StartProcess.cpp
index 5218b6b3ac..7826ec71b4 100644
--- a/src/common/Utilities/StartProcess.cpp
+++ b/src/common/Utilities/StartProcess.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/StartProcess.h b/src/common/Utilities/StartProcess.h
index 6de13d1be9..a375a9b8c4 100644
--- a/src/common/Utilities/StartProcess.h
+++ b/src/common/Utilities/StartProcess.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/StringConvert.h b/src/common/Utilities/StringConvert.h
index 4f51b9746e..b2fc5d7904 100644
--- a/src/common/Utilities/StringConvert.h
+++ b/src/common/Utilities/StringConvert.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/StringFormat.cpp b/src/common/Utilities/StringFormat.cpp
index ff116d5883..55edca8155 100644
--- a/src/common/Utilities/StringFormat.cpp
+++ b/src/common/Utilities/StringFormat.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/StringFormat.h b/src/common/Utilities/StringFormat.h
index d4d93f2324..8befb6ffbd 100644
--- a/src/common/Utilities/StringFormat.h
+++ b/src/common/Utilities/StringFormat.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/TaskScheduler.cpp b/src/common/Utilities/TaskScheduler.cpp
index 8e07e0ed03..285242629d 100644
--- a/src/common/Utilities/TaskScheduler.cpp
+++ b/src/common/Utilities/TaskScheduler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h
index 4e422d6375..2dcc72e926 100644
--- a/src/common/Utilities/TaskScheduler.h
+++ b/src/common/Utilities/TaskScheduler.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Timer.cpp b/src/common/Utilities/Timer.cpp
index 54913163fe..e8941fff1c 100644
--- a/src/common/Utilities/Timer.cpp
+++ b/src/common/Utilities/Timer.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Timer.h b/src/common/Utilities/Timer.h
index e8d3924392..9dca405999 100644
--- a/src/common/Utilities/Timer.h
+++ b/src/common/Utilities/Timer.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Tokenize.cpp b/src/common/Utilities/Tokenize.cpp
index 3ceb57f087..d71feb9ea4 100644
--- a/src/common/Utilities/Tokenize.cpp
+++ b/src/common/Utilities/Tokenize.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Tokenize.h b/src/common/Utilities/Tokenize.h
index 6ee20ca53e..4ade43a4fe 100644
--- a/src/common/Utilities/Tokenize.h
+++ b/src/common/Utilities/Tokenize.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Tuples.h b/src/common/Utilities/Tuples.h
index f648e20e64..076c322256 100644
--- a/src/common/Utilities/Tuples.h
+++ b/src/common/Utilities/Tuples.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Types.h b/src/common/Utilities/Types.h
index ad7b2c4983..f15bc06140 100644
--- a/src/common/Utilities/Types.h
+++ b/src/common/Utilities/Types.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp
index 56cc75e166..6e5757f1ee 100644
--- a/src/common/Utilities/Util.cpp
+++ b/src/common/Utilities/Util.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index e5ced06991..b1fbeabb33 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
diff --git a/src/common/Utilities/advstd.h b/src/common/Utilities/advstd.h
index eafe58e4cd..abf77201f3 100644
--- a/src/common/Utilities/advstd.h
+++ b/src/common/Utilities/advstd.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along