]> git.localhorst.tv Git - l2e.git/blobdiff - src/math/Fixed.h
fixed divide by zero bug in MapState
[l2e.git] / src / math / Fixed.h
index a3982755dea86c8d147229fe0e19c33fb1caf2e4..7fe099cee57ea789f0cc631f9397c89da6165e94 100644 (file)
@@ -96,7 +96,8 @@ public:
                }
                return *this;
        }
-       Fixed &operator +=(int i) {
+       template<class Scalar>
+       Fixed &operator +=(Scalar i) {
                Sint32 temp = SignedInt() + (i << IntShift());
                if (temp < 0) {
                        rep = (temp * -1) | SignMask();
@@ -114,7 +115,8 @@ public:
                }
                return *this;
        }
-       Fixed &operator -=(int i) {
+       template<class Scalar>
+       Fixed &operator -=(Scalar i) {
                Sint32 temp = SignedInt() - (i << IntShift());
                if (temp < 0) {
                        rep = (temp * -1) | SignMask();
@@ -134,7 +136,8 @@ public:
                }
                return *this;
        }
-       Fixed &operator *=(int i) {
+       template<class Scalar>
+       Fixed &operator *=(Scalar i) {
                Sint32 temp = SignedInt() * i;
                if (temp < 0) {
                        rep = (temp * -1) | SignMask();
@@ -154,7 +157,8 @@ public:
                }
                return *this;
        }
-       Fixed &operator /=(int i) {
+       template<class Scalar>
+       Fixed &operator /=(Scalar i) {
                Sint32 temp = SignedInt() / i;
                if (temp < 0) {
                        rep = (temp * -1) | SignMask();