Skip to content

Commit ca4757d

Browse files
committed
Fix constness of vector getters and operators
1 parent 3c6343b commit ca4757d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Source/System/Vector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ namespace RTE {
223223
/// Returns a copy of this Vector, rotated relatively by an angle in radians.
224224
/// @param angle The angle in radians to rotate by. Positive angles rotate counter-clockwise, and negative angles clockwise.
225225
/// @return A rotated copy of this Vector.
226-
inline Vector GetRadRotatedCopy(const float angle) {
226+
inline Vector GetRadRotatedCopy(const float angle) const {
227227
Vector returnVector = *this;
228228
const float adjustedAngle = -angle;
229229
returnVector.m_X = m_X * std::cos(adjustedAngle) - m_Y * std::sin(adjustedAngle);
@@ -242,7 +242,7 @@ namespace RTE {
242242
/// Returns a copy of this Vector, rotated relatively by an angle in degrees.
243243
/// @param angle The angle in degrees to rotate by. Positive angles rotate counter-clockwise, and negative angles clockwise.
244244
/// @return A rotated copy of this Vector.
245-
inline Vector GetDegRotatedCopy(const float angle) { return GetRadRotatedCopy(angle * c_PI / 180.0F); };
245+
inline Vector GetDegRotatedCopy(const float angle) const { return GetRadRotatedCopy(angle * c_PI / 180.0F); };
246246

247247
/// Rotate this Vector relatively by an angle in degrees.
248248
/// @param angle The angle in degrees to rotate by. Positive angles rotate counter-clockwise, and negative angles clockwise.
@@ -360,7 +360,7 @@ namespace RTE {
360360

361361
/// Unary negation overload for single Vectors.
362362
/// @return The resulting Vector.
363-
inline Vector operator-() { return Vector(-m_X, -m_Y); }
363+
inline Vector operator-() const { return Vector(-m_X, -m_Y); }
364364

365365
/// An equality operator for testing if any two Vectors are equal.
366366
/// @param lhs A Vector reference as the left hand side operand.

0 commit comments

Comments
 (0)