diff --git a/src/am_map.cpp b/src/am_map.cpp index 03dd7f215f6..f69e60a9ea8 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -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; @@ -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 && diff --git a/src/common/console/c_dispatch.cpp b/src/common/console/c_dispatch.cpp index c4a364a6183..61aa457df88 100644 --- a/src/common/console/c_dispatch.cpp +++ b/src/common/console/c_dispatch.cpp @@ -195,7 +195,7 @@ 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) @@ -203,7 +203,7 @@ 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) diff --git a/src/common/engine/i_net.cpp b/src/common/engine/i_net.cpp index 46607b5ddb0..735e3c7e340 100644 --- a/src/common/engine/i_net.cpp +++ b/src/common/engine/i_net.cpp @@ -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(); @@ -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); diff --git a/src/common/filesystem/source/files_decompress.cpp b/src/common/filesystem/source/files_decompress.cpp index 3f7dfb86598..a209d37a581 100644 --- a/src/common/filesystem/source/files_decompress.cpp +++ b/src/common/filesystem/source/files_decompress.cpp @@ -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; diff --git a/src/common/scripting/vm/vm.h b/src/common/scripting/vm/vm.h index 1828799af31..b509e109926 100644 --- a/src/common/scripting/vm/vm.h +++ b/src/common/scripting/vm/vm.h @@ -738,7 +738,7 @@ typename VMReturnTypeTrait::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++) { @@ -774,7 +774,7 @@ std::tuple::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++) { diff --git a/src/common/widgets/netstartwindow.cpp b/src/common/widgets/netstartwindow.cpp index c7ec55f332e..cb2a4af17bb 100644 --- a/src/common/widgets/netstartwindow.cpp +++ b/src/common/widgets/netstartwindow.cpp @@ -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)); } diff --git a/src/d_net.cpp b/src/d_net.cpp index 0648c81d71b..1ecb4ddc2c0 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -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) @@ -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"); @@ -3298,10 +3298,10 @@ CCMD(kick) } TArray 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); @@ -3336,10 +3336,10 @@ CCMD(mute) } TArray 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); @@ -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; @@ -3411,10 +3411,10 @@ CCMD(unmute) } TArray 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); @@ -3509,10 +3509,10 @@ CCMD(addsettingscontrollers) } TArray 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); @@ -3536,10 +3536,10 @@ CCMD(removesettingscontrollers) } TArray 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); diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 7ddd5c24971..856b289551b 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -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::Pair*> userinfo_pairs(info->CountUsed()); @@ -838,7 +838,7 @@ void D_ReadUserInfoStrings (int pnum, TArrayView& 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) { @@ -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; diff --git a/src/g_game.cpp b/src/g_game.cpp index b0ac2ec21ee..a745716907c 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -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()); } @@ -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()); } diff --git a/src/gamedata/teaminfo.cpp b/src/gamedata/teaminfo.cpp index 44e8c0e374c..5724cbdbc76 100644 --- a/src/gamedata/teaminfo.cpp +++ b/src/gamedata/teaminfo.cpp @@ -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); diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index 3ce65b755bd..27f1d4228de 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 5ad98215965..2da5df3032f 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -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; diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index be85ba44ff3..cda7d46d9d5 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -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; @@ -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) @@ -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; @@ -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)) { diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 4e034ebff8d..d4bfca982b1 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -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; }