diff options
author | jackpoz <giacomopoz@gmail.com> | 2018-03-11 21:01:53 +0100 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2018-03-11 21:01:53 +0100 |
commit | f555a67bf850e1a9659c89551d7bb69cc812f161 (patch) | |
tree | 01b60de2103d990c61ed05be907285e5205b6942 /src | |
parent | 5ad38c31b0ed633555f281318684e57ea5d6dd73 (diff) |
Core/SmartScripts: Code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 573e34f29f7..b6f066c709a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3001,14 +3001,12 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui //if friendly event&&who is not hostile OR hostile event&&who is hostile if ((e.event.los.noHostile && !me->IsHostileTo(unit)) || (!e.event.los.noHostile && me->IsHostileTo(unit))) - if (!me || !unit) - return; - if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER) - return; - if (e.event.los.playerOnly == TYPEID_PLAYER) - return; - RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); - ProcessAction(e, unit); + { + if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER) + return; + RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); + ProcessAction(e, unit); + } } break; } @@ -3025,14 +3023,12 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui //if friendly event&&who is not hostile OR hostile event&&who is hostile if ((e.event.los.noHostile && !me->IsHostileTo(unit)) || (!e.event.los.noHostile && me->IsHostileTo(unit))) - if (!me || !unit) - return; - if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER) - return; - if (e.event.los.playerOnly == TYPEID_PLAYER) - return; - RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); - ProcessAction(e, unit); + { + if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER) + return; + RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); + ProcessAction(e, unit); + } } break; } |