aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-31 09:22:28 -0500
committermegamage <none@none>2009-08-31 09:22:28 -0500
commit66793a1ce073e4815c9e8294a11dc311b5044071 (patch)
tree99c8f7fc261b39cbb1a2193e0c024c9b24896405 /src
parentd7c8380d47bbf20d4acdd4b8d24d5b7dc8b78f12 (diff)
*Fix a crash in npc_sinkhole_kill_creditAI. Thanks to Visagalis
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/northrend/borean_tundra.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bindings/scripts/scripts/northrend/borean_tundra.cpp b/src/bindings/scripts/scripts/northrend/borean_tundra.cpp
index 4e9f866f50c..9f0bd982233 100644
--- a/src/bindings/scripts/scripts/northrend/borean_tundra.cpp
+++ b/src/bindings/scripts/scripts/northrend/borean_tundra.cpp
@@ -196,13 +196,13 @@ struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
uint32 Phase_Timer;
uint8 Phase;
- Unit* Caster;
+ uint64 casterGuid;
void Reset()
{
Phase_Timer = 500;
Phase = 0;
- Caster = NULL;
+ casterGuid = 0;
}
void SpellHit(Unit *caster, const SpellEntry *spell)
@@ -210,10 +210,11 @@ struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
if (Phase)
return;
- if (spell->Id == SPELL_SET_CART && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
+ if (spell->Id == SPELL_SET_CART && caster->GetTypeId() == TYPEID_PLAYER
+ && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
{
Phase = 1;
- Caster = caster;
+ casterGuid = caster->GetGUID();
}
}
@@ -269,7 +270,8 @@ struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
break;
case 7:
DoCast(m_creature, SPELL_EXPLODE_CART, true);
- CAST_PLR(Caster)->KilledMonster(m_creature->GetCreatureInfo(),m_creature->GetGUID());
+ if(Player *caster = Unit::GetPlayer(casterGuid))
+ CAST_PLR(caster)->KilledMonster(m_creature->GetCreatureInfo(),m_creature->GetGUID());
Phase_Timer = 5000;
Phase = 8;
break;