aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2015-06-14 18:34:11 +0200
committerDDuarte <dnpd.dd@gmail.com>2015-06-26 03:27:54 +0100
commite4e903ba951871927a36526d88da10de04eddb14 (patch)
treeb9e4037df37ad90a502a183432cc72c5be987704 /src
parent7ee455df59e2912725c49f36da76349377aa768a (diff)
Merge pull request #14728 from kelno/fixes
Core/SAI: Fixed a math error overflow in SmartScript::DecPhase(int32) (cherry picked from commit 6d7339e7a3daf302d6bed1c8c0a4584a69a9316b)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index c5cc5aedb43..e1a61438194 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -246,7 +246,14 @@ class SmartScript
DecPhase(abs(p));
}
- void DecPhase(int32 p = 1) { mEventPhase -= (mEventPhase < (uint32)p ? (uint32)p - mEventPhase : (uint32)p); }
+ void DecPhase(int32 p = 1)
+ {
+ if(mEventPhase > (uint32)p)
+ mEventPhase -= (uint32)p;
+ else
+ mEventPhase = 0;
+ }
+
bool IsInPhase(uint32 p) const { return ((1 << (mEventPhase - 1)) & p) != 0; }
void SetPhase(uint32 p = 0) { mEventPhase = p; }