Skip to content

Commit 02b3f85

Browse files
authored
Merge pull request #27 from janisozaur/sign-compare
Fix some GCC warnings
2 parents 472a357 + cfae9ac commit 02b3f85

16 files changed

+63
-60
lines changed

Source/Activities/GATutorial.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ namespace RTE {
186186
// If teh screen has just changed and needs to be redrawn
187187
bool m_ScreenChange;
188188
// Which tutorial step of the current area currently being played back
189-
int m_CurrentStep;
189+
unsigned int m_CurrentStep;
190190
// Which frame of the current step's animation are we on?
191191
int m_CurrentFrame;
192192
// Current room
193193
TutorialRoom m_CurrentRoom;
194194
// Trigger box for the subsequent fight
195195
Box m_FightTriggers[FIGHTSTAGECOUNT];
196-
int m_EnemyCount; //!< The amount of enemy actors at the start of the activity.
196+
unsigned int m_EnemyCount; //!< The amount of enemy actors at the start of the activity.
197197
// The current fight stage
198198
FightStage m_CurrentFightStage;
199199
// The CPU opponent brain; not owned!

Source/Activities/MultiplayerServerLobby.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,18 +799,20 @@ namespace RTE {
799799
}
800800

801801
// Now set the selected tech's module index as what the metaplayer is going to use
802-
if (pTechItem)
802+
if (pTechItem) {
803803
if (pTechItem->m_ExtraIndex == -2)
804804
pGameActivity->SetTeamTech(team, "-All-");
805805
else
806806
pGameActivity->SetTeamTech(team, g_PresetMan.GetDataModuleName(pTechItem->m_ExtraIndex));
807+
}
807808
}
808809

809810
// Set up AI skill levels
810-
if (m_apTeamAISkillSlider[team]->IsEnabled())
811+
if (m_apTeamAISkillSlider[team]->IsEnabled()) {
811812
pGameActivity->SetTeamAISkill(team, m_apTeamAISkillSlider[team]->GetValue());
812-
else
813+
} else {
813814
pGameActivity->SetTeamAISkill(team, AISkillSetting::DefaultSkill);
815+
}
814816
}
815817

816818
// Force close all previously opened files

Source/Entities/LimbPath.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ namespace RTE {
333333
return prog / m_RegularLength;
334334
}
335335

