Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/am_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2844,7 +2844,7 @@ void DAutomap::drawPlayers ()
return;
}

for (i = 0; i < MAXPLAYERS; i++)
for (unsigned int i = 0; i < MAXPLAYERS; i++)
{
player_t *p = &players[i];
AMColor color;
Expand All @@ -2855,7 +2855,7 @@ void DAutomap::drawPlayers ()
}

// We don't always want to show allies on the automap.
if (dmflags2 & DF2_NO_AUTOMAP_ALLIES && i != consoleplayer)
if (dmflags2 & DF2_NO_AUTOMAP_ALLIES && (int)i != consoleplayer)
continue;

if (deathmatch && !demoplayback &&
Expand Down
4 changes: 2 additions & 2 deletions src/common/console/c_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ bool C_IsValidInt(const char* arg, int& value, int base)
char* end_read;
value = std::strtol(arg, &end_read, base);
ptrdiff_t chars_read = end_read - arg;
return chars_read == strlen(arg);
return chars_read == (ptrdiff_t)strlen(arg);
}

bool C_IsValidFloat(const char* arg, double& value)
{
char* end_read;
value = std::strtod(arg, &end_read);
ptrdiff_t chars_read = end_read - arg;
return chars_read == strlen(arg);
return chars_read == (ptrdiff_t)strlen(arg);
}

void C_DoCommand (const char *cmd, int keynum)
Expand Down
4 changes: 2 additions & 2 deletions src/common/engine/i_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ static bool HostGame(int arg, bool forcedNetMode)
MaxClients = 2u;
}

if (MaxClients > MAXPLAYERS)
if (MaxClients > (int)MAXPLAYERS)
I_FatalError("Cannot host a game with %u players. The limit is currently %lu", MaxClients, MAXPLAYERS);

