From b206e5ddd06477556c956e6a2bb843f1f4abdd4d Mon Sep 17 00:00:00 2001 From: Kid10 Date: Wed, 5 Jan 2011 00:44:57 +0300 Subject: [PATCH] [10962] Fixed wrong spell cast code call with missing bool arg. Signed-off-by: VladimirMangos Also added trap code for like wrong cases --- src/game/Map.cpp | 2 +- src/game/SpellAuras.cpp | 2 +- src/game/Unit.h | 16 ++++++++++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index bf85f6859..dffa23cb8 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2397,7 +2397,7 @@ void Map::ScriptsProcess() Unit* spellSource = (Unit*)cmdSource; //TODO: when GO cast implemented, code below must be updated accordingly to also allow GO spell cast - spellSource->CastSpell(spellTarget, step.script->castSpell.spellId, step.script->castSpell.flags & 0x04); + spellSource->CastSpell(spellTarget, step.script->castSpell.spellId, (step.script->castSpell.flags & 0x04) != 0); break; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index f3823d1e5..d5cd4d959 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3041,7 +3041,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if ((int32)target->GetPower(POWER_ENERGY) > furorChance) { target->SetPower(POWER_ENERGY, 0); - target->CastCustomSpell(target, 17099, &furorChance, NULL, NULL, this); + target->CastCustomSpell(target, 17099, &furorChance, NULL, NULL, true, NULL, this); } } else if(furorChance) // only if talent known diff --git a/src/game/Unit.h b/src/game/Unit.h index e6c20a95d..370d7c1a0 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -2070,6 +2070,22 @@ class MANGOS_DLL_SPEC Unit : public WorldObject GuardianPetList m_guardianPets; uint64 m_TotemSlot[MAX_TOTEM_SLOT]; + + private: // Error traps for some wrong args using + // this will catch and prevent build for any cases when all optional args skipped and instead triggered used non boolean type + // no bodies expected for this declarations + template + void CastSpell(Unit* Victim, uint32 spell, TR triggered); + template + void CastSpell(Unit* Victim, SpellEntry const* spell, TR triggered); + template + void CastCustomSpell(Unit* Victim, uint32 spell, int32 const* bp0, int32 const* bp1, int32 const* bp2, TR triggered); + template + void CastCustomSpell(Unit* Victim, SpellEntry const* spell, int32 const* bp0, int32 const* bp1, int32 const* bp2, TR triggered); + template + void CastSpell(float x, float y, float z, uint32 spell, TR triggered); + template + void CastSpell(float x, float y, float z, SpellEntry const* spell, TR triggered); }; template diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index af4b830f6..df968baae 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10961" + #define REVISION_NR "10962" #endif // __REVISION_NR_H__