aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/MapScripts.cpp
diff options
context:
space:
mode:
authorSpp- <u84280@epreinf21.(none)>2011-07-08 11:12:19 +0200
committerSpp- <u84280@epreinf21.(none)>2011-07-08 11:12:19 +0200
commitceefc8c3d706a10ea43312b6836102d30e9cad03 (patch)
tree15dd9e262d3ca55b198230d50284b304dd554c69 /src/server/game/Scripting/MapScripts.cpp
parent3f9db9d29e4758524e28bf0670ccacca9bc2b681 (diff)
Core/Misc: Replace dynamic_cast<XXX*> with proper ToXXX
Diffstat (limited to 'src/server/game/Scripting/MapScripts.cpp')
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 6ee95125fce..088e5eb1e75 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -163,7 +163,7 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
else
{
- pUnit = dynamic_cast<Unit*>(obj);
+ pUnit = obj->ToUnit();
if (!pUnit)
sLog->outError("%s %s object could not be casted to unit.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
@@ -257,7 +257,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
if (target && target->isType(TYPEMASK_GAMEOBJECT))
{
- GameObject* goTarget = dynamic_cast<GameObject*>(target);
+ GameObject* goTarget = target->ToGameObject();
if (goTarget && goTarget->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
goTarget->UseDoorOrButton(nTimeToToggle);
}
@@ -678,7 +678,7 @@ void Map::ScriptsProcess()
break;
}
- if (GameObject *pGO = dynamic_cast<GameObject*>(target))
+ if (GameObject *pGO = target->ToGameObject())
pGO->Use(pSource);
}
break;
@@ -707,24 +707,24 @@ void Map::ScriptsProcess()
switch (step.script->CastSpell.Flags)
{
case SF_CASTSPELL_SOURCE_TO_TARGET: // source -> target
- uSource = dynamic_cast<Unit*>(source);
- uTarget = dynamic_cast<Unit*>(target);
+ uSource = source ? source->ToUnit() : NULL;
+ uTarget = target ? target->ToUnit() : NULL;
break;
case SF_CASTSPELL_SOURCE_TO_SOURCE: // source -> source
- uSource = dynamic_cast<Unit*>(source);
+ uSource = source ? source->ToUnit() : NULL;
uTarget = uSource;
break;
case SF_CASTSPELL_TARGET_TO_TARGET: // target -> target
- uSource = dynamic_cast<Unit*>(target);
+ uSource = target ? target->ToUnit() : NULL;
uTarget = uSource;
break;
case SF_CASTSPELL_TARGET_TO_SOURCE: // target -> source
- uSource = dynamic_cast<Unit*>(target);
- uTarget = dynamic_cast<Unit*>(source);
+ uSource = target ? target->ToUnit() : NULL;
+ uTarget = source ? source->ToUnit() : NULL;
break;
case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry
- uSource = dynamic_cast<Unit*>(source);
- uTarget = GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius);
+ uSource = source ? source->ToUnit() : NULL;
+ uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : NULL;
break;
}