GenerateGameID();
Expand Down Expand Up @@ -1029,7 +1029,7 @@ static bool HostGame(int arg, bool forcedNetMode)
NetBuffer[1] = PRE_GO;
NetBuffer[2] = NetMode;
NetBufferLength = 3u;
for (size_t client = 1u; client < MaxClients; ++client)
for (size_t client = 1u; client < (size_t)MaxClients; ++client)
{
if (Connected[client].Status != CSTAT_NONE)
SendPacket(Connected[client].Address);
Expand Down
2 changes: 1 addition & 1 deletion src/common/filesystem/source/files_decompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ bool FCompressedBuffer::Decompress(char* destbuffer)
FileReader frz;
if (OpenDecompressor(frz, mr, mSize, mMethod))
{
return frz.Read(destbuffer, mSize) != mSize;
return frz.Read(destbuffer, mSize) != (FileSys::FileReader::Size)mSize;
}
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/common/scripting/vm/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ typename VMReturnTypeTrait<RetVal>::type VMCallSingle(VMFunction* func, Args...

VMValue params[argCount];

for(int i = 0, j = 0; i < sizeof...(Args); i++)
for(size_t i = 0, j = 0; i < sizeof...(Args); i++)
{
for(int k = 0; k < arglist[i].count; k++, j++)
{
Expand Down Expand Up @@ -774,7 +774,7 @@ std::tuple<typename VMReturnTypeTrait<Rets>::type...> VMCallMultiImpl(VMFunction

VMValue params[argCount];

for(int i = 0, j = 0; i < sizeof...(Args); i++)
for(size_t i = 0, j = 0; i < sizeof...(Args); i++)
{
for(int k = 0; k < arglist[i].count; k++, j++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/widgets/netstartwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void NetStartWindow::NetProgress(int cur, int limit)

Instance->maxpos = limit;
Instance->SetProgress(cur);
for (size_t start = Instance->LobbyWindow->GetItemAmount(); start < Instance->maxpos; ++start)
for (size_t start = Instance->LobbyWindow->GetItemAmount(); start < (size_t)Instance->maxpos; ++start)
Instance->LobbyWindow->AddItem(std::to_string(start));
}

Expand Down
26 changes: 13 additions & 13 deletions src/d_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ void NetUpdate(int tics)
// If player count is < 8, scale the number of commands by 1 per every 1 less player.
// If player count is < 4, scale the number of commands by 4 per every 1 less player.
constexpr size_t MaxTicsPerPacket = 2u;
if (players > 1u)
if (players > 1)
{
maxCommands = MaxTicsPerPacket;
if (players >= MaxPlayersPerPacket / 2 && players < MaxPlayersPerPacket)
Expand Down Expand Up @@ -1878,7 +1878,7 @@ bool D_CheckNetGame()
for (auto client : NetworkClients)
playeringame[client] = true;

if (MaxClients > 1u)
if (MaxClients > 1)
{
if (consoleplayer == Net_Arbitrator)
Printf("Selected " TEXTCOLOR_BLUE "%s" TEXTCOLOR_NORMAL " networking mode\n", NetMode == NET_PeerToPeer ? "peer to peer" : "packet server");
Expand Down Expand Up @@ -3298,10 +3298,10 @@ CCMD(kick)
}

TArray<int> cNums = {};
for (size_t i = 1u; i < argv.argc(); ++i)
for (size_t i = 1u; i < (size_t)argv.argc(); ++i)
{
int cNum = -1;
if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS)
if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || (unsigned int)cNum >= MAXPLAYERS)
Printf("Bad client number %s\n", argv[i]);
else if (cNum != consoleplayer && cNums.Find(cNum) >= cNums.Size())
cNums.Push(cNum);
Expand Down Expand Up @@ -3336,10 +3336,10 @@ CCMD(mute)
}

TArray<int> pNums = {};
for (size_t i = 1u; i < argv.argc(); ++i)
for (size_t i = 1u; i < (size_t)argv.argc(); ++i)
{
int pNum = -1;
if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= MAXPLAYERS)
if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= (int)MAXPLAYERS)
Printf("Bad player number %s\n", argv[i]);
else if (pNum != consoleplayer && pNums.Find(pNum) >= pNums.Size())
pNums.Push(pNum);
Expand Down Expand Up @@ -3367,7 +3367,7 @@ CCMD(muteall)
return;
}

for (int i = 0; i < MAXPLAYERS; ++i)
for (unsigned int i = 0; i < MAXPLAYERS; ++i)
{
if (playeringame[i] && i != consoleplayer)
MutedClients |= (uint64_t)1u << i;
Expand Down Expand Up @@ -3411,10 +3411,10 @@ CCMD(unmute)
}

TArray<int> pNums = {};
for (size_t i = 1u; i < argv.argc(); ++i)
for (size_t i = 1u; i < (size_t)argv.argc(); ++i)
{
int pNum = -1;
if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= MAXPLAYERS)
if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= (int)MAXPLAYERS)
Printf("Bad player number %s\n", argv[i]);
else if (pNum != consoleplayer && pNums.Find(pNum) >= pNums.Size())
pNums.Push(pNum);
Expand Down Expand Up @@ -3509,10 +3509,10 @@ CCMD(addsettingscontrollers)
}

TArray<int> cNums = {};
for (size_t i = 1u; i < argv.argc(); ++i)
for (size_t i = 1u; i < (size_t)argv.argc(); ++i)
{
int cNum = -1;
if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS)
if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || (unsigned int)cNum >= MAXPLAYERS)
Printf("Bad client number %s\n", argv[i]);
else if (cNum != Net_Arbitrator && cNums.Find(cNum) >= cNums.Size())
cNums.Push(cNum);
Expand All @@ -3536,10 +3536,10 @@ CCMD(removesettingscontrollers)
}

