diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp index d6e058f0e..ccdd78e39 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -22,37 +22,37 @@ public: ~CAnimatedVariable(); // gets the current vector value (real time) - Vector2D vec() { + const Vector2D& vec() const { ASSERT(m_eVarType == AVARTYPE_VECTOR); return m_vValue; } // gets the current float value (real time) - float fl() { + const float& fl() const { ASSERT(m_eVarType == AVARTYPE_FLOAT); return m_fValue; } // gets the current color value (real time) - CColor col() { + const CColor& col() const { ASSERT(m_eVarType == AVARTYPE_COLOR); return m_cValue; } // gets the goal vector value - Vector2D goalv() { + const Vector2D& goalv() const { ASSERT(m_eVarType == AVARTYPE_VECTOR); return m_vGoal; } // gets the goal float value - float goalf() { + const float& goalf() const { ASSERT(m_eVarType == AVARTYPE_FLOAT); return m_fGoal; } // gets the goal color value - CColor goalc() { + const CColor& goalc() const { ASSERT(m_eVarType == AVARTYPE_COLOR); return m_cGoal; } diff --git a/src/helpers/Vector2D.hpp b/src/helpers/Vector2D.hpp index 5fe4ccd31..7288a0880 100644 --- a/src/helpers/Vector2D.hpp +++ b/src/helpers/Vector2D.hpp @@ -14,24 +14,24 @@ class Vector2D { // returns the scale double normalize(); - Vector2D operator+(const Vector2D a) { + Vector2D operator+(const Vector2D a) const { return Vector2D(this->x + a.x, this->y + a.y); } - Vector2D operator-(const Vector2D a) { + Vector2D operator-(const Vector2D a) const { return Vector2D(this->x - a.x, this->y - a.y); } - Vector2D operator*(const float a) { + Vector2D operator*(const float a) const { return Vector2D(this->x * a, this->y * a); } - Vector2D operator/(const float a) { + Vector2D operator/(const float a) const { return Vector2D(this->x / a, this->y / a); } - bool operator==(const Vector2D& a) { + bool operator==(const Vector2D& a) const { return a.x == x && a.y == y; } - bool operator!=(const Vector2D& a) { + bool operator!=(const Vector2D& a) const { return a.x != x || a.y != y; }