Skip to content

Commit 3ed54d1

Browse files
committed
Assortment of compiler warning cleanups
1 parent e7f64c3 commit 3ed54d1

File tree

18 files changed

+110
-105
lines changed

18 files changed

+110
-105
lines changed

Source/Entities/AHuman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ void AHuman::PreControllerUpdate() {
18651865
}
18661866
} else {
18671867
m_CanActivateBGItem = true;
1868-
if (thrownDevice = dynamic_cast<ThrownDevice*>(device)) {
1868+
if ((thrownDevice = dynamic_cast<ThrownDevice*>(device))) {
18691869
thrownDevice->SetSharpAim(isSharpAiming ? 1.0F : 0);
18701870
if (m_Controller.IsState(WEAPON_FIRE)) {
18711871
if (m_ArmsState != THROWING_PREP) {
@@ -2718,7 +2718,7 @@ void AHuman::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichSc
27182718
return;
27192719
}
27202720

2721-
Actor::DrawHUD(pTargetBitmap, targetPos, whichScreen);
2721+
Actor::DrawHUD(pTargetBitmap, targetPos, whichScreen, playerControlled);
27222722

27232723
if (!m_HUDVisible) {
27242724
return;

Source/Entities/Activity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ float Activity::GetPlayerFundsShare(int player) const {
583583
}
584584

585585
void Activity::SetPlayerBrain(Actor* newBrain, int player) {
586-
if ((player >= Players::PlayerOne || player < Players::MaxPlayerCount) && newBrain) {
586+
if ((player >= Players::PlayerOne && player < Players::MaxPlayerCount) && newBrain) {
587587
if (newBrain->GetTeam() != m_Team[player]) {
588588
newBrain->SetTeam(m_Team[player]);
589589
}

Source/Entities/LimbPath.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ bool LimbPath::RestartFree(Vector& limbPos, MOID MOIDToIgnore, int ignoreTeam) {
397397
m_CurrentSegment = m_Segments.begin();
398398

399399
// Find the first start segment that has an obstacle on it
400-
int i = 0;
400+
size_t i = 0;
401401
for (; i < m_StartSegCount; ++i) {
402402
Vector segmentStart = GetProgressPos();
403403
++m_CurrentSegment;

Source/Entities/LimbPath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ namespace RTE {
375375
// The number of starting segments, counting into the path from its beginning,
376376
// that upon restart of this path will be tried in reverse order till one which
377377
// yields a starting position that is clear of terrain is found.
378-
int m_StartSegCount;
378+
size_t m_StartSegCount;
379379

380380
// Array containing the actual 'waypoints' or segments for the path.
381381
std::deque<Vector> m_Segments;

Source/Entities/MovableObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ bool MovableObject::DrawToTerrain(SLTerrain* terrain) {
11001100
}
11011101
};
11021102
BITMAP* tempBitmap = g_SceneMan.GetIntermediateBitmapForSettlingIntoTerrain(static_cast<int>(GetDiameter()));
1103-
Vector tempBitmapPos = m_Pos.GetFloored() - Vector(static_cast<float>(tempBitmap->w / 2), static_cast<float>(tempBitmap->w / 2));
1103+
Vector tempBitmapPos = m_Pos.GetFloored() - Vector(static_cast<float>(tempBitmap->w) / 2, static_cast<float>(tempBitmap->w) / 2);
11041104

11051105
clear_bitmap(tempBitmap);
11061106
// Draw the object to the temp bitmap, then draw the foreground layer on top of it, then draw it to the foreground layer.

Source/Entities/MovableObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ namespace RTE {
13021302
// Unique ID of particle hit this MO
13031303
long int m_ParticleUniqueIDHit;
13041304
// Number of sim update frame when last collision was detected
1305-
int m_LastCollisionSimFrameNumber;
1305+
unsigned int m_LastCollisionSimFrameNumber;
13061306
int m_SimUpdatesBetweenScriptedUpdates; //!< The number of Sim updates between each scripted update for this MovableObject.
13071307
int m_SimUpdatesSinceLastScriptedUpdate; //!< The counter for the current number of Sim updates since this MovableObject last ran a scripted update.
13081308

Source/Managers/SceneMan.cpp

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "PresetMan.h"
44
#include "FrameMan.h"
55
#include "ActivityMan.h"
6-
#include "UInputMan.h"
76
#include "CameraMan.h"
87
#include "ConsoleMan.h"
98
#include "PrimitiveMan.h"
@@ -14,14 +13,10 @@
1413
#include "TerrainObject.h"
1514
#include "MovableObject.h"
1615
#include "ContentFile.h"
17-
#include "AHuman.h"
18-
#include "ACRocket.h"
1916
#include "MOPixel.h"
2017
#include "Atom.h"
2118
#include "Material.h"
2219
#include "SoundContainer.h"
23-
// Temp
24-
#include "Controller.h"
2520

2621
#include "tracy/Tracy.hpp"
2722

@@ -133,7 +128,6 @@ int SceneMan::LoadScene(Scene* pNewScene, bool placeObjects, bool placeUnits) {
133128
g_ConsoleMan.PrintString("SYSTEM: Scene \"" + m_pCurrentScene->GetPresetName() + "\" was loaded");
134129

135130
// Set the proper scales of the unseen obscuring SceneLayers
136-
SceneLayer* pUnseenLayer = 0;
137131
for (int team = Activity::TeamOne; team < Activity::MaxTeamCount; ++team) {
138132
if (!g_ActivityMan.GetActivity()->TeamActive(team))
139133
continue;
@@ -1046,7 +1040,7 @@ void SceneMan::RestoreUnseenBox(const int posX, const int posY, const int width,
10461040
}
10471041

10481042
bool SceneMan::CastTerrainPenetrationRay(const Vector& start, const Vector& ray, Vector& endPos, int strengthLimit, int skip) {
1049-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1043+
int error, dom, sub, domSteps, skipped = skip;
10501044
int intPos[2], delta[2], delta2[2], increment[2];
10511045
bool stopped = false;
10521046
unsigned char materialID;
@@ -1138,7 +1132,7 @@ bool SceneMan::CastUnseenRay(int team, const Vector& start, const Vector& ray, V
11381132
if (!m_pCurrentScene->GetUnseenLayer(team))
11391133
return false;
11401134

1141-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1135+
int error, dom, sub, domSteps, skipped = skip;
11421136
int size = 40 - GetUnseenResolution(team).GetLargest();
11431137
int intPos[2], delta[2], delta2[2], increment[2];
11441138
bool affectedAny = false;
@@ -1202,14 +1196,18 @@ bool SceneMan::CastUnseenRay(int team, const Vector& start, const Vector& ray, V
12021196
// Scene wrapping
12031197
WrapPosition(intPos[X], intPos[Y]);
12041198

1199+
bool is_unseen = IsUnseen(intPos[X], intPos[Y], team) || IsUnseen(intPos[X] - size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y], team) || IsUnseen(intPos[X] + size, intPos[Y], team) || IsUnseen(intPos[X], intPos[Y] - size, team) || IsUnseen(intPos[X], intPos[Y] + size, team);
1200+
12051201
// Reveal if we can, save the result
12061202
if (reveal) {
1207-
if (affectedAny = IsUnseen(intPos[X], intPos[Y], team) || IsUnseen(intPos[X] - size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y], team) || IsUnseen(intPos[X] + size, intPos[Y], team) || IsUnseen(intPos[X], intPos[Y] - size, team) || IsUnseen(intPos[X], intPos[Y] + size, team)) {
1203+
if (is_unseen) {
12081204
RevealUnseenBox(intPos[X] - size / 2, intPos[Y] - size / 2, size, size, team);
1205+
affectedAny = true;
12091206
}
12101207
} else {
1211-
if (affectedAny = !(IsUnseen(intPos[X], intPos[Y], team) || IsUnseen(intPos[X] - size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y], team) || IsUnseen(intPos[X] + size, intPos[Y], team) || IsUnseen(intPos[X], intPos[Y] - size, team) || IsUnseen(intPos[X], intPos[Y] + size, team))) {
1208+
if (!is_unseen) {
12121209
RestoreUnseenBox(intPos[X] - size / 2, intPos[Y] - size / 2, size, size, team);
1210+
affectedAny = true;
12131211
}
12141212
}
12151213

@@ -1246,7 +1244,7 @@ bool SceneMan::CastUnseeRay(int team, const Vector& start, const Vector& ray, Ve
12461244

12471245
bool SceneMan::CastMaterialRay(const Vector& start, const Vector& ray, unsigned char material, Vector& result, int skip, bool wrap) {
12481246

1249-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1247+
int error, dom, sub, domSteps, skipped = skip;
12501248
int intPos[2], delta[2], delta2[2], increment[2];
12511249
bool foundPixel = false;
12521250

@@ -1339,7 +1337,7 @@ float SceneMan::CastMaterialRay(const Vector& start, const Vector& ray, unsigned
13391337
}
13401338

13411339
bool SceneMan::CastNotMaterialRay(const Vector& start, const Vector& ray, unsigned char material, Vector& result, int skip, bool checkMOs) {
1342-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1340+
int error, dom, sub, domSteps, skipped = skip;
13431341
int intPos[2], delta[2], delta2[2], increment[2];
13441342
bool foundPixel = false;
13451343

@@ -1437,7 +1435,6 @@ float SceneMan::CastStrengthSumRay(const Vector& start, const Vector& end, int s
14371435

14381436
int error, dom, sub, domSteps, skipped = skip;
14391437
int intPos[2], delta[2], delta2[2], increment[2];
1440-
bool foundPixel = false;
14411438
unsigned char materialID;
14421439
Material foundMaterial;
14431440

@@ -1522,7 +1519,6 @@ const Material* SceneMan::CastMaxStrengthRayMaterial(const Vector& start, const
15221519

15231520
int error, dom, sub, domSteps, skipped = skip;
15241521
int intPos[2], delta[2], delta2[2], increment[2];
1525-
bool foundPixel = false;
15261522

15271523
intPos[X] = std::floor(start.m_X);
15281524
intPos[Y] = std::floor(start.m_Y);
@@ -1600,7 +1596,7 @@ const Material* SceneMan::CastMaxStrengthRayMaterial(const Vector& start, const
16001596
}
16011597

16021598
bool SceneMan::CastStrengthRay(const Vector& start, const Vector& ray, float strength, Vector& result, int skip, unsigned char ignoreMaterial, bool wrap) {
1603-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1599+
int error, dom, sub, domSteps, skipped = skip;
16041600
int intPos[2], delta[2], delta2[2], increment[2];
16051601
bool foundPixel = false;
16061602
unsigned char materialID;
@@ -1693,7 +1689,7 @@ bool SceneMan::CastStrengthRay(const Vector& start, const Vector& ray, float str
16931689
}
16941690

16951691
bool SceneMan::CastWeaknessRay(const Vector& start, const Vector& ray, float strength, Vector& result, int skip, bool wrap) {
1696-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1692+
int error, dom, sub, domSteps, skipped = skip;
16971693
int intPos[2], delta[2], delta2[2], increment[2];
16981694
bool foundPixel = false;
16991695
unsigned char materialID;
@@ -1783,7 +1779,7 @@ bool SceneMan::CastWeaknessRay(const Vector& start, const Vector& ray, float str
17831779
}
17841780

17851781
MOID SceneMan::CastMORay(const Vector& start, const Vector& ray, const std::vector<MOID>& ignoreMOIDs, int ignoreTeam, unsigned char ignoreMaterial, bool ignoreAllTerrain, int skip) {
1786-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1782+
int error, dom, sub, domSteps, skipped = skip;
17871783
int intPos[2], delta[2], delta2[2], increment[2];
17881784
MOID hitMOID = g_NoMOID;
17891785
unsigned char hitTerrain = 0;
@@ -1884,7 +1880,7 @@ MOID SceneMan::CastMORay(const Vector& start, const Vector& ray, const std::vect
18841880
}
18851881

18861882
bool SceneMan::CastFindMORay(const Vector& start, const Vector& ray, MOID targetMOID, Vector& resultPos, unsigned char ignoreMaterial, bool ignoreAllTerrain, int skip, bool findChildMOIDs) {
1887-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1883+
int error, dom, sub, domSteps, skipped = skip;
18881884
int intPos[2], delta[2], delta2[2], increment[2];
18891885
MOID hitMOID = g_NoMOID;
18901886
unsigned char hitTerrain = 0;
@@ -1980,7 +1976,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start,
19801976

19811977
const SpatialPartitionGrid& partitionGrid = GetMOIDGrid();
19821978

1983-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
1979+
int error, dom, sub, domSteps, skipped = skip;
19841980
int intPos[2], delta[2], delta2[2], increment[2];
19851981
unsigned char hitTerrain = 0;
19861982

@@ -2041,7 +2037,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start,
20412037

20422038
// Detect MOs
20432039
std::vector<MovableObject*> hitMOs;
2044-
hitMOs = std::move(partitionGrid.GetMOsAtPosition(intPos[X], intPos[Y], ignoreTeam, false));
2040+
hitMOs = partitionGrid.GetMOsAtPosition(intPos[X], intPos[Y], ignoreTeam, false);
20452041

20462042
// Loop through the gotten MOs and check if we're ignoring their IDs - if not, put them onto our return vector
20472043
for (MovableObject* mo : hitMOs) {
@@ -2078,7 +2074,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start,
20782074
}
20792075

20802076
float SceneMan::CastObstacleRay(const Vector& start, const Vector& ray, Vector& obstaclePos, Vector& freePos, const std::vector<MOID>& ignoreMOIDs, int ignoreTeam, unsigned char ignoreMaterial, int skip) {
2081-
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
2077+
int error, dom, sub, domSteps, skipped = skip;
20822078
int intPos[2], delta[2], delta2[2], increment[2];
20832079
bool hitObstacle = false;
20842080

@@ -2591,11 +2587,11 @@ void SceneMan::Draw(BITMAP* targetBitmap, BITMAP* targetGUIBitmap, const Vector&
25912587
Box targetDimensions(Vector(), targetBitmap->w, targetBitmap->h);
25922588

25932589
if (!terrain->WrapsX() && targetBitmap->w > GetSceneWidth()) {
2594-
targetBox.SetCorner(Vector(static_cast<float>((targetBitmap->w - GetSceneWidth()) / 2), targetBox.GetCorner().GetY()));
2590+
targetBox.SetCorner(Vector(static_cast<float>((targetBitmap->w - GetSceneWidth())) / 2, targetBox.GetCorner().GetY()));
25952591
targetBox.SetWidth(static_cast<float>(GetSceneWidth()));
25962592
}
25972593
if (!terrain->WrapsY() && targetBitmap->h > GetSceneHeight()) {
2598-
targetBox.SetCorner(Vector(targetBox.GetCorner().GetX(), static_cast<float>((targetBitmap->h - GetSceneHeight()) / 2)));
2594+
targetBox.SetCorner(Vector(targetBox.GetCorner().GetX(), static_cast<float>((targetBitmap->h - GetSceneHeight())) / 2));
25992595
targetBox.SetHeight(static_cast<float>(GetSceneHeight()));
26002596
}
26012597

@@ -2656,7 +2652,7 @@ void SceneMan::Draw(BITMAP* targetBitmap, BITMAP* targetGUIBitmap, const Vector&
26562652

26572653
static int s_drawPathfinderDebugForTeam = -2;
26582654
if (s_drawPathfinderDebugForTeam > -2) {
2659-
m_pCurrentScene->GetPathFinder(static_cast<Activity::Teams>(s_drawPathfinderDebugForTeam)).DebugRender(targetBitmap, targetPos, m_LastUpdatedScreen);
2655+
m_pCurrentScene->GetPathFinder(static_cast<Activity::Teams>(s_drawPathfinderDebugForTeam)).DebugRender(targetBitmap, targetPos);
26602656
}
26612657

26622658
if (m_pDebugLayer) {

0 commit comments

Comments
 (0)