@@ -58,13 +58,15 @@ namespace RTE {
58
58
// / Sets the X value of this Vector.
59
59
// / </summary>
60
60
// / <param name="newX">A float value that the X value will be set to.</param>
61
- void SetX (const float newX) { m_X = newX; }
61
+ // / <returns>Vector reference to this after the operation.</returns>
62
+ Vector & SetX (const float newX) { m_X = newX; return *this ; }
62
63
63
64
// / <summary>
64
65
// / Sets the X value of this Vector.
65
66
// / </summary>
66
67
// / <param name="newX">An int value that the X value will be set to.</param>
67
- void SetIntX (const int newX) { m_X = static_cast <float >(newX); }
68
+ // / <returns>Vector reference to this after the operation.</returns>
69
+ Vector & SetIntX (const int newX) { m_X = static_cast <float >(newX); return *this ; }
68
70
69
71
// / <summary>
70
72
// / Gets the Y value of this Vector.
@@ -76,27 +78,31 @@ namespace RTE {
76
78
// / Sets the Y value of this Vector.
77
79
// / </summary>
78
80
// / <param name="newY">A float value that the Y value will be set to.</param>
79
- void SetY (const float newY) { m_Y = newY; }
81
+ // / <returns>Vector reference to this after the operation.</returns>
82
+ Vector & SetY (const float newY) { m_Y = newY; return *this ; }
80
83
81
84
// / <summary>
82
85
// / Sets the Y value of this Vector.
83
86
// / </summary>
84
87
// / <param name="newY">An int value that the Y value will be set to.</param>
85
- void SetIntY (const int newY) { m_Y = static_cast <float >(newY); }
88
+ // / <returns>Vector reference to this after the operation.</returns>
89
+ Vector & SetIntY (const int newY) { m_Y = static_cast <float >(newY); return *this ; }
86
90
87
91
// / <summary>
88
92
// / Sets both the X and Y values of this Vector.
89
93
// / </summary>
90
94
// / <param name="newX">A float value that the X value will be set to.</param>
91
95
// / <param name="newY">A float value that the Y value will be set to.</param>
92
- void SetXY (const float newX, const float newY) { m_X = newX; m_Y = newY; }
96
+ // / <returns>Vector reference to this after the operation.</returns>
97
+ Vector & SetXY (const float newX, const float newY) { m_X = newX; m_Y = newY; return *this ; }
93
98
94
99
// / <summary>
95
100
// / Sets both the X and Y values of this Vector.
96
101
// / </summary>
97
102
// / <param name="newX">An int value that the X value will be set to.</param>
98
103
// / <param name="newY">An int value that the Y value will be set to.</param>
99
- void SetIntXY (const int newX, const int newY) { m_X = static_cast <float >(newX); m_Y = static_cast <float >(newY); }
104
+ // / <returns>Vector reference to this after the operation.</returns>
105
+ Vector & SetIntXY (const int newX, const int newY) { m_X = static_cast <float >(newX); m_Y = static_cast <float >(newY); return *this ; }
100
106
101
107
// / <summary>
102
108
// / Gets the absolute largest of the two elements. Will always be positive.
@@ -121,7 +127,8 @@ namespace RTE {
121
127
// / Flips the X element of this Vector.
122
128
// / </summary>
123
129
// / <param name="flipX">Whether or not to flip the X element or not.</param>
124
- void FlipX (const bool flipX = true ) { *this = GetXFlipped (flipX); }
130
+ // / <returns>Vector reference to this after the operation.</returns>
131
+ Vector & FlipX (const bool flipX = true ) { *this = GetXFlipped (flipX); return *this ; }
125
132
126
133
// / <summary>
127
134
// / Gets a Vector identical to this except that its Y component is flipped.
@@ -134,7 +141,8 @@ namespace RTE {
134
141
// / Flips the Y element of this Vector.
135
142
// / </summary>
136
143
// / <param name="flipY">Whether or not to flip the Y element or not.</param>
137
- void FlipY (const bool flipY = true ) { *this = GetYFlipped (flipY); }
144
+ // / <returns>Vector reference to this after the operation.</returns>
145
+ Vector & FlipY (const bool flipY = true ) { *this = GetYFlipped (flipY); return *this ; }
138
146
139
147
// / <summary>
140
148
// / Indicates whether the X component of this Vector is 0.
@@ -173,14 +181,14 @@ namespace RTE {
173
181
// / Sets the magnitude of this Vector. A negative magnitude will invert the Vector's direction.
174
182
// / </summary>
175
183
// / <param name="newMag">A float value that the magnitude will be set to.</param>
176
- // / <returns>A reference to this after the change .</returns>
184
+ // / <returns>Vector reference to this after the operation .</returns>
177
185
Vector & SetMagnitude (const float newMag);
178
186
179
187
// / <summary>
180
188
// / Caps the magnitude of this Vector to a max value and keeps its angle intact.
181
189
// / </summary>
182
190
// / <param name="capMag">A float value that the magnitude will be capped by.</param>
183
- // / <returns>A reference to this after the change .</returns>
191
+ // / <returns>Vector reference to this after the operation .</returns>
184
192
Vector & CapMagnitude (const float capMag);
185
193
186
194
// / <summary>
@@ -213,21 +221,21 @@ namespace RTE {
213
221
// / Rotate this Vector relatively by an angle in radians.
214
222
// / </summary>
215
223
// / <param name="angle">The angle in radians to rotate by. Positive angles rotate counter-clockwise, and negative angles clockwise.</param>
216
- // / <returns>This vector, rotated .</returns>
224
+ // / <returns>Vector reference to this after the operation .</returns>
217
225
Vector & RadRotate (const float angle);
218
226
219
227
// / <summary>
220
228
// / Rotate this Vector relatively by an angle in degrees.
221
229
// / </summary>
222
230
// / <param name="angle">The angle in degrees to rotate by. Positive angles rotate counter-clockwise, and negative angles clockwise.</param>
223
- // / <returns>This vector, rotated .</returns>
231
+ // / <returns>Vector reference to this after the operation .</returns>
224
232
Vector & DegRotate (const float angle) { return RadRotate (angle * c_PI / 180 .0F ); }
225
233
226
234
// / <summary>
227
235
// / Set this Vector to an absolute rotation based on the absolute rotation of another Vector.
228
236
// / </summary>
229
237
// / <param name="refVector">The reference Vector whose absolute angle from positive X (0 degrees) this Vector will be rotated to.</param>
230
- // / <returns>This vector, rotated .</returns>
238
+ // / <returns>Vector reference to this after the operation .</returns>
231
239
Vector & AbsRotateTo (const Vector &refVector) { return RadRotate (refVector.GetAbsRadAngle () - GetAbsRadAngle ()); }
232
240
233
241
// / <summary>
@@ -247,22 +255,26 @@ namespace RTE {
247
255
// / <summary>
248
256
// / Rounds the X and Y values of this Vector upwards. E.g. 0.49 -> 0.0 and 0.5 -> 1.0.
249
257
// / </summary>
250
- void Round () { *this = GetRounded (); }
258
+ // / <returns>Vector reference to this after the operation.</returns>
259
+ Vector & Round () { *this = GetRounded (); return *this ; }
251
260
252
261
// / <summary>
253
262
// / Sets the X and Y of this Vector to the nearest half value. E.g. 1.0 -> 1.5 and 0.9 -> 0.5.
254
263
// / </summary>
255
- void ToHalf () { m_X = std::round (m_X * 2 ) / 2 ; m_Y = std::round (m_Y * 2 ) / 2 ; }
264
+ // / <returns>Vector reference to this after the operation.</returns>
265
+ Vector & ToHalf () { m_X = std::round (m_X * 2 ) / 2 ; m_Y = std::round (m_Y * 2 ) / 2 ; return *this ; }
256
266
257
267
// / <summary>
258
268
// / Sets the X and Y of this Vector to the greatest integers that are not greater than their original values. E.g. -1.02 becomes -2.0.
259
269
// / </summary>
260
- void Floor () { *this = GetFloored (); }
270
+ // / <returns>Vector reference to this after the operation.</returns>
271
+ Vector & Floor () { *this = GetFloored (); return *this ; }
261
272
262
273
// / <summary>
263
274
// / Sets the X and Y of this Vector to the lowest integers that are not less than their original values. E.g. -1.02 becomes -1.0.
264
275
// / </summary>
265
- void Ceiling () { *this = GetCeilinged (); }
276
+ // / <returns>Vector reference to this after the operation.</returns>
277
+ Vector & Ceiling () { *this = GetCeilinged (); return *this ; }
266
278
267
279
// / <summary>
268
280
// / Returns a rounded copy of this Vector. Does not alter this Vector.
0 commit comments