Skip to content

Commit

Permalink
Attempt to fix the compile after the mess left behind
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1arm committed Aug 19, 2024
1 parent e053301 commit 1cc7dd7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/game/WorldHandlers/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1731,8 +1731,17 @@ struct TargetDistanceOrderNear
};

// Helper for targets furthest away to the spell target

template <class Arg1, class Arg2, class Result>
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<const Unit, const Unit, bool>
struct TargetDistanceOrderFarAway : public binary_function<const Unit, const Unit, bool>
{
const Unit* MainTarget;
TargetDistanceOrderFarAway(const Unit* Target) : MainTarget(Target) {};
Expand Down
6 changes: 5 additions & 1 deletion src/game/WorldHandlers/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "TemporarySummon.h"
#include "ScriptMgr.h"
#include "G3D/Vector3.h"
#include <random>

#ifdef ENABLE_ELUNA
#include "LuaEngine.h"
Expand Down Expand Up @@ -1379,7 +1380,10 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)

uint32 possibleSpells[] = {36693, 36694, 36695, 36696, 36697, 36698, 36699, 36700} ;
std::vector<uint32> 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)
{
Expand Down
4 changes: 2 additions & 2 deletions src/game/WorldHandlers/SpellHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1cc7dd7

Please sign in to comment.