From e9c86737fb5888dd9b8bdfdbc0c5a821cdc63ce8 Mon Sep 17 00:00:00 2001 From: Takenbacon Date: Wed, 18 Dec 2024 04:48:06 -0800 Subject: [PATCH] refactor(Core/Random): Remove unused map based RNG (#20939) Remove unused map based RNG --- src/server/game/Entities/Object/Object.h | 8 -------- .../MovementGenerators/ConfusedMovementGenerator.cpp | 5 ----- src/server/game/Spells/Spell.h | 8 -------- 3 files changed, 21 deletions(-) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index c0b7239a27644f..2fe73c1aeccef4 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -590,14 +590,6 @@ class WorldObject : public Object, public WorldLocation return GetMapId() == 571 && GetPositionX() > 3733.33331f && GetPositionX() < 5866.66663f && GetPositionY() > 1599.99999f && GetPositionY() < 4799.99997f; } -#ifdef MAP_BASED_RAND_GEN - int32 irand(int32 min, int32 max) const { return int32 (GetMap()->mtRand.randInt(max - min)) + min; } - uint32 urand(uint32 min, uint32 max) const { return GetMap()->mtRand.randInt(max - min) + min;} - int32 rand32() const { return GetMap()->mtRand.randInt();} - double rand_norm() const { return GetMap()->mtRand.randExc();} - double rand_chance() const { return GetMap()->mtRand.randExc(100.0);} -#endif - uint32 LastUsedScriptID; // Transports diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index c331bf19f32bf5..6d3d1007c86342 100644 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -21,11 +21,6 @@ #include "MoveSplineInit.h" #include "Player.h" -#ifdef MAP_BASED_RAND_GEN -#define rand_norm() unit.rand_norm() -#define urand(a, b) unit.urand(a, b) -#endif - template void ConfusedMovementGenerator::DoInitialize(T* unit) { diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index be8ff1802e4987..d5e9f26c8d175d 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -783,14 +783,6 @@ class Spell bool _spellTargetsSelected; ByteBuffer* m_effectExecuteData[MAX_SPELL_EFFECTS]; - -#ifdef MAP_BASED_RAND_GEN - int32 irand(int32 min, int32 max) { return int32 (m_caster->GetMap()->mtRand.randInt(max - min)) + min; } - uint32 urand(uint32 min, uint32 max) { return m_caster->GetMap()->mtRand.randInt(max - min) + min; } - int32 rand32() { return m_caster->GetMap()->mtRand.randInt(); } - double rand_norm() { return m_caster->GetMap()->mtRand.randExc(); } - double rand_chance() { return m_caster->GetMap()->mtRand.randExc(100.0); } -#endif }; namespace Acore