- fixed engine code warnings pointed out by XCode 13.

This commit is contained in:
Christoph Oelckers 2021-10-08 19:06:41 +02:00
parent 9b047c771c
commit 29769dd673
11 changed files with 23 additions and 26 deletions

View File

@ -1048,7 +1048,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
if (da.x >= da.y)
continue;
//It actually got here, through all the continue's!!!
int32_t daz, daz2;
int32_t daz = 0, daz2 = 0;
closest = pos->vec2;
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
getsectordist(closest, k, &closest);

View File

@ -1957,7 +1957,7 @@ void polymost_scansector(int32_t sectnum)
int const nextsectnum = wal->nextsector; //Scan close sectors
if (nextsectnum >= 0 && !(wal->cstat&32) && sectorbordercnt < countof(sectorborder))
if (nextsectnum >= 0 && !(wal->cstat&32) && sectorbordercnt < (int)countof(sectorborder))
if (gotsector[nextsectnum] == 0)
{
double const d = fp1.X* fp2.Y - fp2.X * fp1.Y;

View File

@ -180,25 +180,20 @@ CCMD(give)
Printf("give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item\n");
return;
}
size_t found = -1;
for (size_t i = 0; i < countof(type); i++)
{
if (!stricmp(argv[1], type[i]))
{
found = i;
break;
if (!CheckCheatmode(true, true))
{
Net_WriteByte(DEM_GIVE);
Net_WriteByte((uint8_t)i);
}
return;
}
}
if (found == -1)
{
Printf("Unable to give %s\n", argv[1]);
return;
}
if (!CheckCheatmode(true, true))
{
Net_WriteByte(DEM_GIVE);
Net_WriteByte((uint8_t)found);
}
Printf("Unable to give %s\n", argv[1]);
}
//---------------------------------------------------------------------------
@ -522,7 +517,7 @@ CCMD(skill)
}
else if (currentSkill == -1)
{
Printf("Current skill is not set (%d)\n");
Printf("Current skill is not set\n");
}
else if (currentSkill == -2)
{
@ -530,7 +525,7 @@ CCMD(skill)
}
else
{
Printf("Current skill is an unknown/unsupported value (%d)\n");
Printf("Current skill is an unknown/unsupported value (%d)\n", currentSkill);
}
}
else if (argsCount == 2)

View File

@ -350,7 +350,7 @@ void parseCopyTile(FScanner& sc, FScriptPosition& pos)
if ((unsigned)temppal >= MAXREALPAL)
{
pos.Message(MSG_ERROR, "copytile: palette number %d out of range (max=%d)\n", MAXREALPAL - 1);
pos.Message(MSG_ERROR, "copytile: palette number %d out of range (max=%d)\n", temppal, MAXREALPAL - 1);
break;
}
}
@ -1665,7 +1665,7 @@ void parseDefineModelFrame(FScanner& sc, FScriptPosition& pos)
int err = (md_defineframe(mdglobal.lastmodelid, framename, i, max(0, mdglobal.modelskin), 0.0f, 0));
if (err < 0) ok = false;
if (err == -2) pos.Message(MSG_ERROR, "Invalid tile number %d", i);
else if (err == -3) pos.Message(MSG_ERROR, "Invalid frame name", framename.GetChars());
else if (err == -3) pos.Message(MSG_ERROR, "Invalid frame name '%s'", framename.GetChars());
}
mdglobal.seenframe = 1;
}

View File

@ -306,7 +306,7 @@ void FMapInfoParser::ParseCluster()
bool FMapInfoParser::CheckLegacyMapDefinition(FString& mapname)
{
if (Internal && (g_gameType & GAMEFLAG_BLOOD | GAMEFLAG_DUKECOMPAT | GAMEFLAG_SW) && sc.CheckString("{"))
if (Internal && (g_gameType & (GAMEFLAG_BLOOD | GAMEFLAG_DUKECOMPAT | GAMEFLAG_SW)) && sc.CheckString("{"))
{
sc.MustGetNumber();
int vol = sc.Number;

View File

@ -699,7 +699,7 @@ static TArray<GrpEntry> SetupGame()
auto grplower = grp.FileName.MakeLower();
FixPathSeperator(grplower);
auto pos = grplower.LastIndexOf(gamegrplower);
if (pos >= 0 && pos == grplower.Len() - gamegrplower.Len())
if (pos >= 0 && pos == ptrdiff_t(grplower.Len() - gamegrplower.Len()))
{
groupno = g;
break;

View File

@ -77,7 +77,7 @@ void updateTurnHeldAmt(double const scaleAdjust)
turnheldtime += scaleAdjust * (120. / GameTicRate);
}
bool const isTurboTurnTime()
bool isTurboTurnTime()
{
return turnheldtime >= 590. / GameTicRate;
}

View File

@ -314,6 +314,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w,
void updateTurnHeldAmt(double const scaleAdjust);
bool const isTurboTurnTime();
bool isTurboTurnTime();
void resetTurnHeldAmt();
void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1);

View File

@ -121,7 +121,7 @@ void paletteLoadFromDisk(void)
}
// Read base shade table (lookuptables 0).
int length = numshades * 256;
unsigned length = numshades * 256;
auto buffer = fil.Read(length);
if (buffer.Size() != length) return;
lookups.setTable(0, buffer.Data());

View File

@ -64,7 +64,7 @@ inline void mergePortals()
for (int n = 0; n < numsectors; n++)
{
//Printf("Merged %d and %d\n", i, j);
if (sector[n].portalnum == j) sector[n].portalnum = i;
if (sector[n].portalnum == (int)j) sector[n].portalnum = i;
}
didsomething = true;
break;

View File

@ -15,7 +15,9 @@
#include "hw_renderstate.h"
#include "hw_cvars.h"
#ifdef _MSC_VER
#pragma warning(disable:4244) // this gets a bit annoying in the renderer...
#endif
struct HWHorizonInfo;
struct HWSkyInfo;