Core/ScriptSystem: Add compile time type check of function assigned to hooks - prevents incorrect function calls. Since this rev you have to put PrepareSpellScript(<yourscriptclassnamehere>) at the beginning of every spell script. Yes, i know it's unhandy, but unfortunately C++ preprocessor is very limited, so you have to do that extra work each time you write a script:(.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-10-08 21:33:44 +02:00
parent e5e53498ce
commit 1760e42e2c
23 changed files with 120 additions and 15 deletions

View File

@@ -903,6 +903,7 @@ class spell_deathbringer_blood_link : public SpellScriptLoader
class spell_deathbringer_blood_link_SpellScript : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_link_SpellScript)
bool Validate(SpellEntry const* /*spellInfo*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_POWER))
@@ -990,6 +991,7 @@ class spell_deathbringer_blood_power : public SpellScriptLoader
class spell_deathbringer_blood_power_SpellScript : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_power_SpellScript)
void ModAuraValue()
{
if (Aura* aura = GetHitAura())
@@ -1042,6 +1044,7 @@ class spell_deathbringer_rune_of_blood : public SpellScriptLoader
class spell_deathbringer_rune_of_blood_SpellScript : public SpellScript
{
PrepareSpellScript(spell_deathbringer_rune_of_blood_SpellScript)
bool Validate(SpellEntry const* /*spellInfo*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_DUMMY))
@@ -1075,6 +1078,7 @@ class spell_deathbringer_blood_nova : public SpellScriptLoader
class spell_deathbringer_blood_nova_SpellScript : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_nova_SpellScript)
bool Validate(SpellEntry const* /*spellInfo*/)
{
if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_DUMMY))

View File

@@ -328,6 +328,7 @@ class spell_festergut_pungent_blight : public SpellScriptLoader
class spell_festergut_pungent_blight_SpellScript : public SpellScript
{
PrepareSpellScript(spell_festergut_pungent_blight_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(GetEffectValue());
@@ -361,6 +362,7 @@ class spell_festergut_gastric_bloat : public SpellScriptLoader
class spell_festergut_gastric_bloat_SpellScript : public SpellScript
{
PrepareSpellScript(spell_festergut_gastric_bloat_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
Aura const* aura = GetHitUnit()->GetAura(GetSpellInfo()->Id);

View File

@@ -775,6 +775,7 @@ class spell_cultist_dark_martyrdom : public SpellScriptLoader
class spell_cultist_dark_martyrdom_SpellScript : public SpellScript
{
PrepareSpellScript(spell_cultist_dark_martyrdom_SpellScript)
bool Validate(SpellEntry const* /*spellEntry*/)
{
if (uint32 scriptId = sObjectMgr.GetScriptId("boss_lady_deathwhisper"))

View File

@@ -406,6 +406,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
class spell_marrowgar_coldflame_SpellScript : public SpellScript
{
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript)
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
@@ -443,6 +444,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
class spell_marrowgar_bone_spike_graveyard_SpellScript : public SpellScript
{
PrepareSpellScript(spell_marrowgar_bone_spike_graveyard_SpellScript)
void HandleApplyAura(SpellEffIndex /*effIndex*/)
{
CreatureAI* marrowgarAI = GetCaster()->ToCreature()->AI();
@@ -492,6 +494,7 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader
class spell_marrowgar_bone_storm_SpellScript : public SpellScript
{
PrepareSpellScript(spell_marrowgar_bone_storm_SpellScript)
void RecalculateDamage(SpellEffIndex /*effIndex*/)
{
int32 dmg = GetHitDamage();

View File

@@ -182,6 +182,7 @@ class spell_stinky_precious_decimate : public SpellScriptLoader
class spell_stinky_precious_decimate_SpellScript : public SpellScript
{
PrepareSpellScript(spell_stinky_precious_decimate_SpellScript)
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (GetHitUnit()->GetHealthPct() > float(GetEffectValue()))