aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Utilities/Duration.h5
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp1
-rw-r--r--src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.cpp22
-rw-r--r--src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.h1
4 files changed, 14 insertions, 15 deletions
diff --git a/src/common/Utilities/Duration.h b/src/common/Utilities/Duration.h
index b4c3f17cb3e..f506467abda 100644
--- a/src/common/Utilities/Duration.h
+++ b/src/common/Utilities/Duration.h
@@ -18,12 +18,7 @@
#ifndef _DURATION_H_
#define _DURATION_H_
-// HACKS TERRITORY
-#if __has_include(<__msvc_chrono.hpp>)
-#include <__msvc_chrono.hpp> // skip all the formatting/istream/locale/mutex bloat
-#else
#include <chrono>
-#endif
/// Milliseconds shorthand typedef.
typedef std::chrono::milliseconds Milliseconds;
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index fd6952e22fd..c4087827424 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -35,6 +35,7 @@
#include <numeric>
#include <sstream>
#include <cctype>
+#include <cmath>
// temporary hack until includes are sorted out (don't want to pull in Windows.h)
#ifdef GetClassName
diff --git a/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.cpp b/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.cpp
index c68a657c066..85249caab78 100644
--- a/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.cpp
+++ b/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.cpp
@@ -25,12 +25,14 @@ void EntityFragmentsHolder::Add(EntityFragment fragment, bool update)
{
ASSERT(Count < Ids.size());
- auto insertSorted = [](auto& arr, uint8& count, EntityFragment f)
+ auto insertSorted = []<size_t N>(std::array<EntityFragment, N>& arr, uint8& count, EntityFragment f)
{
- auto where = std::ranges::lower_bound(arr.begin(), arr.begin() + count, f);
+ auto end = arr.begin() + count;
+ auto where = std::ranges::lower_bound(arr.begin(), end, f);
if (*where == f)
return std::pair(where, false);
- std::rotate(where, arr.begin() + count, arr.begin() + count + 1);
+
+ std::ranges::move_backward(where, end, end + 1);
++count;
*where = f;
return std::pair(where, true);
@@ -44,7 +46,7 @@ void EntityFragmentsHolder::Add(EntityFragment fragment, bool update)
ASSERT(UpdateableCount < UpdateableIds.size());
auto insertedItr = insertSorted(UpdateableIds, UpdateableCount, fragment).first;
- std::ptrdiff_t index = std::distance(UpdateableIds.begin(), insertedItr);
+ std::ptrdiff_t index = std::ranges::distance(UpdateableIds.begin(), insertedItr);
uint8 maskLowPart = ContentsChangedMask & ((1 << index) - 1);
uint8 maskHighPart = (ContentsChangedMask & ~((1 << index) - 1)) << (1 + IsIndirectFragment(fragment));
ContentsChangedMask = maskLowPart | maskHighPart;
@@ -65,13 +67,13 @@ void EntityFragmentsHolder::Add(EntityFragment fragment, bool update)
void EntityFragmentsHolder::Remove(EntityFragment fragment)
{
- auto removeSorted = [](auto& arr, uint8& count, EntityFragment f)
+ auto removeSorted = []<size_t N>(std::array<EntityFragment, N>& arr, uint8& count, EntityFragment f)
{
- auto where = std::ranges::find(arr.begin(), arr.begin() + count, f);
- if (where != arr.end())
+ auto end = arr.begin() + count;
+ auto where = std::ranges::find(arr.begin(), end, f);
+ if (where != end)
{
- *where = EntityFragment::End;
- std::rotate(where, where + 1, arr.begin() + count);
+ *std::ranges::move(where + 1, end, where).out = EntityFragment::End;
--count;
return std::pair(where, true);
}
@@ -86,7 +88,7 @@ void EntityFragmentsHolder::Remove(EntityFragment fragment)
auto [removedItr, removed] = removeSorted(UpdateableIds, UpdateableCount, fragment);
if (removed)
{
- std::ptrdiff_t index = std::distance(UpdateableIds.begin(), removedItr);
+ std::ptrdiff_t index = std::ranges::distance(UpdateableIds.begin(), removedItr);
uint8 maskLowPart = ContentsChangedMask & ((1 << index) - 1);
uint8 maskHighPart = (ContentsChangedMask & ~((1 << index) - 1)) >> (1 + IsIndirectFragment(fragment));
ContentsChangedMask = maskLowPart | maskHighPart;
diff --git a/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.h b/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.h
index 42d1ec52063..dba9e0a11a9 100644
--- a/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.h
+++ b/src/server/game/Entities/Object/Updates/WowCSEntityDefinitions.h
@@ -19,6 +19,7 @@
#define TRINITYCORE_WOWCS_ENTITY_DEFINITIONS_H
#include "Define.h"
+#include <array>
#include <span>
namespace WowCS