aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix10.diff20
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix11.diff13
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix12.diff192
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix15.diff288
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix17.diff13
-rw-r--r--dep/g3dlite/Readme.txt1
-rw-r--r--dep/g3dlite/include/G3D/AABox.h10
-rw-r--r--dep/g3dlite/include/G3D/Array.h4
-rw-r--r--dep/g3dlite/include/G3D/AtomicInt32.h4
-rw-r--r--dep/g3dlite/include/G3D/HashTrait.h1
-rw-r--r--dep/g3dlite/include/G3D/Random.h1
-rw-r--r--dep/g3dlite/include/G3D/System.h4
-rw-r--r--dep/g3dlite/include/G3D/Vector2.h7
-rw-r--r--dep/g3dlite/include/G3D/Vector3.h12
-rw-r--r--dep/g3dlite/include/G3D/Vector4.h1
-rw-r--r--dep/g3dlite/include/G3D/debugAssert.h3
-rw-r--r--dep/g3dlite/include/G3D/platform.h3
-rw-r--r--dep/g3dlite/source/FileSystem.cpp2
-rw-r--r--dep/g3dlite/source/Random.cpp5
-rw-r--r--dep/g3dlite/source/Vector2.cpp1
-rw-r--r--dep/g3dlite/source/Vector3.cpp1
-rw-r--r--dep/g3dlite/source/debugAssert.cpp1
-rw-r--r--src/common/Collision/Maps/TileAssembler.cpp10
-rw-r--r--src/common/Collision/Maps/TileAssembler.h1
-rw-r--r--src/common/Cryptography/CryptoHash.h1
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp6
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp4
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp22
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp10
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp8
-rw-r--r--src/server/game/DataStores/M2Stores.cpp10
-rw-r--r--src/server/game/Entities/Object/Position.cpp2
-rw-r--r--src/server/game/Entities/Object/Position.h4
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp4
-rw-r--r--src/server/game/Entities/Player/Player.cpp16
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp4
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp18
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp26
-rw-r--r--src/server/game/Entities/Unit/Unit.h18
-rw-r--r--src/server/game/Guilds/Guild.cpp2
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.cpp4
-rw-r--r--src/server/game/Maps/TransportMgr.cpp8
-rw-r--r--src/server/game/Movement/MotionMaster.cpp6
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp7
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp6
-rw-r--r--src/server/game/Server/Packets/MailPackets.cpp3
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp5
-rw-r--r--src/server/game/Spells/SpellEffects.cpp2
-rw-r--r--src/server/game/Spells/SpellInfo.cpp4
-rw-r--r--src/server/game/Tickets/TicketMgr.cpp2
-rw-r--r--src/server/scripts/Commands/cs_rbac.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp28
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp3
-rw-r--r--src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp3
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp8
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp2
-rw-r--r--src/server/shared/DataStores/DBCStorageIterator.h72
65 files changed, 753 insertions, 202 deletions
diff --git a/dep/g3dlite/G3D-v9.0 hotfix10.diff b/dep/g3dlite/G3D-v9.0 hotfix10.diff
new file mode 100644
index 00000000000..343ac7090fa
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix10.diff
@@ -0,0 +1,20 @@
+diff --git a/dep/g3dlite/include/G3D/Array.h b/dep/g3dlite/include/G3D/Array.h
+index c562f5c920f7..c86b20fd7e97 100644
+--- a/dep/g3dlite/include/G3D/Array.h
++++ b/dep/g3dlite/include/G3D/Array.h
+@@ -346,6 +346,7 @@ class Array {
+
+ /** Resizes this to match the size of \a other and then copies the data from other using memcpy. This is only safe for POD types */
+ void copyPOD(const Array<T>& other) {
++ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "copyPOD called on non-POD type");
+ if (numAllocated < other.num) {
+ m_memoryManager->free(data);
+ data = NULL;
+@@ -364,6 +365,7 @@ class Array {
+ /** Resizes this to just barely match the size of \a other + itself and then copies the data to the end of the array from other using memcpy.
+ This is only safe for POD types */
+ void appendPOD(const Array<T>& other) {
++ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "appendPOD called on non-POD type");
+ const size_t oldSize = num;
+ num += other.num;
+ if (numAllocated < num) {
diff --git a/dep/g3dlite/G3D-v9.0 hotfix11.diff b/dep/g3dlite/G3D-v9.0 hotfix11.diff
new file mode 100644
index 00000000000..5c94416d649
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix11.diff
@@ -0,0 +1,13 @@
+diff --git a/dep/g3dlite/source/fileutils.cpp b/dep/g3dlite/source/fileutils.cpp
+index 2788adad3bcd..f5310084cec7 100644
+--- a/dep/g3dlite/source/fileutils.cpp
++++ b/dep/g3dlite/source/fileutils.cpp
+@@ -490,7 +490,7 @@ void parseFilename(
+
+ }
+
+- } else if ((f.size() >= 2) & isSlash(f[0]) && isSlash(f[1])) {
++ } else if ((f.size() >= 2) && isSlash(f[0]) && isSlash(f[1])) {
+
+ // e.g. //foo
+ root = f.substr(0, 2);
diff --git a/dep/g3dlite/G3D-v9.0 hotfix12.diff b/dep/g3dlite/G3D-v9.0 hotfix12.diff
new file mode 100644
index 00000000000..6594539f245
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix12.diff
@@ -0,0 +1,192 @@
+diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
+index 7b56e001ae29..9824d426d741 100644
+--- a/dep/g3dlite/include/G3D/AtomicInt32.h
++++ b/dep/g3dlite/include/G3D/AtomicInt32.h
+@@ -76,12 +76,16 @@ class AtomicInt32 {
+
+ # elif defined(G3D_LINUX) || defined(G3D_FREEBSD)
+
+- int32 old;
+- asm volatile ("lock; xaddl %0,%1"
+- : "=r"(old), "=m"(m_value) /* outputs */
+- : "0"(x), "m"(m_value) /* inputs */
+- : "memory", "cc");
+- return old;
++# if defined(__aarch64__)
++ return __sync_fetch_and_add(&m_value, x);
++# else
++ int32 old;
++ asm volatile ("lock; xaddl %0,%1"
++ : "=r"(old), "=m"(m_value) /* outputs */
++ : "0"(x), "m"(m_value) /* inputs */
++ : "memory", "cc");
++ return old;
++# endif
+
+ # elif defined(G3D_OSX)
+
+@@ -115,14 +119,18 @@ class AtomicInt32 {
+ // Note: returns the newly decremented value
+ return InterlockedDecrement(&m_value);
+ # elif defined(G3D_LINUX) || defined(G3D_FREEBSD)
+- unsigned char nz;
+-
+- asm volatile ("lock; decl %1;\n\t"
+- "setnz %%al"
+- : "=a" (nz)
+- : "m" (m_value)
+- : "memory", "cc");
+- return nz;
++# if defined(__aarch64__)
++ return __sync_sub_and_fetch(&m_value, 1);
++# else
++ unsigned char nz;
++
++ asm volatile ("lock; decl %1;\n\t"
++ "setnz %%al"
++ : "=a" (nz)
++ : "m" (m_value)
++ : "memory", "cc");
++ return nz;
++# endif
+ # elif defined(G3D_OSX)
+ // Note: returns the newly decremented value
+ return OSAtomicDecrement32(&m_value);
+@@ -143,17 +151,21 @@ class AtomicInt32 {
+ # if defined(G3D_WINDOWS)
+ return InterlockedCompareExchange(&m_value, exchange, comperand);
+ # elif defined(G3D_LINUX) || defined(G3D_FREEBSD) || defined(G3D_OSX)
+- // Based on Apache Portable Runtime
+- // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx
+- int32 ret;
+- asm volatile ("lock; cmpxchgl %1, %2"
+- : "=a" (ret)
+- : "r" (exchange), "m" (m_value), "0"(comperand)
+- : "memory", "cc");
+- return ret;
+-
+- // Note that OSAtomicCompareAndSwap32 does not return a useful value for us
+- // so it can't satisfy the cmpxchgl contract.
++# if defined(__aarch64__)
++ return __sync_val_compare_and_swap(&m_value, comperand, exchange);
++# else
++ // Based on Apache Portable Runtime
++ // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx
++ int32 ret;
++ asm volatile ("lock; cmpxchgl %1, %2"
++ : "=a" (ret)
++ : "r" (exchange), "m" (m_value), "0"(comperand)
++ : "memory", "cc");
++ return ret;
++
++ // Note that OSAtomicCompareAndSwap32 does not return a useful value for us
++ // so it can't satisfy the cmpxchgl contract.
++# endif
+ # endif
+ }
+
+diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
+index 4624dd916474..9ed88957d755 100644
+--- a/dep/g3dlite/include/G3D/System.h
++++ b/dep/g3dlite/include/G3D/System.h
+@@ -21,6 +21,10 @@
+ #include "G3D/FileNotFound.h"
+ #include <string>
+
++#if defined(__aarch64__)
++#include <sys/time.h>
++#endif
++
+ #ifdef G3D_OSX
+ #define Zone OSX_Zone
+ # include <CoreServices/CoreServices.h>
+@@ -497,15 +501,37 @@ class System {
+ #elif defined(G3D_LINUX)
+
+ inline uint64 System::getCycleCount() {
+- uint32 timehi, timelo;
++# if defined(__aarch64__)
++# if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount
++ uint32_t pmccntr;
++ uint32_t pmuseren;
++ uint32_t pmcntenset;
++ // Read the user mode perf monitor counter access permissions.
++ __asm__ __volatile__("mrc p15, 0, %w0, c9, c14, 0" : "=r"(pmuseren));
++ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code.
++ __asm__ __volatile__("mrc p15, 0, %w0, c9, c12, 1" : "=r"(pmcntenset));
++ if (pmcntenset & 0x80000000ul) { // Is it counting?
++ __asm__ __volatile__("mrc p15, 0, %w0, c9, c13, 0" : "=r"(pmccntr));
++ // The counter is set up to count every 64th cycle
++ return static_cast<uint64>(pmccntr) * 64; // Should optimize to << 6
++ }
++ }
++# endif
+
+- __asm__ __volatile__ (
+- "rdtsc "
+- : "=a" (timelo),
+- "=d" (timehi)
+- : );
++ struct timeval tv;
++ gettimeofday(&tv, nullptr);
++ return static_cast<uint64>(tv.tv_sec) * 1000000 + tv.tv_usec;
++# else
++ uint32 timehi, timelo;
++
++ __asm__ __volatile__ (
++ "rdtsc "
++ : "=a" (timelo),
++ "=d" (timehi)
++ : );
+
+- return ((uint64)timehi << 32) + (uint64)timelo;
++ return ((uint64)timehi << 32) + (uint64)timelo;
++# endif
+ }
+
+ #elif defined(G3D_OSX)
+diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
+index 439495ab1315..d043f21491ad 100644
+--- a/dep/g3dlite/include/G3D/platform.h
++++ b/dep/g3dlite/include/G3D/platform.h
+@@ -273,7 +273,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {\
+ # define __stdcall __attribute__((stdcall))
+ # endif
+
+-# elif defined(__x86_64__)
++# elif defined(__x86_64__) || defined(__arm) || defined(__aarch64__)
+
+ # ifndef __cdecl
+ # define __cdecl
+diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp
+index b841e23c497e..4a75d320b8d3 100644
+--- a/dep/g3dlite/source/System.cpp
++++ b/dep/g3dlite/source/System.cpp
+@@ -79,8 +79,9 @@
+ #endif
+
+ // SIMM include
++#if !defined(__aarch64__)
+ #include <xmmintrin.h>
+-
++#endif
+
+ namespace G3D {
+
+@@ -1697,6 +1698,16 @@ void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, ui
+ edx = regs[3];
+ }
+
++#elif defined(__aarch64__) || defined(G3D_OSX) && ! defined(G3D_OSX_INTEL)
++
++// non-x86 CPU; no CPUID
++void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, uint32& edx) {
++ eax = 0;
++ ebx = 0;
++ ecx = 0;
++ edx = 0;
++}
++
+ #else
+
+ // See http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
diff --git a/dep/g3dlite/G3D-v9.0 hotfix15.diff b/dep/g3dlite/G3D-v9.0 hotfix15.diff
new file mode 100644
index 00000000000..d385def554a
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix15.diff
@@ -0,0 +1,288 @@
+diff --git a/dep/g3dlite/include/G3D/AABox.h b/dep/g3dlite/include/G3D/AABox.h
+index 7a47ea63aa..97a47cf986 100644
+--- a/dep/g3dlite/include/G3D/AABox.h
++++ b/dep/g3dlite/include/G3D/AABox.h
+@@ -17,14 +17,14 @@
+
+ #include "G3D/platform.h"
+ #include "G3D/debug.h"
+-#include "G3D/Array.h"
+-#include "G3D/Plane.h"
+-#include "G3D/Sphere.h"
+ #include "G3D/Vector3.h"
+
+ namespace G3D {
+
+ class Any;
++template <class T, size_t MIN_ELEMENTS> class Array;
++class Plane;
++class Sphere;
+
+ /**
+ An axis-aligned box.
+@@ -221,7 +221,7 @@ public:
+
+ */
+ bool culledBy
+- (const Array<Plane>& plane,
++ (const Array<Plane, 10>& plane,
+ int32& cullingPlaneIndex,
+ const uint32 testMask,
+ uint32& childMask) const;
+@@ -230,7 +230,7 @@ public:
+ Conservative culling test that does not produce a mask for children.
+ */
+ bool culledBy
+- (const Array<Plane>& plane,
++ (const Array<Plane, 10>& plane,
+ int32& cullingPlaneIndex = dummy,
+ const uint32 testMask = 0xFFFFFFFF) const;
+
+diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
+index 9824d426d7..51561e3dcc 100644
+--- a/dep/g3dlite/include/G3D/AtomicInt32.h
++++ b/dep/g3dlite/include/G3D/AtomicInt32.h
+@@ -12,7 +12,9 @@
+ #include "G3D/platform.h"
+ #include "G3D/g3dmath.h"
+
+-#if defined(G3D_OSX)
++#if defined(G3D_WINDOWS)
++# include <Windows.h>
++#elif defined(G3D_OSX)
+ # include <libkern/OSAtomic.h>
+ #endif
+
+diff --git a/dep/g3dlite/include/G3D/HashTrait.h b/dep/g3dlite/include/G3D/HashTrait.h
+index 1de3777bae..6199f4504e 100644
+--- a/dep/g3dlite/include/G3D/HashTrait.h
++++ b/dep/g3dlite/include/G3D/HashTrait.h
+@@ -13,7 +13,6 @@
+ #define G3D_HashTrait_h
+
+ #include "G3D/platform.h"
+-#include "G3D/Crypto.h"
+ #include "G3D/g3dmath.h"
+ #include "G3D/uint128.h"
+ #include <typeinfo>
+diff --git a/dep/g3dlite/include/G3D/Random.h b/dep/g3dlite/include/G3D/Random.h
+index 9d911806a9..359755044a 100644
+--- a/dep/g3dlite/include/G3D/Random.h
++++ b/dep/g3dlite/include/G3D/Random.h
+@@ -159,6 +159,7 @@ public:
+ static Random& common();
+ };
+
++Random& commonRandom();
+ }
+
+ #endif
+diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
+index 9ed88957d7..81c83527c9 100644
+--- a/dep/g3dlite/include/G3D/System.h
++++ b/dep/g3dlite/include/G3D/System.h
+@@ -21,6 +21,10 @@
+ #include "G3D/FileNotFound.h"
+ #include <string>
+
++#ifdef G3D_WINDOWS
++#include <Windows.h>
++#endif
++
+ #if defined(__aarch64__)
+ #include <sys/time.h>
+ #endif
+diff --git a/dep/g3dlite/include/G3D/Vector2.h b/dep/g3dlite/include/G3D/Vector2.h
+index 65cf7fa8f2..696889d630 100644
+--- a/dep/g3dlite/include/G3D/Vector2.h
++++ b/dep/g3dlite/include/G3D/Vector2.h
+@@ -19,20 +19,21 @@
+
+ #include "G3D/platform.h"
+ #include "G3D/g3dmath.h"
+-#include "G3D/Table.h"
+ #include "G3D/HashTrait.h"
+ #include "G3D/Vector2int16.h"
+ #include "G3D/Vector2unorm16.h"
+-#include "G3D/Random.h"
+
+ namespace G3D {
+
++class Random;
+ class Vector2;
+ class Vector3;
+ class Vector4;
+ class Vector2int32;
+ class Any;
+
++Random& commonRandom();
++
+ /**
+ Do not subclass-- this implementation makes assumptions about the
+ memory layout.
+@@ -210,7 +211,7 @@ public:
+ }
+
+ /** Uniformly distributed random vector on the unit sphere */
+- static Vector2 random(Random& r = Random::common());
++ static Vector2 random(Random& r = commonRandom());
+
+ // Special values.
+ // Intentionally not inlined: see Matrix3::identity() for details.
+diff --git a/dep/g3dlite/include/G3D/Vector3.h b/dep/g3dlite/include/G3D/Vector3.h
+index 05d9b11ed5..c79f70b916 100644
+--- a/dep/g3dlite/include/G3D/Vector3.h
++++ b/dep/g3dlite/include/G3D/Vector3.h
+@@ -17,9 +17,7 @@
+
+ #include "G3D/platform.h"
+ #include "G3D/g3dmath.h"
+-#include "G3D/Random.h"
+ #include "G3D/Vector2.h"
+-#include "G3D/Table.h"
+ #include "G3D/HashTrait.h"
+ #include "G3D/PositionTrait.h"
+ #include "G3D/Vector2.h"
+@@ -365,7 +363,7 @@ public:
+ Distribution rendered by G3D::DirectionHistogram:
+ \image html vector3-random.png
+ */
+- static Vector3 random(Random& r = Random::common());
++ static Vector3 random(Random& r = commonRandom());
+
+ /** \brief Random unit vector, distributed according to \f$\max(\cos \theta,0)\f$.
+
+@@ -380,9 +378,9 @@ public:
+
+ @cite Henrik Wann Jensen, Realistic Image Synthesis using Photon Mapping eqn 2.24
+ */
+- static Vector3 cosHemiRandom(const Vector3& n, Random& r = Random::common());
++ static Vector3 cosHemiRandom(const Vector3& n, Random& r = commonRandom());
+
+- static Vector3 cosSphereRandom(const Vector3& n, Random& r = Random::common());
++ static Vector3 cosSphereRandom(const Vector3& n, Random& r = commonRandom());
+
+ /** \brief Random unit vector, distributed according to \f$\max(\cos^k \theta,0)\f$.
+
+@@ -397,7 +395,7 @@ public:
+
+ @cite Ashikhmin and Shirley, An anisotropic Phong BRDF model, Journal of Graphics Tools, 2002
+ */
+- static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = Random::common());
++ static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = commonRandom());
+
+ /**
+ \brief Random vector distributed over the hemisphere about normal.
+@@ -405,7 +403,7 @@ public:
+ Distribution rendered by G3D::DirectionHistogram:
+ \image html vector3-hemirandom.png
+ */
+- static Vector3 hemiRandom(const Vector3& normal, Random& r = Random::common());
++ static Vector3 hemiRandom(const Vector3& normal, Random& r = commonRandom());
+
+ inline float sum() const {
+ return x + y + z;
+diff --git a/dep/g3dlite/include/G3D/Vector4.h b/dep/g3dlite/include/G3D/Vector4.h
+index 24521efc93..0f0ea459df 100644
+--- a/dep/g3dlite/include/G3D/Vector4.h
++++ b/dep/g3dlite/include/G3D/Vector4.h
+@@ -19,7 +19,6 @@
+ #include "G3D/g3dmath.h"
+ #include "G3D/Vector3.h"
+ #include "G3D/Vector2.h"
+-#include "G3D/Table.h"
+ #include "G3D/HashTrait.h"
+ #include "G3D/PositionTrait.h"
+ #include <string>
+diff --git a/dep/g3dlite/include/G3D/debugAssert.h b/dep/g3dlite/include/G3D/debugAssert.h
+index edff671061..197312bd12 100644
+--- a/dep/g3dlite/include/G3D/debugAssert.h
++++ b/dep/g3dlite/include/G3D/debugAssert.h
+@@ -32,6 +32,7 @@
+ #include <cstdlib>
+
+ #ifdef _MSC_VER
++#include <intrin.h>
+ // conditional expression is constant
+ # pragma warning (disable : 4127)
+ #endif
+@@ -116,7 +117,7 @@ namespace _internal {
+ #ifdef G3D_DEBUG
+
+ # if defined(_MSC_VER)
+-# define rawBreak() ::DebugBreak();
++# define rawBreak() ::__debugbreak();
+ # elif defined(__i386__)
+ // gcc on intel
+ # define rawBreak() __asm__ __volatile__ ( "int $3" );
+diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
+index d043f21491..9202fe41d0 100644
+--- a/dep/g3dlite/include/G3D/platform.h
++++ b/dep/g3dlite/include/G3D/platform.h
+@@ -190,6 +190,7 @@ These control the version of Winsock used by G3D.
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_Compiler_Reference.asp
+ //
+
++#if 0
+ // DLL runtime
+ #ifndef _DLL
+ #define _DLL
+@@ -227,6 +228,8 @@ These control the version of Winsock used by G3D.
+ # undef WIN32_LEAN_AND_MEAN
+ # undef NOMINMAX
+
++#endif // 0
++
+ # ifdef _G3D_INTERNAL_HIDE_WINSOCK_
+ # undef _G3D_INTERNAL_HIDE_WINSOCK_
+ # undef _WINSOCKAPI_
+diff --git a/dep/g3dlite/source/Random.cpp b/dep/g3dlite/source/Random.cpp
+index cbfa07dec0..a31d52a557 100644
+--- a/dep/g3dlite/source/Random.cpp
++++ b/dep/g3dlite/source/Random.cpp
+@@ -227,4 +227,9 @@ void Random::sphere(float& x, float& y, float& z) {
+ z *= s;
+ }
+
++Random& commonRandom()
++{
++ return Random::common();
++}
++
+ } // G3D
+diff --git a/dep/g3dlite/source/Vector2.cpp b/dep/g3dlite/source/Vector2.cpp
+index a6edea9a83..194cd3090d 100644
+--- a/dep/g3dlite/source/Vector2.cpp
++++ b/dep/g3dlite/source/Vector2.cpp
+@@ -23,6 +23,7 @@
+ #include "G3D/TextInput.h"
+ #include "G3D/TextOutput.h"
+ #include "G3D/Any.h"
++#include "G3D/Random.h"
+
+ namespace G3D {
+
+diff --git a/dep/g3dlite/source/Vector3.cpp b/dep/g3dlite/source/Vector3.cpp
+index e2d9643e5c..ccbf7d6a0b 100644
+--- a/dep/g3dlite/source/Vector3.cpp
++++ b/dep/g3dlite/source/Vector3.cpp
+@@ -28,6 +28,7 @@
+ #include "G3D/Vector4.h"
+ #include "G3D/Vector3int32.h"
+ #include "G3D/Any.h"
++#include "G3D/Random.h"
+
+ namespace G3D {
+
+diff --git a/dep/g3dlite/source/debugAssert.cpp b/dep/g3dlite/source/debugAssert.cpp
+index 3c3e43a0af..ff843fb7ee 100644
+--- a/dep/g3dlite/source/debugAssert.cpp
++++ b/dep/g3dlite/source/debugAssert.cpp
+@@ -23,6 +23,7 @@
+ #include <cstdlib>
+
+ #ifdef _MSC_VER
++#include <Windows.h>
+ // disable: "C++ exception handler used"
+ # pragma warning (push)
+ # pragma warning (disable : 4530)
diff --git a/dep/g3dlite/G3D-v9.0 hotfix17.diff b/dep/g3dlite/G3D-v9.0 hotfix17.diff
new file mode 100644
index 00000000000..cb5367c65f4
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix17.diff
@@ -0,0 +1,13 @@
+diff --git a/dep/g3dlite/source/FileSystem.cpp b/dep/g3dlite/source/FileSystem.cpp
+index 0898af7953..ff5da02344 100644
+--- a/dep/g3dlite/source/FileSystem.cpp
++++ b/dep/g3dlite/source/FileSystem.cpp
+@@ -35,7 +35,7 @@
+ # include <fnmatch.h>
+ # include <unistd.h>
+ # define _getcwd getcwd
+-# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
++# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+ # define stat64 stat
+ # endif
+ # define _stat stat
diff --git a/dep/g3dlite/Readme.txt b/dep/g3dlite/Readme.txt
index 5477030e5cb..3318bcbb3ed 100644
--- a/dep/g3dlite/Readme.txt
+++ b/dep/g3dlite/Readme.txt
@@ -24,4 +24,5 @@ G3D-v9.0 hotfix11.diff - 2017-11-11 - static analysis issue fix
G3D-v9.0 hotfix12.diff - 2020-02-23 - ARM64 build fix
G3D-v9.0 hotfix13.diff - 2020-08-04 - MSVC build fix with /permissive-
G3D-v9.0 hotfix14.diff - 2022-01-16 - warning fixes
+G3D-v9.0 hotfix15.diff - 2022-02-11 - purge Windows.h includes from public headers
G3D-v9.0 hotfix16.diff - 2022-02-11 - Fix *BSD compile errors
diff --git a/dep/g3dlite/include/G3D/AABox.h b/dep/g3dlite/include/G3D/AABox.h
index 7a47ea63aa2..97a47cf9865 100644
--- a/dep/g3dlite/include/G3D/AABox.h
+++ b/dep/g3dlite/include/G3D/AABox.h
@@ -17,14 +17,14 @@
#include "G3D/platform.h"
#include "G3D/debug.h"
-#include "G3D/Array.h"
-#include "G3D/Plane.h"
-#include "G3D/Sphere.h"
#include "G3D/Vector3.h"
namespace G3D {
class Any;
+template <class T, size_t MIN_ELEMENTS> class Array;
+class Plane;
+class Sphere;
/**
An axis-aligned box.
@@ -221,7 +221,7 @@ public:
*/
bool culledBy
- (const Array<Plane>& plane,
+ (const Array<Plane, 10>& plane,
int32& cullingPlaneIndex,
const uint32 testMask,
uint32& childMask) const;
@@ -230,7 +230,7 @@ public:
Conservative culling test that does not produce a mask for children.
*/
bool culledBy
- (const Array<Plane>& plane,
+ (const Array<Plane, 10>& plane,
int32& cullingPlaneIndex = dummy,
const uint32 testMask = 0xFFFFFFFF) const;
diff --git a/dep/g3dlite/include/G3D/Array.h b/dep/g3dlite/include/G3D/Array.h
index c86b20fd7e9..788237dce54 100644
--- a/dep/g3dlite/include/G3D/Array.h
+++ b/dep/g3dlite/include/G3D/Array.h
@@ -346,7 +346,7 @@ public:
/** Resizes this to match the size of \a other and then copies the data from other using memcpy. This is only safe for POD types */
void copyPOD(const Array<T>& other) {
- static_assert(std::is_pod<T>::value, "copyPOD called on non-POD type");
+ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "copyPOD called on non-POD type");
if (numAllocated < other.num) {
m_memoryManager->free(data);
data = NULL;
@@ -365,7 +365,7 @@ public:
/** Resizes this to just barely match the size of \a other + itself and then copies the data to the end of the array from other using memcpy.
This is only safe for POD types */
void appendPOD(const Array<T>& other) {
- static_assert(std::is_pod<T>::value, "appendPOD called on non-POD type");
+ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "appendPOD called on non-POD type");
const size_t oldSize = num;
num += other.num;
if (numAllocated < num) {
diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
index 9824d426d74..51561e3dcc4 100644
--- a/dep/g3dlite/include/G3D/AtomicInt32.h
+++ b/dep/g3dlite/include/G3D/AtomicInt32.h
@@ -12,7 +12,9 @@
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
-#if defined(G3D_OSX)
+#if defined(G3D_WINDOWS)
+# include <Windows.h>
+#elif defined(G3D_OSX)
# include <libkern/OSAtomic.h>
#endif
diff --git a/dep/g3dlite/include/G3D/HashTrait.h b/dep/g3dlite/include/G3D/HashTrait.h
index 1de3777baec..6199f4504ed 100644
--- a/dep/g3dlite/include/G3D/HashTrait.h
+++ b/dep/g3dlite/include/G3D/HashTrait.h
@@ -13,7 +13,6 @@
#define G3D_HashTrait_h
#include "G3D/platform.h"
-#include "G3D/Crypto.h"
#include "G3D/g3dmath.h"
#include "G3D/uint128.h"
#include <typeinfo>
diff --git a/dep/g3dlite/include/G3D/Random.h b/dep/g3dlite/include/G3D/Random.h
index 9d911806a97..359755044a8 100644
--- a/dep/g3dlite/include/G3D/Random.h
+++ b/dep/g3dlite/include/G3D/Random.h
@@ -159,6 +159,7 @@ public:
static Random& common();
};
+Random& commonRandom();
}
#endif
diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
index 9ed88957d75..81c83527c9c 100644
--- a/dep/g3dlite/include/G3D/System.h
+++ b/dep/g3dlite/include/G3D/System.h
@@ -21,6 +21,10 @@
#include "G3D/FileNotFound.h"
#include <string>
+#ifdef G3D_WINDOWS
+#include <Windows.h>
+#endif
+
#if defined(__aarch64__)
#include <sys/time.h>
#endif
diff --git a/dep/g3dlite/include/G3D/Vector2.h b/dep/g3dlite/include/G3D/Vector2.h
index 65cf7fa8f2f..696889d6302 100644
--- a/dep/g3dlite/include/G3D/Vector2.h
+++ b/dep/g3dlite/include/G3D/Vector2.h
@@ -19,20 +19,21 @@
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
-#include "G3D/Table.h"
#include "G3D/HashTrait.h"
#include "G3D/Vector2int16.h"
#include "G3D/Vector2unorm16.h"
-#include "G3D/Random.h"
namespace G3D {
+class Random;
class Vector2;
class Vector3;
class Vector4;
class Vector2int32;
class Any;
+Random& commonRandom();
+
/**
Do not subclass-- this implementation makes assumptions about the
memory layout.
@@ -210,7 +211,7 @@ public:
}
/** Uniformly distributed random vector on the unit sphere */
- static Vector2 random(Random& r = Random::common());
+ static Vector2 random(Random& r = commonRandom());
// Special values.
// Intentionally not inlined: see Matrix3::identity() for details.
diff --git a/dep/g3dlite/include/G3D/Vector3.h b/dep/g3dlite/include/G3D/Vector3.h
index 05d9b11ed57..c79f70b916b 100644
--- a/dep/g3dlite/include/G3D/Vector3.h
+++ b/dep/g3dlite/include/G3D/Vector3.h
@@ -17,9 +17,7 @@
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
-#include "G3D/Random.h"
#include "G3D/Vector2.h"
-#include "G3D/Table.h"
#include "G3D/HashTrait.h"
#include "G3D/PositionTrait.h"
#include "G3D/Vector2.h"
@@ -365,7 +363,7 @@ public:
Distribution rendered by G3D::DirectionHistogram:
\image html vector3-random.png
*/
- static Vector3 random(Random& r = Random::common());
+ static Vector3 random(Random& r = commonRandom());
/** \brief Random unit vector, distributed according to \f$\max(\cos \theta,0)\f$.
@@ -380,9 +378,9 @@ public:
@cite Henrik Wann Jensen, Realistic Image Synthesis using Photon Mapping eqn 2.24
*/
- static Vector3 cosHemiRandom(const Vector3& n, Random& r = Random::common());
+ static Vector3 cosHemiRandom(const Vector3& n, Random& r = commonRandom());
- static Vector3 cosSphereRandom(const Vector3& n, Random& r = Random::common());
+ static Vector3 cosSphereRandom(const Vector3& n, Random& r = commonRandom());
/** \brief Random unit vector, distributed according to \f$\max(\cos^k \theta,0)\f$.
@@ -397,7 +395,7 @@ public:
@cite Ashikhmin and Shirley, An anisotropic Phong BRDF model, Journal of Graphics Tools, 2002
*/
- static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = Random::common());
+ static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = commonRandom());
/**
\brief Random vector distributed over the hemisphere about normal.
@@ -405,7 +403,7 @@ public:
Distribution rendered by G3D::DirectionHistogram:
\image html vector3-hemirandom.png
*/
- static Vector3 hemiRandom(const Vector3& normal, Random& r = Random::common());
+ static Vector3 hemiRandom(const Vector3& normal, Random& r = commonRandom());
inline float sum() const {
return x + y + z;
diff --git a/dep/g3dlite/include/G3D/Vector4.h b/dep/g3dlite/include/G3D/Vector4.h
index 24521efc93c..0f0ea459dfa 100644
--- a/dep/g3dlite/include/G3D/Vector4.h
+++ b/dep/g3dlite/include/G3D/Vector4.h
@@ -19,7 +19,6 @@
#include "G3D/g3dmath.h"
#include "G3D/Vector3.h"
#include "G3D/Vector2.h"
-#include "G3D/Table.h"
#include "G3D/HashTrait.h"
#include "G3D/PositionTrait.h"
#include <string>
diff --git a/dep/g3dlite/include/G3D/debugAssert.h b/dep/g3dlite/include/G3D/debugAssert.h
index edff671061d..197312bd12e 100644
--- a/dep/g3dlite/include/G3D/debugAssert.h
+++ b/dep/g3dlite/include/G3D/debugAssert.h
@@ -32,6 +32,7 @@
#include <cstdlib>
#ifdef _MSC_VER
+#include <intrin.h>
// conditional expression is constant
# pragma warning (disable : 4127)
#endif
@@ -116,7 +117,7 @@ namespace _internal {
#ifdef G3D_DEBUG
# if defined(_MSC_VER)
-# define rawBreak() ::DebugBreak();
+# define rawBreak() ::__debugbreak();
# elif defined(__i386__)
// gcc on intel
# define rawBreak() __asm__ __volatile__ ( "int $3" );
diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
index d043f21491a..9202fe41d0b 100644
--- a/dep/g3dlite/include/G3D/platform.h
+++ b/dep/g3dlite/include/G3D/platform.h
@@ -190,6 +190,7 @@ These control the version of Winsock used by G3D.
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_Compiler_Reference.asp
//
+#if 0
// DLL runtime
#ifndef _DLL
#define _DLL
@@ -227,6 +228,8 @@ These control the version of Winsock used by G3D.
# undef WIN32_LEAN_AND_MEAN
# undef NOMINMAX
+#endif // 0
+
# ifdef _G3D_INTERNAL_HIDE_WINSOCK_
# undef _G3D_INTERNAL_HIDE_WINSOCK_
# undef _WINSOCKAPI_
diff --git a/dep/g3dlite/source/FileSystem.cpp b/dep/g3dlite/source/FileSystem.cpp
index 0898af79534..ff5da023443 100644
--- a/dep/g3dlite/source/FileSystem.cpp
+++ b/dep/g3dlite/source/FileSystem.cpp
@@ -35,7 +35,7 @@
# include <fnmatch.h>
# include <unistd.h>
# define _getcwd getcwd
-# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
# define stat64 stat
# endif
# define _stat stat
diff --git a/dep/g3dlite/source/Random.cpp b/dep/g3dlite/source/Random.cpp
index cbfa07dec0b..a31d52a557c 100644
--- a/dep/g3dlite/source/Random.cpp
+++ b/dep/g3dlite/source/Random.cpp
@@ -227,4 +227,9 @@ void Random::sphere(float& x, float& y, float& z) {
z *= s;
}
+Random& commonRandom()
+{
+ return Random::common();
+}
+
} // G3D
diff --git a/dep/g3dlite/source/Vector2.cpp b/dep/g3dlite/source/Vector2.cpp
index a6edea9a83f..194cd3090de 100644
--- a/dep/g3dlite/source/Vector2.cpp
+++ b/dep/g3dlite/source/Vector2.cpp
@@ -23,6 +23,7 @@
#include "G3D/TextInput.h"
#include "G3D/TextOutput.h"
#include "G3D/Any.h"
+#include "G3D/Random.h"
namespace G3D {
diff --git a/dep/g3dlite/source/Vector3.cpp b/dep/g3dlite/source/Vector3.cpp
index e2d9643e5cc..ccbf7d6a0bd 100644
--- a/dep/g3dlite/source/Vector3.cpp
+++ b/dep/g3dlite/source/Vector3.cpp
@@ -28,6 +28,7 @@
#include "G3D/Vector4.h"
#include "G3D/Vector3int32.h"
#include "G3D/Any.h"
+#include "G3D/Random.h"
namespace G3D {
diff --git a/dep/g3dlite/source/debugAssert.cpp b/dep/g3dlite/source/debugAssert.cpp
index 3c3e43a0af9..ff843fb7ee0 100644
--- a/dep/g3dlite/source/debugAssert.cpp
+++ b/dep/g3dlite/source/debugAssert.cpp
@@ -23,6 +23,7 @@
#include <cstdlib>
#ifdef _MSC_VER
+#include <Windows.h>
// disable: "C++ exception handler used"
# pragma warning (push)
# pragma warning (disable : 4530)
diff --git a/src/common/Collision/Maps/TileAssembler.cpp b/src/common/Collision/Maps/TileAssembler.cpp
index c8dc2d46620..27dc57c7c86 100644
--- a/src/common/Collision/Maps/TileAssembler.cpp
+++ b/src/common/Collision/Maps/TileAssembler.cpp
@@ -214,7 +214,6 @@ namespace VMAP
}
printf("Read coordinate mapping...\n");
uint32 mapID, tileX, tileY, check;
- G3D::Vector3 v1, v2;
ModelSpawn spawn;
while (!feof(dirf))
{
@@ -222,8 +221,13 @@ namespace VMAP
check = fread(&mapID, sizeof(uint32), 1, dirf);
if (check == 0) // EoF...
break;
- fread(&tileX, sizeof(uint32), 1, dirf);
- fread(&tileY, sizeof(uint32), 1, dirf);
+ check = fread(&tileX, sizeof(uint32), 1, dirf);
+ if (check == 0) // EoF...
+ break;
+ check = fread(&tileY, sizeof(uint32), 1, dirf);
+ if (check == 0) // EoF...
+ break;
+
if (!ModelSpawn::readFromFile(dirf, spawn))
break;
diff --git a/src/common/Collision/Maps/TileAssembler.h b/src/common/Collision/Maps/TileAssembler.h
index 010cb590407..bdad179ad06 100644
--- a/src/common/Collision/Maps/TileAssembler.h
+++ b/src/common/Collision/Maps/TileAssembler.h
@@ -94,7 +94,6 @@ namespace VMAP
private:
std::string iDestDir;
std::string iSrcDir;
- G3D::Table<std::string, unsigned int > iUniqueNameIds;
MapData mapData;
std::set<std::string> spawnedModelFiles;
diff --git a/src/common/Cryptography/CryptoHash.h b/src/common/Cryptography/CryptoHash.h
index 01b488cb4dd..49d421c7fb1 100644
--- a/src/common/Cryptography/CryptoHash.h
+++ b/src/common/Cryptography/CryptoHash.h
@@ -24,6 +24,7 @@
#include <array>
#include <string>
#include <string_view>
+#include <utility>
#include <openssl/evp.h>
class BigNumber;
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 60d9d057429..0b56c3b07c3 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -91,7 +91,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
uint32 MSV = pItem->GetTemplate()->SellPrice;
if (MSV <= 0)
- return AH_MINIMUM_DEPOSIT * sWorld->getRate(RATE_AUCTION_DEPOSIT);
+ return float(AH_MINIMUM_DEPOSIT) * sWorld->getRate(RATE_AUCTION_DEPOSIT);
float multiplier = CalculatePct(float(entry->DepositRate), 3);
uint32 timeHr = (((time / 60) / 60) / 12);
@@ -113,8 +113,8 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
TC_LOG_DEBUG("auctionHouse", "Deposit: %u", deposit);
TC_LOG_DEBUG("auctionHouse", "Deposit rm: %f", remainderbase * count);
- if (deposit < AH_MINIMUM_DEPOSIT * sWorld->getRate(RATE_AUCTION_DEPOSIT))
- return AH_MINIMUM_DEPOSIT * sWorld->getRate(RATE_AUCTION_DEPOSIT);
+ if (deposit < float(AH_MINIMUM_DEPOSIT) * sWorld->getRate(RATE_AUCTION_DEPOSIT))
+ return float(AH_MINIMUM_DEPOSIT) * sWorld->getRate(RATE_AUCTION_DEPOSIT);
else
return deposit;
}
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
index a025d75d9fc..3594a4200b9 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
@@ -389,7 +389,7 @@ uint32 AuctionBotBuyer::GetChanceMultiplier(uint32 quality)
// Buys the auction and does necessary actions to complete the buyout
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctionHouse)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->buyout) / GOLD);
+ TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->buyout) / float(GOLD));
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
@@ -420,7 +420,7 @@ void AuctionBotBuyer::BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctio
// Bids on the auction and does the necessary actions for bidding
void AuctionBotBuyer::PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / GOLD);
+ TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / float(GOLD));
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 99fedbaa4f7..f8c8ba59d1e 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -1000,7 +1000,7 @@ bool BfCapturePoint::Update(uint32 diff)
}
// get the difference of numbers
- float fact_diff = ((float) m_activePlayers[TEAM_ALLIANCE].size() - (float) m_activePlayers[TEAM_HORDE].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
+ float fact_diff = ((float) m_activePlayers[TEAM_ALLIANCE].size() - (float) m_activePlayers[TEAM_HORDE].size()) * diff / float(BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL);
if (G3D::fuzzyEq(fact_diff, 0.0f))
return false;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 0cc836d3877..aaf3552edc1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -378,7 +378,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
- if (m_Nodes[i] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
+ if (m_Nodes[i] == uint8(GetTeamIndexByTeamId(team)) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
if (capturedNodes >= 5)
@@ -472,7 +472,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
- m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
+ m_Nodes[node] = uint8(teamIndex) + BG_AB_NODE_TYPE_CONTESTED;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
// create new contested banner
@@ -490,7 +490,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
{
UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1);
m_prevNodes[node] = m_Nodes[node];
- m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED;
+ m_Nodes[node] = uint8(teamIndex) + BG_AB_NODE_TYPE_OCCUPIED;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
// create new occupied banner
@@ -511,7 +511,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
- m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
+ m_Nodes[node] = uint8(teamIndex) + BG_AB_NODE_TYPE_CONTESTED;
// burn current occupied banner
_DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex);
// create new contested banner
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index e972a57f294..3f1a5f99d66 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -40,7 +40,7 @@ void BattlegroundAVScore::BuildObjectivesBlock(WorldPacket& data)
BattlegroundAV::BattlegroundAV()
{
BgObjects.resize(BG_AV_OBJECT_MAX);
- BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX);
+ BgCreatures.resize(AV_CPLACE_MAX + AsUnderlyingType(AV_STATICCPLACE_MAX));
for (uint8 i = 0; i < 2; i++)
{
@@ -287,7 +287,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
{
bool isStatic = false;
Creature* creature = nullptr;
- ASSERT(type < AV_CPLACE_MAX + AV_STATICCPLACE_MAX);
+ ASSERT(type < AV_CPLACE_MAX + AsUnderlyingType(AV_STATICCPLACE_MAX));
if (type >= AV_CPLACE_MAX) //static
{
type -= AV_CPLACE_MAX;
@@ -591,8 +591,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), owner);
- SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
- SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + uint32(GetTeamIndexByTeamId(owner)) + (2 * tmp), RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + uint32(GetTeamIndexByTeamId(owner)) + (2 * tmp), RESPAWN_ONE_DAY);
}
else
{
@@ -600,8 +600,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
- SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
- SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_IMMEDIATELY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + uint32(GetTeamIndexByTeamId(owner)) + 3 * node, RESPAWN_IMMEDIATELY);
PopulateNode(node);
if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
@@ -906,8 +906,8 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
if (!IsTower(node))
{
- SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_ONE_DAY);
- SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(team)+3*node, RESPAWN_IMMEDIATELY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + uint32(GetTeamIndexByTeamId(team)) + 3 * node, RESPAWN_IMMEDIATELY);
}
// despawn old go
SpawnBGObject(object, RESPAWN_ONE_DAY);
@@ -1012,8 +1012,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
else
{
//spawning/despawning of aura
- SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
- SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_ONE_DAY); //teeamaura despawn
+ SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_IMMEDIATELY); //neutral aura spawn
+ SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + uint32(GetTeamIndexByTeamId(owner)) + 3 * node, RESPAWN_ONE_DAY); //teeamaura despawn
RelocateDeadPlayers(BgCreatures[node]);
}
@@ -1503,7 +1503,7 @@ void BattlegroundAV::ResetBGSubclass()
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, AV_NEUTRAL_TEAM, false); //give snowfall neutral owner
m_Mine_Timer = AV_MINE_TICK_TIMER;
- for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
+ for (uint16 i = 0; i < AV_CPLACE_MAX + AsUnderlyingType(AV_STATICCPLACE_MAX); i++)
if (BgCreatures[i])
DelCreature(i);
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 6ff89cfb440..eb443c02de6 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -447,13 +447,13 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
nodePoint[i].needChange = true;
- RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
+ RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2]);
// if we are here means that the point has been lost, or it is the first capture
if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
- if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2])
- DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2);
+ if (!BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2].IsEmpty())
+ DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
@@ -596,7 +596,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture)
{
if (node->nodeType != NODE_TYPE_REFINERY && node->nodeType != NODE_TYPE_QUARRY)
{
- if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+node->nodeType-2, BG_IC_SpiritGuidePos[node->nodeType], node->faction))
+ if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(node->nodeType) - 2, BG_IC_SpiritGuidePos[node->nodeType], node->faction))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", node->nodeType, node->faction);
}
@@ -897,7 +897,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
}
// If not, place ghost on starting location
if (!good_entry)
- good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[teamIndex+MAX_NODE_TYPES]);
+ good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[uint32(teamIndex) + MAX_NODE_TYPES]);
return good_entry;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index f6b997c2527..4b5366674db 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -41,7 +41,7 @@ BattlegroundSA::BattlegroundSA()
StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; // handle by Kanrethad
BgObjects.resize(BG_SA_MAXOBJ);
- BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY);
+ BgCreatures.resize(AsUnderlyingType(BG_SA_MAXNPC) + AsUnderlyingType(BG_SA_MAX_GY));
TimerEnabled = false;
UpdateWaitTimer = 0;
SignaledRoundTwo = false;
@@ -105,7 +105,7 @@ bool BattlegroundSA::ResetObjs()
for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
DelCreature(i);
- for (uint8 i = BG_SA_MAXNPC; i < BG_SA_MAXNPC + BG_SA_MAX_GY; i++)
+ for (uint8 i = BG_SA_MAXNPC; i < AsUnderlyingType(BG_SA_MAXNPC) + AsUnderlyingType(BG_SA_MAX_GY); i++)
DelCreature(i);
for (uint8 i = 0; i < MAX_GATES; ++i)
@@ -808,7 +808,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
if (GraveyardStatus[i] == Attackers)
return;
- DelCreature(BG_SA_MAXNPC + i);
+ DelCreature(AsUnderlyingType(BG_SA_MAXNPC) + i);
GraveyardStatus[i] = Source->GetTeamId();
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
if (!sg)
@@ -817,7 +817,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
return;
}
- AddSpiritGuide(i + BG_SA_MAXNPC, sg->Loc.X, sg->Loc.Y, sg->Loc.Z, BG_SA_GYOrientation[i], GraveyardStatus[i]);
+ AddSpiritGuide(i + AsUnderlyingType(BG_SA_MAXNPC), sg->Loc.X, sg->Loc.Y, sg->Loc.Z, BG_SA_GYOrientation[i], GraveyardStatus[i]);
uint32 npc = 0;
uint32 flag = 0;
diff --git a/src/server/game/DataStores/M2Stores.cpp b/src/server/game/DataStores/M2Stores.cpp
index d8caf1b340d..1614862b65f 100644
--- a/src/server/game/DataStores/M2Stores.cpp
+++ b/src/server/game/DataStores/M2Stores.cpp
@@ -15,17 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DBCStores.h"
-#include "Common.h"
+#include "M2Stores.h"
#include "Containers.h"
+#include "DBCStores.h"
#include "Log.h"
#include "M2Structure.h"
-#include "M2Stores.h"
-#include "World.h"
+#include "Timer.h"
#include <boost/filesystem/path.hpp>
+#include <G3D/Vector4.h>
#include <fstream>
-#include <iostream>
-#include <iomanip>
typedef std::vector<FlyByCamera> FlyByCameraCollection;
std::unordered_map<uint32, FlyByCameraCollection> sFlyByCameraStore;
diff --git a/src/server/game/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp
index 1304acebe5d..ecbe15d96cd 100644
--- a/src/server/game/Entities/Object/Position.cpp
+++ b/src/server/game/Entities/Object/Position.cpp
@@ -25,7 +25,7 @@
#include <G3D/g3dmath.h>
#include <sstream>
-bool Position::operator==(Position const& a)
+bool Position::operator==(Position const& a) const
{
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
G3D::fuzzyEq(a.m_positionY, m_positionY) &&
diff --git a/src/server/game/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h
index a9713f9443c..d029c270380 100644
--- a/src/server/game/Entities/Object/Position.h
+++ b/src/server/game/Entities/Object/Position.h
@@ -61,8 +61,8 @@ private:
float m_orientation;
public:
- bool operator==(Position const& a);
- bool operator!=(Position const& a) { return !(operator==(a)); }
+ bool operator==(Position const& a) const;
+ bool operator!=(Position const& a) const { return !(operator==(a)); }
void Relocate(float x, float y) { m_positionX = x; m_positionY = y; }
void Relocate(float x, float y, float z) { Relocate(x, y); m_positionZ = z; }
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 26297f26f63..8e57375e2e8 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -960,8 +960,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
case SUMMON_PET:
{
// the damage bonus used for pets is either fire or shadow damage, whatever is higher
- int32 fire = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
- int32 shadow = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
+ int32 fire = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE));
+ int32 shadow = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW));
int32 val = (fire > shadow) ? fire : shadow;
if (val < 0)
val = 0;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 7cf2edefaab..1eceae7f9bc 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2172,7 +2172,7 @@ void Player::Regenerate(Powers power)
if (m_regenTimerCount >= 2000)
SetPower(power, curValue);
else
- UpdateUInt32Value(UNIT_FIELD_POWER1 + power, curValue);
+ UpdateUInt32Value(UNIT_FIELD_POWER1 + AsUnderlyingType(power), curValue);
}
void Player::RegenerateHealth()
@@ -2808,8 +2808,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
// set armor (resistance 0) to original value (create_agility*2)
SetArmor(int32(m_createStats[STAT_AGILITY]*2));
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + SPELL_SCHOOL_NORMAL, 0.0f);
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + SPELL_SCHOOL_NORMAL, 0.0f);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + AsUnderlyingType(SPELL_SCHOOL_NORMAL), 0.0f);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + AsUnderlyingType(SPELL_SCHOOL_NORMAL), 0.0f);
// set other resistance to original value (0)
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
@@ -5361,7 +5361,7 @@ void Player::GetDodgeFromAgility(float &diminishing, float &nondiminishing) cons
return;
/// @todo research if talents/effects that increase total agility by x% should increase non-diminishing part
- float base_agility = GetCreateStat(STAT_AGILITY) * GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + STAT_AGILITY), BASE_PCT);
+ float base_agility = GetCreateStat(STAT_AGILITY) * GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + AsUnderlyingType(STAT_AGILITY)), BASE_PCT);
float bonus_agility = GetStat(STAT_AGILITY) - base_agility;
// calculate diminishing (green in char screen) and non-diminishing (white) contribution
@@ -5404,7 +5404,7 @@ float Player::GetRatingMultiplier(CombatRating cr) const
float Player::GetRatingBonusValue(CombatRating cr) const
{
- return float(GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr)) * GetRatingMultiplier(cr);
+ return float(GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(cr))) * GetRatingMultiplier(cr);
}
float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const
@@ -5507,7 +5507,7 @@ void Player::UpdateRating(CombatRating cr)
if (amount < 0)
amount = 0;
- SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
+ SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(cr), uint32(amount));
bool affectStats = CanModifyStats();
@@ -8055,7 +8055,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
if (spellEffectInfo.IsEffect())
- args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + spellEffectInfo.EffectIndex), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
+ args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + AsUnderlyingType(spellEffectInfo.EffectIndex)), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
}
CastSpell(target, spellInfo->Id, args);
}
@@ -20261,7 +20261,7 @@ void Player::_SaveStats(CharacterDatabaseTransaction trans) const
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_ATTACK_POWER));
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER));
stmt->setUInt32(index++, GetBaseSpellPowerBonus());
- stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(CR_CRIT_TAKEN_SPELL)));
trans->Append(stmt);
}
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 6e4b0ed7857..cd1b4f4b819 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -585,8 +585,8 @@ float Transport::CalculateSegmentPos(float now)
KeyFrame const& frame = *_currentFrame;
const float speed = float(m_goInfo->moTransport.moveSpeed);
const float accel = float(m_goInfo->moTransport.accelRate);
- float timeSinceStop = frame.TimeFrom + (now - (1.0f/IN_MILLISECONDS) * frame.DepartureTime);
- float timeUntilStop = frame.TimeTo - (now - (1.0f/IN_MILLISECONDS) * frame.DepartureTime);
+ float timeSinceStop = frame.TimeFrom + (now - (1.0f / float(IN_MILLISECONDS)) * frame.DepartureTime);
+ float timeUntilStop = frame.TimeTo - (now - (1.0f / float(IN_MILLISECONDS)) * frame.DepartureTime);
float segmentPos, dist;
float accelTime = _transportInfo->accelTime;
float accelDist = _transportInfo->accelDist;
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5dccf992645..b4c09f71e31 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -316,7 +316,7 @@ void Player::UpdateMaxHealth()
void Player::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float bonusPower = (power == POWER_MANA && GetCreatePowerValue(power) > 0) ? GetManaBonusFromIntellect() : 0;
@@ -851,7 +851,7 @@ void Player::UpdateSpellCritChance(uint32 school)
void Player::UpdateArmorPenetration(int32 amount)
{
// Store Rating Value
- SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_ARMOR_PENETRATION, amount);
+ SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(CR_ARMOR_PENETRATION), amount);
}
void Player::UpdateMeleeHitChances()
@@ -1036,7 +1036,7 @@ void Creature::UpdateMaxHealth()
void Creature::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreatePowerValue(power);
value *= GetPctModifierValue(unitMod, BASE_PCT);
@@ -1329,7 +1329,7 @@ void Guardian::UpdateMaxHealth()
void Guardian::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
float multiplicator = 15.0f;
@@ -1409,8 +1409,8 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
//demons benefit from warlocks shadow or fire damage
else if (IsPet())
{
- int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
- int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FIRE));
+ int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_SHADOW));
int32 maximum = (fire > shadow) ? fire : shadow;
if (maximum < 0)
maximum = 0;
@@ -1420,7 +1420,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
//water elementals benefit from mage's frost damage
else if (GetEntry() == ENTRY_WATER_ELEMENTAL)
{
- int32 frost = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
+ int32 frost = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FROST)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FROST));
if (frost < 0)
frost = 0;
SetBonusDamage(int32(frost * 0.4f));
@@ -1453,14 +1453,14 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
//force of nature
if (GetEntry() == ENTRY_TREANT)
{
- int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
+ int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_NATURE)) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_NATURE));
if (spellDmg > 0)
bonusDamage = spellDmg * 0.09f;
}
//greater fire elemental
else if (GetEntry() == ENTRY_FIRE_ELEMENTAL)
{
- int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
+ int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE)) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FIRE));
if (spellDmg > 0)
bonusDamage = spellDmg * 0.4f;
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index f2f1fbb955e..be5927abd26 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4954,8 +4954,8 @@ void Unit::UpdateResistanceBuffModsMod(SpellSchools school)
modPos *= factor;
modNeg *= factor;
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + school, modPos);
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + school, modNeg);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + AsUnderlyingType(school), modPos);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + AsUnderlyingType(school), modNeg);
}
void Unit::InitStatBuffMods()
@@ -4972,7 +4972,7 @@ void Unit::UpdateStatBuffMod(Stats stat)
float modNeg = 0.0f;
float factor = 0.0f;
- UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + stat);
+ UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
// includes value from items and enchantments
float modValue = GetFlatModifierValue(unitMod, BASE_VALUE);
@@ -5021,8 +5021,8 @@ void Unit::UpdateStatBuffMod(Stats stat)
modPos *= factor;
modNeg *= factor;
- SetFloatValue(UNIT_FIELD_POSSTAT0 + stat, modPos);
- SetFloatValue(UNIT_FIELD_NEGSTAT0 + stat, modNeg);
+ SetFloatValue(UNIT_FIELD_POSSTAT0 + AsUnderlyingType(stat), modPos);
+ SetFloatValue(UNIT_FIELD_NEGSTAT0 + AsUnderlyingType(stat), modNeg);
}
void Unit::_RegisterDynObject(DynamicObject* dynObj)
@@ -7023,7 +7023,7 @@ float Unit::SpellCritChanceDone(SpellInfo const* spellInfo, SpellSchoolMask scho
crit_chance = 0.0f;
// For other schools
else if (GetTypeId() == TYPEID_PLAYER)
- crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask));
+ crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + AsUnderlyingType(GetFirstSchoolInMask(schoolMask)));
else
{
crit_chance = (float)m_baseSpellCritChance;
@@ -8461,7 +8461,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal, bool withPowerUpdate /*= true*
uint32 Unit::GetAttackTime(WeaponAttackType att) const
{
- float f_BaseAttackTime = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att) / m_modAttackSpeedPct[att];
+ float f_BaseAttackTime = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + AsUnderlyingType(att)) / m_modAttackSpeedPct[att];
return (uint32)f_BaseAttackTime;
}
@@ -9212,7 +9212,7 @@ void Unit::UpdateAllDamagePctDoneMods()
float Unit::GetTotalStatValue(Stats stat) const
{
- UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + stat);
+ UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreateStat(stat);
@@ -9411,7 +9411,7 @@ void Unit::SetPower(Powers power, uint32 val, bool withPowerUpdate /*= true*/)
if (maxPower < val)
val = maxPower;
- SetStatInt32Value(UNIT_FIELD_POWER1 + power, val);
+ SetStatInt32Value(UNIT_FIELD_POWER1 + AsUnderlyingType(power), val);
if (withPowerUpdate)
{
@@ -9446,7 +9446,7 @@ void Unit::SetPower(Powers power, uint32 val, bool withPowerUpdate /*= true*/)
void Unit::SetMaxPower(Powers power, uint32 val)
{
uint32 cur_power = GetPower(power);
- SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val);
+ SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + AsUnderlyingType(power), val);
// group update
if (GetTypeId() == TYPEID_PLAYER)
@@ -10603,7 +10603,7 @@ void ApplyPercentModFloatVar(float& var, float val, bool apply)
void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
{
- float amount = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att);
+ float amount = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + AsUnderlyingType(att));
float remainingTimePct = (float)m_attackTimer[att] / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
if (val > 0.f)
@@ -10617,7 +10617,7 @@ void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply
ApplyPercentModFloatVar(amount, -val, apply);
}
- SetFloatValue(UNIT_FIELD_BASEATTACKTIME + att, amount);
+ SetFloatValue(UNIT_FIELD_BASEATTACKTIME + AsUnderlyingType(att), amount);
m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
}
@@ -12754,7 +12754,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
}
}
- std::function<void(Movement::MoveSplineInit&)> initializer = [=, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
{
float height = pos.GetPositionZ() + vehicleCollisionHeight;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index b7d8afcf47e..99fb781cef8 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -899,14 +899,14 @@ class TC_GAME_API Unit : public WorldObject
virtual Gender GetNativeGender() const { return GetGender(); }
virtual void SetNativeGender(Gender gender) { SetGender(gender); }
- float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); }
- void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); }
+ float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0 + int32(stat))); }
+ void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0 + int32(stat), val); }
uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); }
void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); }
- int32 GetResistance(SpellSchools school) const { return GetInt32Value(UNIT_FIELD_RESISTANCES + school); }
+ int32 GetResistance(SpellSchools school) const { return GetInt32Value(UNIT_FIELD_RESISTANCES + int32(school)); }
int32 GetResistance(SpellSchoolMask mask) const;
- void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES + school, val); }
+ void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES + int32(school), val); }
static float CalculateAverageResistReduction(WorldObject const* caster, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr);
uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); }
@@ -930,8 +930,8 @@ class TC_GAME_API Unit : public WorldObject
Powers GetPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE)); }
void SetPowerType(Powers power, bool sendUpdate = true);
void UpdateDisplayPower();
- uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); }
- uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); }
+ uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 + int32(power)); }
+ uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1 + int32(power)); }
float GetPowerPct(Powers power) const { return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
int32 CountPctFromMaxPower(Powers power, int32 pct) const { return CalculatePct(GetMaxPower(power), pct); }
void SetPower(Powers power, uint32 val, bool withPowerUpdate = true);
@@ -941,7 +941,7 @@ class TC_GAME_API Unit : public WorldObject
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate = true);
uint32 GetAttackTime(WeaponAttackType att) const;
- void SetAttackTime(WeaponAttackType att, uint32 val) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att, val*m_modAttackSpeedPct[att]); }
+ void SetAttackTime(WeaponAttackType att, uint32 val) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME + int32(att), val * m_modAttackSpeedPct[att]); }
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply);
void ApplyCastTimePercentMod(float val, bool apply);
@@ -1450,8 +1450,8 @@ class TC_GAME_API Unit : public WorldObject
void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); }
uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); }
uint32 GetCreatePowerValue(Powers power) const;
- float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT0+stat); }
- float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0+stat); }
+ float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT0 + int32(stat)); }
+ float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0 + int32(stat)); }
float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
uint32 GetChannelSpellId() const { return GetUInt32Value(UNIT_CHANNEL_SPELL); }
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index f7b26e1caca..109be7c4968 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -1258,7 +1258,7 @@ void Guild::HandleRoster(WorldSession* session)
memberData.Guid = member.GetGUID();
memberData.RankID = int32(member.GetRankId());
memberData.AreaID = int32(member.GetZoneId());
- memberData.LastSave = float(float(GameTime::GetGameTime() - member.GetLogoutTime()) / DAY);
+ memberData.LastSave = float(float(GameTime::GetGameTime() - member.GetLogoutTime()) / float(DAY));
memberData.Status = member.GetFlags();
memberData.Level = member.GetLevel();
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 41f5b42bc17..1680ed23b74 100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -394,7 +394,7 @@ void InstanceSaveManager::LoadResetTimes()
continue;
// the reset_delay must be at least one day
- uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY);
+ uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME)) / float(DAY)) * float(DAY));
if (period < DAY)
period = DAY;
@@ -451,7 +451,7 @@ time_t InstanceSaveManager::GetSubsequentResetTime(uint32 mapid, Difficulty diff
}
time_t resetHour = sWorld->getIntConfig(CONFIG_INSTANCE_RESET_TIME_HOUR);
- time_t period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME)) / DAY) * DAY);
+ time_t period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME)) / float(DAY)) * float(DAY));
if (period < DAY)
period = DAY;
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index 37ca7fcd7c0..ed0cfc71b17 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -327,7 +327,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
if (keyFrames[0].IsStopFrame())
{
curPathTime = float(keyFrames[0].Node->Delay);
- keyFrames[0].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
+ keyFrames[0].DepartureTime = uint32(curPathTime * float(IN_MILLISECONDS));
}
for (size_t i = 1; i < keyFrames.size(); ++i)
@@ -335,15 +335,15 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
curPathTime += keyFrames[i - 1].TimeTo;
if (keyFrames[i].IsStopFrame())
{
- keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
+ keyFrames[i].ArriveTime = uint32(curPathTime * float(IN_MILLISECONDS));
keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
curPathTime += float(keyFrames[i].Node->Delay);
- keyFrames[i].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
+ keyFrames[i].DepartureTime = uint32(curPathTime * float(IN_MILLISECONDS));
}
else
{
curPathTime -= keyFrames[i].TimeTo;
- keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
+ keyFrames[i].ArriveTime = uint32(curPathTime * float(IN_MILLISECONDS));
keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
keyFrames[i].DepartureTime = keyFrames[i].ArriveTime;
}
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 636e121c2ab..4a137dcce91 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -686,7 +686,7 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance)
else
{
// We are already close enough. We just need to turn toward the target without changing position.
- std::function<void(Movement::MoveSplineInit&)> initializer = [=, target = target->GetGUID()](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this, target = target->GetGUID()](Movement::MoveSplineInit& init)
{
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
init.SetFacing(target);
@@ -840,7 +840,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float o, float speedXY, f
void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount)
{
- std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this](Movement::MoveSplineInit& init)
{
float step = 2 * float(M_PI) / stepCount * (clockwise ? -1.0f : 1.0f);
Position const& pos = { x, y, z, 0.0f };
@@ -962,7 +962,7 @@ void MotionMaster::MoveFall(uint32 id/* = 0*/)
return;
}
- std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this](Movement::MoveSplineInit& init)
{
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz + _owner->GetHoverOffset(), false);
init.SetFall();
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index ded1aa69521..21bd7068bb7 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -220,14 +220,11 @@ bool MoveSplineInitArgs::_checkPathBounds() const
{
if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size() > 2)
{
- enum{
- MAX_OFFSET = (1 << 11) / 2
- };
+ constexpr float MAX_OFFSET = float((1 << 11) / 2);
Vector3 middle = (path.front()+path.back()) / 2;
- Vector3 offset;
for (uint32 i = 1; i < path.size()-1; ++i)
{
- offset = path[i] - middle;
+ Vector3 offset = path[i] - middle;
if (std::fabs(offset.x) >= MAX_OFFSET || std::fabs(offset.y) >= MAX_OFFSET || std::fabs(offset.z) >= MAX_OFFSET)
{
TC_LOG_ERROR("misc", "MoveSplineInitArgs::_checkPathBounds check failed");
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp
index 321af22be02..b2f20bff184 100644
--- a/src/server/game/Scripting/ScriptReloadMgr.cpp
+++ b/src/server/game/Scripting/ScriptReloadMgr.cpp
@@ -986,7 +986,7 @@ private:
// the module which prevents it from unloading.
// The module will be unloaded once all scripts provided from the module
// are destroyed.
- if (!ref->second.first.unique())
+ if (ref->second.first.use_count() != 1)
{
TC_LOG_INFO("scripts.hotswap",
"Script module %s is still used by %lu spell, aura or instance scripts. "
@@ -1569,7 +1569,7 @@ void SourceUpdateListener::handleFileAction(efsw::WatchID watchid, std::string c
return;
}
- auto const path = fs::absolute(
+ fs::path path = fs::absolute(
filename,
dir);
@@ -1578,7 +1578,7 @@ void SourceUpdateListener::handleFileAction(efsw::WatchID watchid, std::string c
return;
/// Thread safe part
- sScriptReloadMgr->QueueMessage([=](HotSwapScriptReloadMgr* reloader)
+ sScriptReloadMgr->QueueMessage([=, this, path = std::move(path)](HotSwapScriptReloadMgr* reloader)
{
TC_LOG_TRACE("scripts.hotswap", "Detected source change on module \"%s\", "
"queued for recompilation...", script_module_name_.c_str());
diff --git a/src/server/game/Server/Packets/MailPackets.cpp b/src/server/game/Server/Packets/MailPackets.cpp
index 47db7120e76..5e0c745e333 100644
--- a/src/server/game/Server/Packets/MailPackets.cpp
+++ b/src/server/game/Server/Packets/MailPackets.cpp
@@ -16,6 +16,7 @@
*/
#include "MailPackets.h"
+#include "GameTime.h"
#include "Item.h"
#include "Mail.h"
#include "Player.h"
@@ -87,7 +88,7 @@ WorldPackets::Mail::MailListEntry::MailListEntry(::Mail const* mail, ::Player* p
StationeryID = mail->stationery;
SentMoney = mail->money;
Flags = mail->checked;
- DaysLeft = float(mail->expire_time - time(nullptr)) / DAY;
+ DaysLeft = float(mail->expire_time - GameTime::GetGameTime()) / float(DAY);
MailTemplateID = mail->mailTemplateId;
Subject = mail->subject;
Body = mail->body;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 0d7f351389a..eb6ffc3012b 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3712,8 +3712,7 @@ void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const* aurApp, uint
return;
Unit* target = aurApp->GetTarget();
- Powers powerType = Powers(GetMiscValue());
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + GetMiscValue());
target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
}
@@ -3725,7 +3724,7 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurAp
Unit* target = aurApp->GetTarget();
Powers powerType = Powers(GetMiscValue());
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + GetMiscValue());
// Save old powers for further calculation
int32 oldPower = int32(target->GetPower(powerType));
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index db9b38b5288..29bb4cec9f1 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -653,7 +653,7 @@ void Spell::EffectSchoolDMG()
float average = (minTotal + maxTotal) / 2;
// Add main hand dps * effect[2] amount
int32 count = unitCaster->CalculateSpellDamage(m_spellInfo->GetEffect(EFFECT_2));
- damage += count * int32(average * IN_MILLISECONDS) / unitCaster->GetAttackTime(BASE_ATTACK);
+ damage += count * int32(average * float(IN_MILLISECONDS)) / unitCaster->GetAttackTime(BASE_ATTACK);
break;
}
// Shield of Righteousness
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 56d8c741cdd..38347a1bae5 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -3214,7 +3214,7 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school
}
SpellSchools school = GetFirstSchoolInMask(schoolMask);
// Flat mod from caster auras by spell school
- powerCost += unitCaster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
+ powerCost += unitCaster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + AsUnderlyingType(school));
// Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
if (HasAttribute(SPELL_ATTR4_SPELL_VS_EXTEND_COST))
@@ -3244,7 +3244,7 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school
}
// PCT mod from user auras by school
- powerCost = int32(powerCost * (1.0f + unitCaster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school)));
+ powerCost = int32(powerCost * (1.0f + unitCaster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + AsUnderlyingType(school))));
if (powerCost < 0)
powerCost = 0;
return powerCost;
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index e6ad0dce98c..9d6ce882431 100644
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -30,7 +30,7 @@
#include "WorldPacket.h"
#include "WorldSession.h"
-inline float GetAge(uint64 t) { return float(GameTime::GetGameTime() - t) / DAY; }
+inline float GetAge(uint64 t) { return float(GameTime::GetGameTime() - t) / float(DAY); }
///////////////////////////////////////////////////////////////////////////////////////////////////
// GM ticket
diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp
index 622b625ee3c..9976fbd9bf7 100644
--- a/src/server/scripts/Commands/cs_rbac.cpp
+++ b/src/server/scripts/Commands/cs_rbac.cpp
@@ -34,6 +34,7 @@ EndScriptData */
struct RBACCommandData
{
+ RBACCommandData(rbac::RBACData* rbac_, bool needDelete_) : rbac(rbac_), needDelete(needDelete_) { }
RBACCommandData(RBACCommandData const&) = delete;
~RBACCommandData()
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index d87d2aa17dc..b6c3e849f4b 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -472,7 +472,7 @@ struct npc_eye_of_acherus : public ScriptedAI
break;
case EVENT_LAUNCH_TOWARDS_DESTINATION:
{
- std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, me = me](Movement::MoveSplineInit& init)
{
Movement::PointsArray path(EyeOfAcherusPath, EyeOfAcherusPath + EyeOfAcherusPathSize);
init.MovebyPath(path);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index 3a5dc9f3e87..8f1116c7c71 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -710,7 +710,7 @@ class boss_gazakroth : public CreatureScript
if (firebolt_timer <= diff)
{
DoCastVictim(SPELL_FIREBOLT, false);
- firebolt_timer = 0.7 * IN_MILLISECONDS;
+ firebolt_timer = 700;
}
else
firebolt_timer -= diff;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
index efbdd91ca8f..200ee9d35ca 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -306,12 +306,12 @@ class npc_chromie_start : public CreatureScript
{
InitGossipMenuFor(player, GOSSIP_MENU_INITIAL);
if (player->CanBeGameMaster()) // GM instance state override menu
- AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "[GM] Access instance control panel", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_OPEN_GM_MENU);
+ AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "[GM] Access instance control panel", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_OPEN_GM_MENU));
uint32 state = instance->GetData(DATA_INSTANCE_PROGRESS);
if (state < PURGE_STARTING)
{
- AddGossipItemFor(player, GOSSIP_MENU_INITIAL, GOSSIP_OPTION_EXPLAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_EXPLAIN);
+ AddGossipItemFor(player, GOSSIP_MENU_INITIAL, GOSSIP_OPTION_EXPLAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_EXPLAIN));
{
bool shouldAddSkipGossip = true;
Map::PlayerList const& players = instance->instance->GetPlayers();
@@ -329,13 +329,13 @@ class npc_chromie_start : public CreatureScript
}
}
if (shouldAddSkipGossip)
- AddGossipItemFor(player, GOSSIP_MENU_INITIAL, GOSSIP_OPTION_SKIP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_SKIP);
+ AddGossipItemFor(player, GOSSIP_MENU_INITIAL, GOSSIP_OPTION_SKIP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_SKIP));
}
SendGossipMenuFor(player, GOSSIP_TEXT_INITIAL, me->GetGUID());
}
else
{
- AddGossipItemFor(player, GOSSIP_MENU_INITIAL, GOSSIP_OPTION_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_TELEPORT);
+ AddGossipItemFor(player, GOSSIP_MENU_INITIAL, GOSSIP_OPTION_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_TELEPORT));
SendGossipMenuFor(player, GOSSIP_TEXT_TELEPORT, me->GetGUID());
}
}
@@ -352,12 +352,12 @@ class npc_chromie_start : public CreatureScript
{
case GOSSIP_OFFSET_EXPLAIN:
InitGossipMenuFor(player, GOSSIP_MENU_EXPLAIN_1);
- AddGossipItemFor(player, GOSSIP_MENU_EXPLAIN_1, GOSSIP_OPTION_EXPLAIN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_EXPLAIN_1);
+ AddGossipItemFor(player, GOSSIP_MENU_EXPLAIN_1, GOSSIP_OPTION_EXPLAIN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_EXPLAIN_1));
SendGossipMenuFor(player, GOSSIP_TEXT_EXPLAIN_1, me->GetGUID());
break;
case GOSSIP_OFFSET_SKIP:
InitGossipMenuFor(player, GOSSIP_MENU_SKIP_1);
- AddGossipItemFor(player, GOSSIP_MENU_SKIP_1, GOSSIP_OPTION_SKIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_SKIP_1);
+ AddGossipItemFor(player, GOSSIP_MENU_SKIP_1, GOSSIP_OPTION_SKIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_SKIP_1));
SendGossipMenuFor(player, GOSSIP_TEXT_SKIP_1, me->GetGUID());
break;
case GOSSIP_OFFSET_SKIP_1:
@@ -369,7 +369,7 @@ class npc_chromie_start : public CreatureScript
break;
case GOSSIP_OFFSET_EXPLAIN_1:
InitGossipMenuFor(player, GOSSIP_MENU_EXPLAIN_2);
- AddGossipItemFor(player, GOSSIP_MENU_EXPLAIN_2, GOSSIP_OPTION_EXPLAIN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_EXPLAIN_2);
+ AddGossipItemFor(player, GOSSIP_MENU_EXPLAIN_2, GOSSIP_OPTION_EXPLAIN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_EXPLAIN_2));
SendGossipMenuFor(player, GOSSIP_TEXT_EXPLAIN_2, me->GetGUID());
break;
case GOSSIP_OFFSET_EXPLAIN_2:
@@ -379,16 +379,16 @@ class npc_chromie_start : public CreatureScript
me->CastSpell(player, SPELL_SUMMON_ARCANE_DISRUPTOR);
break;
case GOSSIP_OFFSET_OPEN_GM_MENU:
- AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Teleport all players to Arthas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_GM_INITIAL);
+ AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Teleport all players to Arthas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_GM_INITIAL));
for (uint32 state = 1; state <= COMPLETE; state = state << 1)
{
if (GetStableStateFor(COSProgressStates(state)) == state)
- AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, Trinity::StringFormat("Set instance progress to 0x%05X", state).c_str(), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_GM_INITIAL + state);
+ AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, Trinity::StringFormat("Set instance progress to 0x%05X", state), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_GM_INITIAL) + state);
}
for (uint32 state = 1; state <= COMPLETE; state = state << 1)
{
if (GetStableStateFor(COSProgressStates(state)) != state)
- AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, Trinity::StringFormat("Force state to 0x%05X (UNSTABLE)", state).c_str(), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_GM_INITIAL + state);
+ AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, Trinity::StringFormat("Force state to 0x%05X (UNSTABLE)", state), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_GM_INITIAL) + state);
}
SendGossipMenuFor(player, GOSSIP_TEXT_SKIP_1, me->GetGUID());
break;
@@ -404,7 +404,7 @@ class npc_chromie_start : public CreatureScript
if (!player->CanBeGameMaster())
break;
if (InstanceScript* instance = me->GetInstanceScript())
- instance->SetData(DATA_GM_OVERRIDE, action - GOSSIP_ACTION_INFO_DEF - GOSSIP_OFFSET_GM_INITIAL);
+ instance->SetData(DATA_GM_OVERRIDE, action - GOSSIP_ACTION_INFO_DEF - AsUnderlyingType(GOSSIP_OFFSET_GM_INITIAL));
break;
}
return false;
@@ -514,7 +514,7 @@ class npc_chromie_middle : public CreatureScript
player->PrepareQuestMenu(me->GetGUID());
if (Instance->GetData(DATA_INSTANCE_PROGRESS) == CRATES_DONE)
- AddGossipItemFor(player, GOSSIP_MENU_STEP1, GOSSIP_OPTION_STEP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_STEP1);
+ AddGossipItemFor(player, GOSSIP_MENU_STEP1, GOSSIP_OPTION_STEP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_STEP1));
SendGossipMenuFor(player, GOSSIP_TEXT_STEP1, me->GetGUID());
return true;
}
@@ -527,12 +527,12 @@ class npc_chromie_middle : public CreatureScript
{
case GOSSIP_OFFSET_STEP1:
InitGossipMenuFor(player, GOSSIP_MENU_STEP2);
- AddGossipItemFor(player, GOSSIP_MENU_STEP2, GOSSIP_OPTION_STEP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_STEP2);
+ AddGossipItemFor(player, GOSSIP_MENU_STEP2, GOSSIP_OPTION_STEP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_STEP2));
SendGossipMenuFor(player, GOSSIP_TEXT_STEP2, me->GetGUID());
break;
case GOSSIP_OFFSET_STEP2:
InitGossipMenuFor(player, GOSSIP_MENU_STEP3);
- AddGossipItemFor(player, GOSSIP_MENU_STEP3, GOSSIP_OPTION_STEP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + GOSSIP_OFFSET_STEP3);
+ AddGossipItemFor(player, GOSSIP_MENU_STEP3, GOSSIP_OPTION_STEP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + AsUnderlyingType(GOSSIP_OFFSET_STEP3));
SendGossipMenuFor(player, GOSSIP_TEXT_STEP3, me->GetGUID());
break;
case GOSSIP_OFFSET_STEP3:
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index e13337d64dc..9c7fc4753d2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -60,12 +60,13 @@ enum Sound
enum Misc
{
- PULL_RANGE = 50,
ABUSE_BUG_RANGE = 20,
VEKLOR_DIST = 20, // VL will not come to melee when attacking
TELEPORTTIME = 30000
};
+static constexpr float PULL_RANGE = 50.0f;
+
struct boss_twinemperorsAI : public BossAI
{
boss_twinemperorsAI(Creature* creature): BossAI(creature, DATA_TWIN_EMPERORS)
diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
index ca4ae2107d9..7cf2891403e 100644
--- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
@@ -436,12 +436,12 @@ public:
break;
case PHASE_PLANT_FIRST_STAND: // plant first explosives stage 1 stand
me->SetStandState(UNIT_STAND_STATE_STAND);
- _moveTimer = 0.5* IN_MILLISECONDS;
+ _moveTimer = 0.5* AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_PLANT_FIRST_WORK;
break;
case PHASE_PLANT_FIRST_WORK: // plant first explosives stage 2 work
Talk(SAY_LEGOSO_4);
- _moveTimer = 17.5 * IN_MILLISECONDS;
+ _moveTimer = 17.5 * AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_PLANT_FIRST_FINISH;
break;
case PHASE_PLANT_FIRST_FINISH: // plant first explosives finish
@@ -455,7 +455,7 @@ public:
// force runoff movement so he will not screw up next waypoint
me->GetMotionMaster()->MovePoint(WP_EXPLOSIVES_FIRST_RUNOFF, -1955.6f, -10669.8f, 110.65f, false);
Talk(SAY_LEGOSO_5);
- _moveTimer = 1.5 * IN_MILLISECONDS;
+ _moveTimer = 1.5 * AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_CONTINUE;
break;
case PHASE_PLANT_FIRST_TIMER_1: // first explosives detonate timer 1
@@ -661,7 +661,7 @@ public:
SetEscortPaused(true);
me->SetFacingToObject(player);
Talk(SAY_LEGOSO_1);
- _moveTimer = 2.5 * IN_MILLISECONDS;
+ _moveTimer = 2.5 * AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_CONTINUE;
break;
case WP_EXPLOSIVES_FIRST_POINT:
@@ -681,7 +681,7 @@ public:
break;
case WP_DEBUG_1:
SetEscortPaused(true);
- _moveTimer = 0.5 * IN_MILLISECONDS;
+ _moveTimer = 0.5 * AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_WP_26;
break;
case WP_SIRONAS_HILL:
@@ -708,12 +708,12 @@ public:
}
case WP_EXPLOSIVES_SECOND_BATTLEROAR:
SetEscortPaused(true);
- _moveTimer = 0.2 * IN_MILLISECONDS;
+ _moveTimer = 0.2 * AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_MEET_SIRONAS_ROAR;
break;
case WP_EXPLOSIVES_SECOND_PLANT:
SetEscortPaused(true);
- _moveTimer = 0.5 * IN_MILLISECONDS;
+ _moveTimer = 0.5 * AsUnderlyingType(IN_MILLISECONDS);
_phase = PHASE_PLANT_SECOND_KNEEL;
break;
case WP_EXPLOSIVES_SECOND_DETONATE:
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index cc96f07496a..49b25a27040 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -879,7 +879,7 @@ public:
Player* groupMember = nullptr;
uint8 GroupMemberCount = 0;
- uint8 DeadMemberCount = 0;
+ //uint8 DeadMemberCount = 0;
uint8 FailedMemberCount = 0;
Group::MemberSlotList const& members = EventGroup->GetMemberSlots();
@@ -896,8 +896,8 @@ public:
}
++GroupMemberCount;
- if (groupMember->isDead())
- ++DeadMemberCount;
+ //if (groupMember->isDead())
+ // ++DeadMemberCount;
}
if (GroupMemberCount == FailedMemberCount || !player->IsWithinDistInMap(me, EVENT_AREA_RADIUS))
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 3ee434e343e..a0824886d4a 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -198,7 +198,7 @@ struct npc_webwrap : public NullCreatureAI
victimGUID = guid;
if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
{
- visibleTimer = (me->GetDistance2d(victim)/WEB_WRAP_MOVE_SPEED + 0.5f) * IN_MILLISECONDS;
+ visibleTimer = (me->GetDistance2d(victim) / WEB_WRAP_MOVE_SPEED + 0.5f) * AsUnderlyingType(IN_MILLISECONDS);
victim->CastSpell(victim, SPELL_WEB_WRAP, me->GetGUID());
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index b68d64307a2..fef51b6481f 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -57,10 +57,11 @@ enum Creatures
enum Misc
{
DATA_MAX_SPARKS = 5,
- DATA_MAX_SPARK_DISTANCE = 90, // Distance to boss - prevent runs through the whole instance
DATA_POINT_CALLBACK = 0
};
+static constexpr float DATA_MAX_SPARK_DISTANCE = 90; // Distance to boss - prevent runs through the whole instance
+
/*######
## Boss Ionar
######*/
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 068ee909857..201903d1a7d 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -306,8 +306,8 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
- int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
- int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FIRE));
+ int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_SHADOW));
int32 maximum = (fire > shadow) ? fire : shadow;
if (maximum < 0)
maximum = 0;
@@ -334,8 +334,8 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
//the damage bonus used for pets is either fire or shadow damage, whatever is higher
- int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
- int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FIRE));
+ int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_SHADOW));
int32 maximum = (fire > shadow) ? fire : shadow;
float bonusDamage = 0.0f;
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index a55e4ecb42a..8e05a5ecdaa 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -727,7 +727,7 @@ class spell_warl_life_tap : public SpellScript
int32 base = GetEffectInfo(effIndex).CalcValue();
float penalty = caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo());
- float fmana = (float)base + caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW) * 0.5f * penalty;
+ float fmana = (float)base + caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW)) * 0.5f * penalty;
// Improved Life Tap mod
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0))
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 069360bc77f..36b93e66e2e 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -2085,7 +2085,7 @@ class npc_train_wrecker : public CreatureScript
{
me->SetFacingTo(target->GetOrientation());
me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H);
- _timer = 1.5 * IN_MILLISECONDS;
+ _timer = 1.5 * AsUnderlyingType(IN_MILLISECONDS);
_nextAction = EVENT_DO_WRECK;
}
else
diff --git a/src/server/shared/DataStores/DBCStorageIterator.h b/src/server/shared/DataStores/DBCStorageIterator.h
index 7f27be9b459..d4ac54bc64c 100644
--- a/src/server/shared/DataStores/DBCStorageIterator.h
+++ b/src/server/shared/DataStores/DBCStorageIterator.h
@@ -21,49 +21,55 @@
#include "Define.h"
#include <iterator>
-template <class T>
-class DBCStorageIterator : public std::iterator<std::forward_iterator_tag, T>
+template<class T>
+class DBCStorageIterator
{
- public:
- DBCStorageIterator() : _index(nullptr), _pos(0), _end(0) { }
- DBCStorageIterator(T** index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size)
+public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = T;
+ using difference_type = std::ptrdiff_t;
+ using pointer = T*;
+ using reference = T&;
+
+ DBCStorageIterator() : _index(nullptr), _pos(0), _end(0) { }
+ DBCStorageIterator(T const* const* index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size)
+ {
+ if (_pos < _end)
{
- if (_pos < _end)
- {
- while (_pos < _end && !_index[_pos])
- ++_pos;
- }
+ while (_pos < _end && !_index[_pos])
+ ++_pos;
}
+ }
- T const* operator->() { return _index[_pos]; }
- T const* operator*() { return _index[_pos]; }
+ T const* operator->() const { return _index[_pos]; }
+ T const* operator*() const { return _index[_pos]; }
- bool operator==(DBCStorageIterator const& right) const { /*ASSERT(_index == right._index, "Iterator belongs to a different container")*/ return _pos == right._pos; }
- bool operator!=(DBCStorageIterator const& right) const { return !(*this == right); }
+ bool operator==(DBCStorageIterator const& right) const { /*ASSERT(_index == right._index, "Iterator belongs to a different container")*/ return _pos == right._pos; }
+ bool operator!=(DBCStorageIterator const& right) const { return !(*this == right); }
- DBCStorageIterator& operator++()
+ DBCStorageIterator& operator++()
+ {
+ if (_pos < _end)
{
- if (_pos < _end)
- {
- do
- ++_pos;
- while (_pos < _end && !_index[_pos]);
- }
-
- return *this;
+ do
+ ++_pos;
+ while (_pos < _end && !_index[_pos]);
}
- DBCStorageIterator operator++(int)
- {
- DBCStorageIterator tmp = *this;
- ++*this;
- return tmp;
- }
+ return *this;
+ }
+
+ DBCStorageIterator operator++(int)
+ {
+ DBCStorageIterator tmp = *this;
+ ++*this;
+ return tmp;
+ }
- private:
- T** _index;
- uint32 _pos;
- uint32 _end;
+private:
+ T const* const* _index;
+ uint32 _pos;
+ uint32 _end;
};
#endif // DBCStorageIterator_h__