From 68e4eb21d506e46c05ea3664f58a9a2aa1037c29 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Tue, 15 Feb 2022 00:12:52 +0100 Subject: [PATCH] Add modernize-use-bool-literals --- .clang-tidy | 1 + src/base/system.cpp | 12 ++++++------ src/base/unicode/confusables.cpp | 2 +- .../client/backend/opengl/opengl_sl_program.cpp | 2 +- src/engine/client/client.cpp | 8 ++++---- src/engine/client/serverbrowser.cpp | 6 +++--- src/engine/client/text.cpp | 2 +- src/engine/server/databases/connection_pool.cpp | 2 +- src/engine/shared/console.cpp | 4 ++-- src/engine/shared/datafile.cpp | 8 ++++---- src/engine/shared/demo.cpp | 12 ++++++------ src/engine/shared/huffman.cpp | 4 ++-- src/engine/shared/linereader.cpp | 2 +- src/engine/shared/masterserver.cpp | 2 +- src/engine/shared/network.cpp | 2 +- src/engine/shared/network_client.cpp | 2 +- src/engine/shared/network_conn.cpp | 2 +- src/engine/shared/network_server.cpp | 2 +- src/engine/shared/ringbuffer.cpp | 6 +++--- src/engine/shared/uuid_manager.cpp | 2 +- src/game/client/gameclient.cpp | 8 ++++---- .../client/prediction/entities/character.cpp | 16 ++++++++-------- .../client/prediction/entities/projectile.cpp | 2 +- src/game/server/entities/character.cpp | 6 +++--- src/game/server/gamecontext.cpp | 4 ++-- src/game/server/player.cpp | 2 +- src/tools/crapnet.cpp | 6 +++--- src/tools/fake_server.cpp | 2 +- src/tools/packetgen.cpp | 2 +- 29 files changed, 66 insertions(+), 65 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 68c597c23..e3fecb378 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -48,6 +48,7 @@ Checks: > modernize-replace-disallow-copy-and-assign-macro, modernize-replace-random-shuffle, modernize-shrink-to-fit, + modernize-use-bool-literals, readability-*, -readability-braces-around-statements, -readability-convert-member-functions-to-static, diff --git a/src/base/system.cpp b/src/base/system.cpp index 28d66f193..14654f601 100644 --- a/src/base/system.cpp +++ b/src/base/system.cpp @@ -557,7 +557,7 @@ static void aio_thread(void *user) ASYNCIO *aio = (ASYNCIO *)user; lock_wait(aio->lock); - while(1) + while(true) { struct BUFFERS buffers; int result_io_error; @@ -1347,7 +1347,7 @@ static int parse_int(int *out, const char **str) i = **str - '0'; (*str)++; - while(1) + while(true) { if(**str < '0' || **str > '9') { @@ -2727,7 +2727,7 @@ void str_clean_whitespaces(char *str_in) read++; /* end of read string is detected in the loop */ - while(1) + while(true) { /* skip whitespace */ int found_whitespace = 0; @@ -3439,7 +3439,7 @@ int str_utf8_decode(const char **ptr) int utf8_code_point = 0; int utf8_bytes_seen = 0; int utf8_bytes_needed = 0; - while(1) + while(true) { unsigned char byte = str_byte_next(ptr); if(utf8_bytes_needed == 0) @@ -3904,7 +3904,7 @@ int secure_rand_below(int below) { unsigned int mask = find_next_power_of_two_minus_one(below); dbg_assert(below > 0, "below must be positive"); - while(1) + while(true) { unsigned int n; secure_random_fill(&n, sizeof(n)); @@ -4054,7 +4054,7 @@ int os_version_str(char *version, int length) *newline = 0; } str_format(extra, sizeof(extra), "; %s", buf + offset + 12); - } while(0); + } while(false); str_format(version, length, "%s %s (%s, %s)%s", u.sysname, u.release, u.machine, u.version, extra); return 0; diff --git a/src/base/unicode/confusables.cpp b/src/base/unicode/confusables.cpp index 7acc1522f..e208cc263 100644 --- a/src/base/unicode/confusables.cpp +++ b/src/base/unicode/confusables.cpp @@ -88,7 +88,7 @@ int str_utf8_comp_confusable(const char *str1, const char *str2) str_utf8_skeleton_begin(&skel1, str1); str_utf8_skeleton_begin(&skel2, str2); - while(1) + while(true) { int ch1 = str_utf8_skeleton_next(&skel1); int ch2 = str_utf8_skeleton_next(&skel2); diff --git a/src/engine/client/backend/opengl/opengl_sl_program.cpp b/src/engine/client/backend/opengl/opengl_sl_program.cpp index e9aacfba7..e8ed7c0ee 100644 --- a/src/engine/client/backend/opengl/opengl_sl_program.cpp +++ b/src/engine/client/backend/opengl/opengl_sl_program.cpp @@ -72,7 +72,7 @@ void CGLSLProgram::DetachAllShaders() { TWGLuint aShaders[100]; GLsizei ReturnedCount = 0; - while(1) + while(true) { glGetAttachedShaders(m_ProgramID, 100, &ReturnedCount, aShaders); diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 5bb4322bf..852134363 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -376,7 +376,7 @@ CClient::CClient() : m_CurrentInput[0] = 0; m_CurrentInput[1] = 0; - m_LastDummy = 0; + m_LastDummy = false; mem_zero(&m_aInputs, sizeof(m_aInputs)); @@ -2518,7 +2518,7 @@ void CClient::Update() { // switch dummy snapshot int64_t Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get()); - while(1) + while(true) { CSnapshotStorage::CHolder *pCur = m_aSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT]; int64_t TickStart = (pCur->m_Tick) * time_freq() / 50; @@ -2557,7 +2557,7 @@ void CClient::Update() Repredict = 1; } - while(1) + while(true) { CSnapshotStorage::CHolder *pCur = m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]; int64_t TickStart = (pCur->m_Tick) * time_freq() / 50; @@ -2979,7 +2979,7 @@ void CClient::Run() int64_t LastTime = time_get_microseconds(); int64_t LastRenderTime = time_get(); - while(1) + while(true) { set_new_tick(); diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index 1aa4d07a7..f091643f9 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -1194,7 +1194,7 @@ void CServerBrowser::Update(bool ForceResort) CServerEntry *pEntry = m_pFirstReqServer; int Count = 0; - while(1) + while(true) { if(!pEntry) // no more entries break; @@ -1223,7 +1223,7 @@ void CServerBrowser::Update(bool ForceResort) { //reset old ones pEntry = m_pFirstReqServer; - while(1) + while(true) { if(!pEntry) // no more entries break; @@ -1239,7 +1239,7 @@ void CServerBrowser::Update(bool ForceResort) else if(Count == 0 && m_CurrentMaxRequests == 1) //we reached the limit, just release all left requests. IF a server sends us a packet, a new request will be added automatically, so we can delete all { pEntry = m_pFirstReqServer; - while(1) + while(true) { if(!pEntry) // no more entries break; diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index 301b2aa22..3abf3675b 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -264,7 +264,7 @@ class CTextRender : public IEngineTextRender int WordLength(const char *pText) { const char *pCursor = pText; - while(1) + while(true) { if(*pCursor == 0) return pCursor - pText; diff --git a/src/engine/server/databases/connection_pool.cpp b/src/engine/server/databases/connection_pool.cpp index 339cb5459..b0ea46f40 100644 --- a/src/engine/server/databases/connection_pool.cpp +++ b/src/engine/server/databases/connection_pool.cpp @@ -132,7 +132,7 @@ void CDbConnectionPool::Worker() // enter fail mode when a sql request fails, skip read request during it and // write to the backup database until all requests are handled bool FailMode = false; - while(1) + while(true) { if(FailMode && m_NumElem.GetApproximateValue() == 0) { diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index 13f41ca7b..a0ec9a8f5 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -159,7 +159,7 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat) pStr = pResult->m_pArgsStart; - while(1) + while(true) { if(!Command) break; @@ -198,7 +198,7 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat) pResult->AddArgument(pStr); pDst = pStr; // we might have to process escape data - while(1) + while(true) { if(pStr[0] == '"') break; diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index da7013ead..45da1973f 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -126,7 +126,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int sha256_init(&Sha256Ctxt); unsigned char aBuffer[BUFFER_SIZE]; - while(1) + while(true) { unsigned Bytes = io_read(File, aBuffer, BUFFER_SIZE); if(Bytes <= 0) @@ -144,14 +144,14 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int if(sizeof(Header) != io_read(File, &Header, sizeof(Header))) { dbg_msg("datafile", "couldn't load header"); - return 0; + return false; } if(Header.m_aID[0] != 'A' || Header.m_aID[1] != 'T' || Header.m_aID[2] != 'A' || Header.m_aID[3] != 'D') { if(Header.m_aID[0] != 'D' || Header.m_aID[1] != 'A' || Header.m_aID[2] != 'T' || Header.m_aID[3] != 'A') { dbg_msg("datafile", "wrong signature. %x %x %x %x", Header.m_aID[0], Header.m_aID[1], Header.m_aID[2], Header.m_aID[3]); - return 0; + return false; } } @@ -161,7 +161,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int if(Header.m_Version != 3 && Header.m_Version != 4) { dbg_msg("datafile", "wrong version. version=%x", Header.m_Version); - return 0; + return false; } // read in the rest except the data diff --git a/src/engine/shared/demo.cpp b/src/engine/shared/demo.cpp index 4e17198f7..97f219940 100644 --- a/src/engine/shared/demo.cpp +++ b/src/engine/shared/demo.cpp @@ -152,7 +152,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con else { // write map data - while(1) + while(true) { unsigned char aChunk[1024 * 64]; int Bytes = io_read(MapFile, &aChunk, sizeof(aChunk)); @@ -487,7 +487,7 @@ void CDemoPlayer::ScanFile() StartPos = io_tell(m_File); m_Info.m_SeekablePoints = 0; - while(1) + while(true) { long CurrentPos = io_tell(m_File); @@ -554,7 +554,7 @@ void CDemoPlayer::DoTick() if(m_UpdateIntraTimesFunc) m_UpdateIntraTimesFunc(); - while(1) + while(true) { if(ReadChunkHeader(&ChunkType, &ChunkSize, &ChunkTick)) { @@ -672,7 +672,7 @@ void CDemoPlayer::DoTick() void CDemoPlayer::Pause() { - m_Info.m_Info.m_Paused = 1; + m_Info.m_Info.m_Paused = true; #if defined(CONF_VIDEORECORDER) if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo) IVideo::Current()->Pause(true); @@ -685,7 +685,7 @@ void CDemoPlayer::Unpause() { /*m_Info.start_tick = m_Info.current_tick; m_Info.start_time = time_get();*/ - m_Info.m_Info.m_Paused = 0; + m_Info.m_Info.m_Paused = false; } #if defined(CONF_VIDEORECORDER) if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo) @@ -991,7 +991,7 @@ int CDemoPlayer::Update(bool RealTime) int64_t Freq = time_freq(); m_Info.m_CurrentTime += (int64_t)(Deltatime * (double)m_Info.m_Info.m_Speed); - while(1) + while(true) { int64_t CurtickStart = (m_Info.m_Info.m_CurrentTick) * Freq / SERVER_TICK_SPEED; diff --git a/src/engine/shared/huffman.cpp b/src/engine/shared/huffman.cpp index 00bc78a97..1f29b31cd 100644 --- a/src/engine/shared/huffman.cpp +++ b/src/engine/shared/huffman.cpp @@ -211,7 +211,7 @@ int CHuffman::Decompress(const void *pInput, int InputSize, void *pOutput, int O CNode *pEof = &m_aNodes[HUFFMAN_EOF_SYMBOL]; CNode *pNode = 0; - while(1) + while(true) { // {A} try to load a node now, this will reduce dependency at location {D} pNode = 0; @@ -246,7 +246,7 @@ int CHuffman::Decompress(const void *pInput, int InputSize, void *pOutput, int O Bitcount -= HUFFMAN_LUTBITS; // walk the tree bit by bit - while(1) + while(true) { // traverse tree pNode = &m_aNodes[pNode->m_aLeafs[Bits & 1]]; diff --git a/src/engine/shared/linereader.cpp b/src/engine/shared/linereader.cpp index 05c97f9af..8cc02a59c 100644 --- a/src/engine/shared/linereader.cpp +++ b/src/engine/shared/linereader.cpp @@ -15,7 +15,7 @@ char *CLineReader::Get() unsigned LineStart = m_BufferPos; bool CRLFBreak = false; - while(1) + while(true) { if(m_BufferPos >= m_BufferSize) { diff --git a/src/engine/shared/masterserver.cpp b/src/engine/shared/masterserver.cpp index f46001323..9ac54bf8a 100644 --- a/src/engine/shared/masterserver.cpp +++ b/src/engine/shared/masterserver.cpp @@ -155,7 +155,7 @@ public: CLineReader LineReader; LineReader.Init(File); - while(1) + while(true) { CMasterInfo Info = {{0}}; const char *pLine = LineReader.Get(); diff --git a/src/engine/shared/network.cpp b/src/engine/shared/network.cpp index 1da8b6e91..7cadabb09 100644 --- a/src/engine/shared/network.cpp +++ b/src/engine/shared/network.cpp @@ -26,7 +26,7 @@ int CNetRecvUnpacker::FetchChunk(CNetChunk *pChunk) CNetChunkHeader Header; unsigned char *pEnd = m_Data.m_aChunkData + m_Data.m_DataSize; - while(1) + while(true) { unsigned char *pData = m_Data.m_aChunkData; diff --git a/src/engine/shared/network_client.cpp b/src/engine/shared/network_client.cpp index 97f4e7b3d..f2e82dba7 100644 --- a/src/engine/shared/network_client.cpp +++ b/src/engine/shared/network_client.cpp @@ -57,7 +57,7 @@ int CNetClient::ResetErrorString() int CNetClient::Recv(CNetChunk *pChunk) { - while(1) + while(true) { // check for a chunk if(m_RecvUnpacker.FetchChunk(pChunk)) diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp index 1b89e9f82..81e3f4e80 100644 --- a/src/engine/shared/network_conn.cpp +++ b/src/engine/shared/network_conn.cpp @@ -68,7 +68,7 @@ void CNetConnection::Init(NETSOCKET Socket, bool BlockCloseMsg) void CNetConnection::AckChunks(int Ack) { - while(1) + while(true) { CNetChunkResend *pResend = m_Buffer.First(); if(!pResend) diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index 53f963fc2..2b491ca6f 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -627,7 +627,7 @@ static bool IsDDNetControlMsg(const CNetPacketConstruct *pPacket) */ int CNetServer::Recv(CNetChunk *pChunk, SECURITY_TOKEN *pResponseToken) { - while(1) + while(true) { NETADDR Addr; diff --git a/src/engine/shared/ringbuffer.cpp b/src/engine/shared/ringbuffer.cpp index 038306f78..20ec3af75 100644 --- a/src/engine/shared/ringbuffer.cpp +++ b/src/engine/shared/ringbuffer.cpp @@ -66,7 +66,7 @@ void *CRingBufferBase::Allocate(int Size) if(WantedSize > m_Size) return 0; - while(1) + while(true) { // check for space if(m_pProduce->m_Free) @@ -153,7 +153,7 @@ void *CRingBufferBase::Prev(void *pCurrent) { CItem *pItem = ((CItem *)pCurrent) - 1; - while(1) + while(true) { pItem = PrevBlock(pItem); if(pItem == m_pProduce) @@ -167,7 +167,7 @@ void *CRingBufferBase::Next(void *pCurrent) { CItem *pItem = ((CItem *)pCurrent) - 1; - while(1) + while(true) { pItem = NextBlock(pItem); if(pItem == m_pProduce) diff --git a/src/engine/shared/uuid_manager.cpp b/src/engine/shared/uuid_manager.cpp index 3f71f944f..c15398337 100644 --- a/src/engine/shared/uuid_manager.cpp +++ b/src/engine/shared/uuid_manager.cpp @@ -67,7 +67,7 @@ int ParseUuid(CUuid *pUuid, const char *pBuffer) return 1; } aCopy[8] = aCopy[13] = aCopy[18] = aCopy[23] = 0; - if(0 || + if(false || str_hex_decode(pUuid->m_aData + 0, 4, aCopy + 0) || str_hex_decode(pUuid->m_aData + 4, 2, aCopy + 9) || str_hex_decode(pUuid->m_aData + 6, 2, aCopy + 14) || diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index e04dea6f0..fc247502f 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1344,8 +1344,8 @@ void CGameClient::OnNewSnapshot() } else if(Item.m_Type == NETOBJTYPE_GAMEINFO) { - static bool s_GameOver = 0; - static bool s_GamePaused = 0; + static bool s_GameOver = false; + static bool s_GamePaused = false; m_Snap.m_pGameInfoObj = (const CNetObj_GameInfo *)pData; bool CurrentTickGameOver = (bool)(m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER); if(!s_GameOver && CurrentTickGameOver) @@ -1813,7 +1813,7 @@ void CGameClient::OnPredict() // detect mispredictions of other players and make corrections smoother when possible static vec2 s_aLastPos[MAX_CLIENTS] = {{0, 0}}; - static bool s_aLastActive[MAX_CLIENTS] = {0}; + static bool s_aLastActive[MAX_CLIENTS] = {false}; if(g_Config.m_ClAntiPingSmooth && Predict() && AntiPingPlayers() && m_NewTick && abs(m_PredictedTick - Client()->PredGameTick(g_Config.m_ClDummy)) <= 1 && abs(Client()->GameTick(g_Config.m_ClDummy) - Client()->PrevGameTick(g_Config.m_ClDummy)) <= 2) { @@ -2622,7 +2622,7 @@ int CGameClient::SwitchStateTeam() bool CGameClient::IsLocalCharSuper() { if(m_Snap.m_LocalClientID < 0) - return 0; + return false; return m_aClients[m_Snap.m_LocalClientID].m_Super; } diff --git a/src/game/client/prediction/entities/character.cpp b/src/game/client/prediction/entities/character.cpp index cd93dba53..ad7102505 100644 --- a/src/game/client/prediction/entities/character.cpp +++ b/src/game/client/prediction/entities/character.cpp @@ -369,8 +369,8 @@ void CCharacter::FireWeapon() ProjStartPos, //Pos Direction, //Dir Lifetime, //Span - 0, //Freeze - 0, //Explosive + false, //Freeze + false, //Explosive 0, //Force -1 //SoundImpact ); @@ -397,8 +397,8 @@ void CCharacter::FireWeapon() ProjStartPos, //Pos vec2(cosf(a), sinf(a)) * Speed, //Dir (int)(GameWorld()->GameTickSpeed() * Tuning()->m_ShotgunLifetime), //Span - 0, //Freeze - 0, //Explosive + false, //Freeze + false, //Explosive 0, //Force -1 //SoundImpact ); @@ -424,7 +424,7 @@ void CCharacter::FireWeapon() ProjStartPos, //Pos Direction, //Dir Lifetime, //Span - 0, //Freeze + false, //Freeze true, //Explosive 0, //Force SOUND_GRENADE_EXPLODE //SoundImpact @@ -1064,7 +1064,7 @@ CCharacter::CCharacter(CGameWorld *pGameWorld, int ID, CNetObj_Character *pChar, mem_zero(&m_SavedInput, sizeof(m_SavedInput)); m_LatestInput = m_LatestPrevInput = m_PrevInput = m_Input = m_SavedInput; m_ProximityRadius = ms_PhysSize; - m_Core.m_LeftWall = 1; + m_Core.m_LeftWall = true; m_ReloadTimer = 0; m_NumObjectsHit = 0; m_LastRefillJumps = false; @@ -1101,8 +1101,8 @@ void CCharacter::ResetPrediction() m_NumInputs = 0; m_FreezeTime = 0; m_FreezeTick = 0; - m_DeepFreeze = 0; - m_LiveFreeze = 0; + m_DeepFreeze = false; + m_LiveFreeze = false; m_FrozenLastTick = false; m_Super = false; for(int w = 0; w < NUM_WEAPONS; w++) diff --git a/src/game/client/prediction/entities/projectile.cpp b/src/game/client/prediction/entities/projectile.cpp index 37e9df852..44edfc278 100644 --- a/src/game/client/prediction/entities/projectile.cpp +++ b/src/game/client/prediction/entities/projectile.cpp @@ -173,7 +173,7 @@ CProjectile::CProjectile(CGameWorld *pGameWorld, int ID, CProjectileData *pProj, { m_Owner = -1; m_Bouncing = 0; - m_Freeze = 0; + m_Freeze = false; m_Explosive = (pProj->m_Type == WEAPON_GRENADE) && (fabs(1.0f - length(m_Direction)) < 0.015f); } m_Type = pProj->m_Type; diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 8dc07fa41..1261d9614 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -484,8 +484,8 @@ void CCharacter::FireWeapon() ProjStartPos, //Pos Direction, //Dir Lifetime, //Span - 0, //Freeze - 0, //Explosive + false, //Freeze + false, //Explosive 0, //Force -1 //SoundImpact ); @@ -541,7 +541,7 @@ void CCharacter::FireWeapon() ProjStartPos, //Pos Direction, //Dir Lifetime, //Span - 0, //Freeze + false, //Freeze true, //Explosive 0, //Force SOUND_GRENADE_EXPLODE //SoundImpact diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 474bae8a7..8c7f3737c 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3872,7 +3872,7 @@ void CGameContext::Whisper(int ClientID, char *pStr) pName = pStr; char *pDst = pStr; // we might have to process escape data - while(1) + while(true) { if(pStr[0] == '"') { @@ -3911,7 +3911,7 @@ void CGameContext::Whisper(int ClientID, char *pStr) else { pName = pStr; - while(1) + while(true) { if(pStr[0] == 0) { diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 6f834d254..129ca6142 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -106,7 +106,7 @@ void CPlayer::Reset() m_ShowOthers = g_Config.m_SvShowOthersDefault; m_ShowAll = g_Config.m_SvShowAllDefault; m_ShowDistance = vec2(1200, 800); - m_SpecTeam = 0; + m_SpecTeam = false; m_NinjaJetpack = false; m_Paused = PAUSE_NONE; diff --git a/src/tools/crapnet.cpp b/src/tools/crapnet.cpp index c0ee8f6a5..e666c2662 100644 --- a/src/tools/crapnet.cpp +++ b/src/tools/crapnet.cpp @@ -53,7 +53,7 @@ void Run(unsigned short Port, NETADDR Dest) MMSGS m; net_init_mmsgs(&m); - while(1) + while(true) { static int Lastcfg = 0; int n = ((time_get() / time_freq()) / m_ConfigInterval) % m_ConfigNumpingconfs; @@ -64,7 +64,7 @@ void Run(unsigned short Port, NETADDR Dest) Lastcfg = n; // handle incoming packets - while(1) + while(true) { // fetch data int DataTrash = 0; @@ -142,7 +142,7 @@ void Run(unsigned short Port, NETADDR Dest) {*/ CPacket *p = 0; CPacket *pNext = m_pFirst; - while(1) + while(true) { p = pNext; if(!p) diff --git a/src/tools/fake_server.cpp b/src/tools/fake_server.cpp index c1ddf0540..918e90259 100644 --- a/src/tools/fake_server.cpp +++ b/src/tools/fake_server.cpp @@ -116,7 +116,7 @@ static int Run() if(!pNet->Open(BindAddr, 0, 0, 0, 0)) return 0; - while(1) + while(true) { CNetChunk p; pNet->Update(); diff --git a/src/tools/packetgen.cpp b/src/tools/packetgen.cpp index 5993afa61..9b4c6ef8f 100644 --- a/src/tools/packetgen.cpp +++ b/src/tools/packetgen.cpp @@ -17,7 +17,7 @@ void Run(NETADDR Dest) Socket = net_udp_create(BindAddr); } - while(1) + while(true) { unsigned char aData[1024]; int Size = 0;