From 1cc7dd704dbcd7f1d4fd7b45da06e199fceb2aa5 Mon Sep 17 00:00:00 2001 From: billy1arm Date: Mon, 19 Aug 2024 01:05:46 +0100 Subject: [PATCH] Attempt to fix the compile after the mess left behind --- src/game/WorldHandlers/Spell.cpp | 11 ++++++++++- src/game/WorldHandlers/SpellEffects.cpp | 6 +++++- src/game/WorldHandlers/SpellHandler.cpp | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 301380b39..c60494c9e 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -1731,8 +1731,17 @@ struct TargetDistanceOrderNear }; // Helper for targets furthest away to the spell target + +template +struct binary_function +{ + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; + // The spell target is always first unless there is a target at _completely_ the same position (unbelievable case) -struct TargetDistanceOrderFarAway : public std::binary_function +struct TargetDistanceOrderFarAway : public binary_function { const Unit* MainTarget; TargetDistanceOrderFarAway(const Unit* Target) : MainTarget(Target) {}; diff --git a/src/game/WorldHandlers/SpellEffects.cpp b/src/game/WorldHandlers/SpellEffects.cpp index 9cab35ca5..aed569a4c 100644 --- a/src/game/WorldHandlers/SpellEffects.cpp +++ b/src/game/WorldHandlers/SpellEffects.cpp @@ -54,6 +54,7 @@ #include "TemporarySummon.h" #include "ScriptMgr.h" #include "G3D/Vector3.h" +#include #ifdef ENABLE_ELUNA #include "LuaEngine.h" @@ -1379,7 +1380,10 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) uint32 possibleSpells[] = {36693, 36694, 36695, 36696, 36697, 36698, 36699, 36700} ; std::vector spellPool(possibleSpells, possibleSpells + countof(possibleSpells)); - std::random_shuffle(spellPool.begin(), spellPool.end()); + + //std::random_shuffle(spellPool.begin(), spellPool.end()); + std::mt19937 rng(std::time(nullptr)); + std::shuffle(spellPool.begin(), spellPool.end(), rng); for (uint8 i = 0; i < (m_caster->GetMap()->IsRegularDifficulty() ? 2 : 4); ++i) { diff --git a/src/game/WorldHandlers/SpellHandler.cpp b/src/game/WorldHandlers/SpellHandler.cpp index 27e062c2e..4713fd1b5 100644 --- a/src/game/WorldHandlers/SpellHandler.cpp +++ b/src/game/WorldHandlers/SpellHandler.cpp @@ -69,7 +69,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - DETAIL_LOG("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, spell_count: %u , cast_count: %u, Item: %u, data length = " SIZEFMTD, bagIndex, slot, spell_count, cast_count, pItem->GetEntry(), recvPacket.size()); + DETAIL_LOG("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, spell_count: %u , cast_count: %u, Item: %u, data length = %zu", bagIndex, slot, spell_count, cast_count, pItem->GetEntry(), recvPacket.size()); ItemPrototype const* proto = pItem->GetProto(); if (!proto) @@ -328,7 +328,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) return; } - DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u data length = " %zu, + DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u data length = %zu", spellId, cast_count, recvPacket.size()); SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);