diff options
author | jackpoz <giacomopoz@gmail.com> | 2015-06-14 18:34:11 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2015-06-14 18:34:11 +0200 |
commit | 6d7339e7a3daf302d6bed1c8c0a4584a69a9316b (patch) | |
tree | 8050e4dceb05e76a2a3da7847c5120a7cc7d6db0 /src | |
parent | 5b666ee3939f70c4183021da5e481ce89312671c (diff) | |
parent | c142282e34673f0d33979c2e0a4ba4184e36898c (diff) |
Merge pull request #14728 from kelno/fixes
Core/SAI: Fixed a math error overflow in SmartScript::DecPhase(int32)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.h | 9 |
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 a3d75f1889b..51628eded54 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -247,7 +247,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; } |