Index: source/maths/FixedVector2D.h =================================================================== --- source/maths/FixedVector2D.h +++ source/maths/FixedVector2D.h @@ -204,6 +204,7 @@ /** * Compute the dot product of this vector with another. + * Likely to overflow if both vectors are large-ish (around the 200 range). */ fixed Dot(const CFixedVector2D& v) const { Index: source/simulation2/components/CCmpUnitMotion.cpp =================================================================== --- source/simulation2/components/CCmpUnitMotion.cpp +++ source/simulation2/components/CCmpUnitMotion.cpp @@ -1149,7 +1149,8 @@ // Check if we anticipate the target to go through us, in which case we shouldn't anticipate // (or e.g. units fleeing might suddenly turn around towards their attacker). - if ((out - cmpPosition->GetPosition2D()).Dot(tempPos - cmpPosition->GetPosition2D()) >= fixed::Zero()) + // To avoid overflows, divide both vectors by 1000 since only the sign matters. + if (((out - cmpPosition->GetPosition2D()) / 1000).Dot((tempPos - cmpPosition->GetPosition2D())/1000) >= fixed::Zero()) out = tempPos; } }