TArray<int> cNums = {};
for (size_t i = 1u; i < argv.argc(); ++i)
for (size_t i = 1u; i < (size_t)argv.argc(); ++i)
{
int cNum = -1;
if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS)
if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || (unsigned int)cNum >= MAXPLAYERS)
Printf("Bad player number %s\n", argv[i]);
else if (cNum != Net_Arbitrator && cNums.Find(cNum) >= cNums.Size())
cNums.Push(cNum);
Expand Down
6 changes: 3 additions & 3 deletions src/d_netinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ static int namesortfunc(const void *a, const void *b)
FString D_GetUserInfoStrings(int pnum, bool compact)
{
FString result;
if (pnum >= 0 && pnum < MAXPLAYERS)
if (pnum >= 0 && (unsigned int)pnum < MAXPLAYERS)
{
userinfo_t* info = &players[pnum].userinfo;
TArray<TMap<FName, FBaseCVar*>::Pair*> userinfo_pairs(info->CountUsed());
Expand Down Expand Up @@ -838,7 +838,7 @@ void D_ReadUserInfoStrings (int pnum, TArrayView<uint8_t>& stream, bool update)
qsort(&compact_names[0], compact_names.Size(), sizeof(FName), namesortfunc);
}

if (pnum < MAXPLAYERS)
if (pnum >= 0 && (unsigned int)pnum < MAXPLAYERS)
{
for (breakpt = ptr; breakpt != NULL; ptr = breakpt + 1)
{
Expand Down Expand Up @@ -1055,7 +1055,7 @@ CCMD(playerinfo)
{
i = consoleplayer;
}
else if (!C_IsValidInt(argv[1], i) || i < 0 || i >= MAXPLAYERS)
else if (!C_IsValidInt(argv[1], i) || i < 0 || (unsigned int)i >= MAXPLAYERS)
{
Printf("Bad player number %s\n", argv[1]);
return;
Expand Down
4 changes: 2 additions & 2 deletions src/g_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ void G_Ticker ()

// check for turbo cheats
if (multiplayer && turbo > 100.f && cmd->forwardmove > TURBOTHRESHOLD &&
!(gametic & 31) && ((gametic >> 5) & (MAXPLAYERS-1)) == client)
!(gametic & 31) && (int)((gametic >> 5) & (MAXPLAYERS-1)) == client)
{
Printf("%s is turbo!\n", players[client].userinfo.GetName());
}
Expand Down Expand Up @@ -2907,7 +2907,7 @@ void G_DoPlayDemo (void)
}
size_t demolen = fr.GetLength();
demobuffer.Resize(demolen);
if (fr.Read(demobuffer.Data(), demolen) != demolen)
if (fr.Read(demobuffer.Data(), demolen) != (FileSys::FileReader::Size)demolen)
{
I_Error("Unable to read demo '%s'", defdemoname.GetChars());
}
Expand Down
2 changes: 1 addition & 1 deletion src/gamedata/teaminfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ bool FTeam::IsValid (unsigned int uiTeam)

bool FTeam::ChangeTeam(unsigned int pNum, unsigned int newTeam)
{
if (!multiplayer || !teamplay || pNum >= MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == newTeam)
if (!multiplayer || !teamplay || pNum >= MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == (int)newTeam)
return false;

players[pNum].userinfo.TeamChanged(newTeam);
Expand Down
16 changes: 8 additions & 8 deletions src/playsim/p_acs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4605,7 +4605,7 @@ int DLevelScript::GetPlayerInput(int playernum, int inputnum)
}
p = activator->player;
}
else if (playernum >= MAXPLAYERS || !Level->PlayerInGame(playernum))
else if (playernum >= (int)MAXPLAYERS || !Level->PlayerInGame(playernum))
{
return 0;
}
Expand Down Expand Up @@ -5541,7 +5541,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &
case ACSF_GetAirSupply:
MIN_ARG_COUNT(1);
{
if (args[0] < 0 || args[0] >= MAXPLAYERS || !Level->PlayerInGame(args[0]))
if (args[0] < 0 || args[0] >= (int)MAXPLAYERS || !Level->PlayerInGame(args[0]))
{
return 0;
}
Expand All @@ -5554,7 +5554,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &
case ACSF_SetAirSupply:
MIN_ARG_COUNT(2);
{
if (args[0] < 0 || args[0] >= MAXPLAYERS || !Level->PlayerInGame(args[0]))
if (args[0] < 0 || args[0] >= (int)MAXPLAYERS || !Level->PlayerInGame(args[0]))
{
return 0;
}
Expand All @@ -5577,7 +5577,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &
case ACSF_GetArmorType:
MIN_ARG_COUNT(2);
{
if (args[1] < 0 || args[1] >= MAXPLAYERS || !Level->PlayerInGame(args[1]))
if (args[1] < 0 || args[1] >= (int)MAXPLAYERS || !Level->PlayerInGame(args[1]))
{
return 0;
}
Expand Down Expand Up @@ -9865,7 +9865,7 @@ int DLevelScript::RunScript()
break;

case PCD_PLAYERINGAME:
if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS)
if (STACK(1) < 0 || STACK(1) >= (int)MAXPLAYERS)
{
STACK(1) = false;
}
Expand All @@ -9876,7 +9876,7 @@ int DLevelScript::RunScript()
break;

case PCD_PLAYERISBOT:
if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS || !Level->PlayerInGame(STACK(1)))
if (STACK(1) < 0 || STACK(1) >= (int)MAXPLAYERS || !Level->PlayerInGame(STACK(1)))
{
STACK(1) = false;
}
Expand Down Expand Up @@ -10075,7 +10075,7 @@ int DLevelScript::RunScript()
break;

case PCD_PLAYERCLASS: // [GRB]
if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS || !Level->PlayerInGame(STACK(1)))
if (STACK(1) < 0 || STACK(1) >= (int)MAXPLAYERS || !Level->PlayerInGame(STACK(1)))
{
STACK(1) = -1;
}
Expand All @@ -10086,7 +10086,7 @@ int DLevelScript::RunScript()
break;

case PCD_GETPLAYERINFO: // [GRB]
if (STACK(2) < 0 || STACK(2) >= MAXPLAYERS || !Level->PlayerInGame(STACK(2)))
if (STACK(2) < 0 || STACK(2) >= (int)MAXPLAYERS || !Level->PlayerInGame(STACK(2)))
{
STACK(2) = -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void FreeParticle(FLevelLocals* Level, particle_t* particle)
assert(next->tprev == pindex);
next->tprev = particle->tprev;
}
if (Level->OldestParticle == pindex)
if ((int)Level->OldestParticle == pindex)
{
assert(tnext == NO_PARTICLE);
Level->OldestParticle = particle->tprev;
Expand Down
8 changes: 4 additions & 4 deletions src/playsim/p_lnspec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2857,7 +2857,7 @@ FUNC(LS_ChangeCamera)
{
int i;

for (i = 0; i < MAXPLAYERS; i++)
for (i = 0; i < (int)MAXPLAYERS; i++)
{
if (!Level->PlayerInGame(i))
continue;
Expand Down Expand Up @@ -3007,7 +3007,7 @@ FUNC(LS_SetPlayerProperty)
{
int i;

for (i = 0; i < MAXPLAYERS; i++)
for (i = 0; i < (int)MAXPLAYERS; i++)
{
auto p = Level->Players[i];
if (!Level->PlayerInGame(i) || p->mo == nullptr)
Expand Down Expand Up @@ -3122,7 +3122,7 @@ FUNC(LS_SetPlayerProperty)
mask = CF_FROZEN | CF_TOTALLYFROZEN;
}

for (i = 0; i < MAXPLAYERS; i++)
for (i = 0; i < (int)MAXPLAYERS; i++)
{
if (!Level->PlayerInGame(i))
continue;
Expand Down Expand Up @@ -3363,7 +3363,7 @@ FUNC(LS_GlassBreak)
{ // Up stats and signal this mission is complete
if (it == NULL)
{
for (int i = 0; i < MAXPLAYERS; ++i)
for (unsigned int i = 0; i < MAXPLAYERS; ++i)
{
if (Level->PlayerInGame(i))
{
Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckLocalView)

void AActor::DisableLocalRendering(const unsigned int pNum, const bool disable)
{
if (pNum == consoleplayer)
if ((int)pNum == consoleplayer)
NoLocalRender = disable;
}

Expand Down