Skip to content

Commit a12d021

Browse files
authored
Merge pull request #129 from cortex-command-community/constness-fixes
Fix Vector getter constness
2 parents 0aa2215 + 8ff4151 commit a12d021

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.gitignore

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
*.vs
88
*.APS
99
*.user
10-
10+
# IDE files
1111
/.idea
1212

1313
compile_commands.json
14-
/.ccls-cache
14+
**/.ccls-cache
1515

16-
/build*
16+
**/build*
1717

1818
/enc_temp_folder
1919

20+
.vs/
2021
/.idea
2122
/_Bin
2223
/NATPunchServer/Server/NATCompleteServer/Debug
@@ -72,6 +73,7 @@ luac.out
7273
*.bat
7374
CortexCommand
7475
CortexCommand_debug
76+
CortexCommand.AppImage
7577

7678
# Debug databases
7779
*.pdb
@@ -84,10 +86,10 @@ CortexCommand_debug
8486
# MacOS stuff
8587
.DS_Store
8688

87-
.vs/
88-
Screenshots/
89+
# CortexCommand user files
90+
Screen[sS]hots/
8991
Mods/
90-
Userdata/
92+
User[dD]ata/
9193

9294
allegro.log
9395
AbortScreen.*

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)