336-
int LimbPath::GetCurrentSegmentNumber() const {
337-
int progress = 0;
336+
unsigned int LimbPath::GetCurrentSegmentNumber() const {
337+
unsigned int progress = 0;
338338
if (!m_Ended && !IsStaticPoint()) {
339339
for (std::deque<Vector>::const_iterator itr = m_Segments.begin(); itr != m_CurrentSegment; ++itr) {
340340
progress++;

Source/Entities/LimbPath.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ namespace RTE {
100100
/// Gets a pointer to the segment at the given index. Ownership is NOT transferred.
101101
/// @param segmentIndex The index of the segment to get.
102102
/// @return A pointer to the segment at the given index. Ownership is NOT transferred.
103-
Vector* GetSegment(int segmentIndex) {
104-
if (segmentIndex >= 0 && segmentIndex < m_Segments.size()) {
103+
Vector* GetSegment(unsigned int segmentIndex) {
104+
if (segmentIndex < m_Segments.size()) {
105105
return &m_Segments.at(segmentIndex);
106106
}
107107
return nullptr;
@@ -220,7 +220,7 @@ namespace RTE {
220220

221221
/// Gets the current segment as a number, rather than an iterator.
222222
/// @return The current segment as a number.
223-
int GetCurrentSegmentNumber() const;
223+
unsigned int GetCurrentSegmentNumber() const;
224224

225225
/// Sets a new array of 'waypoints' or segments of this LimbPath.
226226
/// @param newSpeed An int specifying how many segments there are in the following
@@ -375,7 +375,7 @@ namespace RTE {
375375
// The iterator to the segment of the path that the limb ended up on the end of
376376
std::deque<Vector>::iterator m_CurrentSegment;
377377

378-
int m_FootCollisionsDisabledSegment; //!< The segment after which foot collisions will be disabled for this limbpath, if it's for legs.
378+
unsigned int m_FootCollisionsDisabledSegment; //!< The segment after which foot collisions will be disabled for this limbpath, if it's for legs.
379379

380380
// Normalized measure of how far the limb has progressed toward the
381381
// current segment's target. 0.0 means its farther away than the

Source/Entities/MOSprite.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace RTE {
8989
/// @param whichFrame Which frame to get. (default: 0)
9090
/// @return A pointer to the requested frame of this MOSprite's BITMAP array.
9191
/// Ownership is NOT transferred!
92-
BITMAP* GetSpriteFrame(int whichFrame = 0) const { return (whichFrame >= 0 && whichFrame < m_FrameCount) ? m_aSprite[whichFrame] : 0; }
92+
BITMAP* GetSpriteFrame(unsigned int whichFrame = 0) const { return (whichFrame < m_FrameCount) ? m_aSprite[whichFrame] : 0; }
9393

9494
/// Gets the width of the bitmap of this MOSprite
9595
/// @return Sprite width if loaded.

Source/Entities/MovableObject.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ namespace RTE {
719719
/// Returns force vector in newtons of the specified Force record.
720720
/// @param n Force record index to get data from.
721721
/// @return Force vector in newtons of the specified Force record.
722-
Vector GetForceVector(int n) {
722+
Vector GetForceVector(unsigned int n) {
723723
if (n > 0 && n < m_Forces.size())
724724
return m_Forces[n].first;
725725
else
@@ -733,7 +733,7 @@ namespace RTE {
733733
/// Returns offset vector in METERS (not pixels) of the specified Force record.
734734
/// @param n Force record index to get data from.
735735
/// @return Offset vector in meters of the specified Force record.
736-
Vector GetForceOffset(int n) {
736+
Vector GetForceOffset(unsigned int n) {
737737
if (n > 0 && n < m_Forces.size())
738738
return m_Forces[n].second;
739739
else
@@ -742,14 +742,14 @@ namespace RTE {
742742

743743
/// Sets force vector in newtons of the specified Force record.
744744
/// @param n Force record index to get data from. New Vector force value in newtons.
745-
void SetForceVector(int n, Vector v) {
745+
void SetForceVector(unsigned int n, Vector v) {
746746
if (n > 0 && n < m_Forces.size())
747747
m_Forces[n].first = v;
748748
}
749749

750750
/// Sets offset vector in METERS (not pixels) of the specified Force record.
751751
/// @param n Force record index to get data from. New Vector offset value in meters.
752-
void SetForceOffset(int n, Vector v) {
752+
void SetForceOffset(unsigned int n, Vector v) {
753753
if (n > 0 && n < m_Forces.size())
754754
m_Forces[n].second = v;
755755
}
@@ -765,7 +765,7 @@ namespace RTE {
765765
/// Returns Impulse vector in newtons of the specified Impulse record.
766766
/// @param n Impulse record index to get data from.
767767
/// @return Impulse vector in newtons of the specified Impulse record.
768-
Vector GetImpulseVector(int n) {
768+
Vector GetImpulseVector(unsigned int n) {
769769
if (n > 0 && n < m_ImpulseForces.size())
770770
return m_ImpulseForces[n].first;
771771
else
@@ -775,7 +775,7 @@ namespace RTE {
775775
/// Returns offset vector in METERS (not pixels) of the specified Impulse record.
776776
/// @param n Impulse record index to get data from.
777777
/// @return Offset vector in meters of the specified Impulse record.
778-
Vector GetImpulseOffset(int n) {
778+
Vector GetImpulseOffset(unsigned int n) {
779779
if (n > 0 && n < m_ImpulseForces.size())
780780
return m_ImpulseForces[n].second;
781781
else
@@ -785,14 +785,14 @@ namespace RTE {
785785
/// Returns offset vector in METERS (not pixels) of the specified Impulse record.
786786
/// @param n Impulse record index to get data from.
787787
/// @return Offset vector in meters of the specified Impulse record.
788-
void SetImpulseVector(int n, Vector v) {
788+
void SetImpulseVector(unsigned int n, Vector v) {
789789
if (n > 0 && n < m_ImpulseForces.size())
790790
m_ImpulseForces[n].first = v;
791791
}
792792

793793
/// Sets offset vector in METERS (not pixels) of the specified Impulse record.
794794
/// @param n Impulse record index to get data from. New Vector offset value in meters.
795-
void SetImpulseOffset(int n, Vector v) {
795+
void SetImpulseOffset(unsigned int n, Vector v) {
796796
if (n > 0 && n < m_ImpulseForces.size())
797797
m_ImpulseForces[n].second = v;
798798
}

Source/Lua/LuaBindingsManagers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ namespace RTE {
243243
.def("DrawTextPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& text, bool isSmall, int alignment, float rotAngle)) & PrimitiveMan::DrawTextPrimitive)
244244
.def("DrawTextPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& text, bool isSmall, int alignment)) & PrimitiveMan::DrawTextPrimitive)
245245
.def("DrawTextPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& text, bool isSmall, int alignment, float rotAngle)) & PrimitiveMan::DrawTextPrimitive)
246-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, int frame)) & PrimitiveMan::DrawBitmapPrimitive)
247-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, int frame, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
248-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, int frame)) & PrimitiveMan::DrawBitmapPrimitive)
249-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, int frame, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
246+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame)) & PrimitiveMan::DrawBitmapPrimitive)
247+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
248+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame)) & PrimitiveMan::DrawBitmapPrimitive)
249+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
250250
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle)) & PrimitiveMan::DrawBitmapPrimitive)
251251
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
252252
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle)) & PrimitiveMan::DrawBitmapPrimitive)

Source/Lua/LuaBindingsPrimitives.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace RTE {
9595
LuaBindingRegisterFunctionDefinitionForType(PrimitiveLuaBindings, BitmapPrimitive) {
9696
return luabind::class_<BitmapPrimitive, GraphicalPrimitive>("BitmapPrimitive")
9797

98-
.def(luabind::constructor<int, const Vector&, const MOSprite*, float, int, bool, bool>())
98+
.def(luabind::constructor<int, const Vector&, const MOSprite*, float, unsigned int, bool, bool>())
9999
.def(luabind::constructor<int, const Vector&, const std::string&, float, bool, bool>());
100100
}
101101
} // namespace RTE

Source/Lua/LuabindObjectWrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace RTE {
3131

3232
/// Constructor method used to instantiate a LuabindObjectWrapper object in system memory.
3333
explicit LuabindObjectWrapper(luabind::adl::object* luabindObject, const std::string_view& filePath, bool ownsObject = true) :
34-
m_LuabindObject(luabindObject), m_FilePath(filePath), m_OwnsObject(ownsObject) {}
34+
m_OwnsObject(ownsObject), m_LuabindObject(luabindObject), m_FilePath(filePath) {}
3535
#pragma endregion
3636

3737
#pragma region Destruction

Source/Managers/MetaMan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ namespace RTE {
145145
/// Gets the designated team of a specific player
146146
/// @param metaPlayer Which player.
147147
/// @return The team of that player.
148-
int GetTeamOfPlayer(int metaPlayer) const { return metaPlayer >= Players::PlayerOne && metaPlayer < m_Players.size() ? m_Players[metaPlayer].GetTeam() : Activity::NoTeam; }
148+
int GetTeamOfPlayer(int metaPlayer) const { return metaPlayer >= Players::PlayerOne && metaPlayer < static_cast<int>(m_Players.size()) ? m_Players[metaPlayer].GetTeam() : Activity::NoTeam; }
149149

150150
/// Gets the specified MetaPlayer
151151
/// @param metaPlayer Which player.
152152
/// @return The requested MetaPlayer
153-
MetaPlayer* GetPlayer(int metaPlayer) { return (metaPlayer >= Players::PlayerOne && metaPlayer < m_Players.size()) ? &(m_Players[metaPlayer]) : 0; }
153+
MetaPlayer* GetPlayer(int metaPlayer) { return (metaPlayer >= Players::PlayerOne && metaPlayer < static_cast<int>(m_Players.size())) ? &(m_Players[metaPlayer]) : nullptr; }
154154

155155
/// Gets the MetaPlayer playing a specific in-game player, if any.
156156
/// @param inGamePlayer Which in-game player to translate into a metaplayer.
@@ -247,7 +247,7 @@ namespace RTE {
247247

248248
/// Checks wheter a certain player index is valid for the current game
249249
/// @return Whether the player index passed in is active for the current game.
250-
bool IsActivePlayer(int metaPlayer) { return metaPlayer >= Players::PlayerOne && metaPlayer < m_Players.size(); }
250+
bool IsActivePlayer(int metaPlayer) { return metaPlayer >= Players::PlayerOne && metaPlayer < static_cast<int>(m_Players.size()); }
251251

252252
/// Checks wheter a certain team index is valid for the current game
253253
/// @return Whether the team index passed in is active for the current game.
@@ -332,7 +332,7 @@ namespace RTE {
332332
// The Activities generated by the current round's offensive maneuvers
333333
std::vector<GAScripted*> m_RoundOffensives;
334334
// The current offensive action that we're about to play next
335-
int m_CurrentOffensive;
335+
unsigned int m_CurrentOffensive;
336336
// Game difficulty
337337
int m_Difficulty;
338338
// Teams AI Skill

0 commit comments

Comments
 (0)