mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add modernize-use-bool-literals
This commit is contained in:
parent
984aed2e03
commit
68e4eb21d5
|
@ -48,6 +48,7 @@ Checks: >
|
||||||
modernize-replace-disallow-copy-and-assign-macro,
|
modernize-replace-disallow-copy-and-assign-macro,
|
||||||
modernize-replace-random-shuffle,
|
modernize-replace-random-shuffle,
|
||||||
modernize-shrink-to-fit,
|
modernize-shrink-to-fit,
|
||||||
|
modernize-use-bool-literals,
|
||||||
readability-*,
|
readability-*,
|
||||||
-readability-braces-around-statements,
|
-readability-braces-around-statements,
|
||||||
-readability-convert-member-functions-to-static,
|
-readability-convert-member-functions-to-static,
|
||||||
|
|
|
@ -557,7 +557,7 @@ static void aio_thread(void *user)
|
||||||
ASYNCIO *aio = (ASYNCIO *)user;
|
ASYNCIO *aio = (ASYNCIO *)user;
|
||||||
|
|
||||||
lock_wait(aio->lock);
|
lock_wait(aio->lock);
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
struct BUFFERS buffers;
|
struct BUFFERS buffers;
|
||||||
int result_io_error;
|
int result_io_error;
|
||||||
|
@ -1347,7 +1347,7 @@ static int parse_int(int *out, const char **str)
|
||||||
i = **str - '0';
|
i = **str - '0';
|
||||||
(*str)++;
|
(*str)++;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(**str < '0' || **str > '9')
|
if(**str < '0' || **str > '9')
|
||||||
{
|
{
|
||||||
|
@ -2727,7 +2727,7 @@ void str_clean_whitespaces(char *str_in)
|
||||||
read++;
|
read++;
|
||||||
|
|
||||||
/* end of read string is detected in the loop */
|
/* end of read string is detected in the loop */
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
/* skip whitespace */
|
/* skip whitespace */
|
||||||
int found_whitespace = 0;
|
int found_whitespace = 0;
|
||||||
|
@ -3439,7 +3439,7 @@ int str_utf8_decode(const char **ptr)
|
||||||
int utf8_code_point = 0;
|
int utf8_code_point = 0;
|
||||||
int utf8_bytes_seen = 0;
|
int utf8_bytes_seen = 0;
|
||||||
int utf8_bytes_needed = 0;
|
int utf8_bytes_needed = 0;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
unsigned char byte = str_byte_next(ptr);
|
unsigned char byte = str_byte_next(ptr);
|
||||||
if(utf8_bytes_needed == 0)
|
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);
|
unsigned int mask = find_next_power_of_two_minus_one(below);
|
||||||
dbg_assert(below > 0, "below must be positive");
|
dbg_assert(below > 0, "below must be positive");
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
secure_random_fill(&n, sizeof(n));
|
secure_random_fill(&n, sizeof(n));
|
||||||
|
@ -4054,7 +4054,7 @@ int os_version_str(char *version, int length)
|
||||||
*newline = 0;
|
*newline = 0;
|
||||||
}
|
}
|
||||||
str_format(extra, sizeof(extra), "; %s", buf + offset + 12);
|
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);
|
str_format(version, length, "%s %s (%s, %s)%s", u.sysname, u.release, u.machine, u.version, extra);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -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(&skel1, str1);
|
||||||
str_utf8_skeleton_begin(&skel2, str2);
|
str_utf8_skeleton_begin(&skel2, str2);
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
int ch1 = str_utf8_skeleton_next(&skel1);
|
int ch1 = str_utf8_skeleton_next(&skel1);
|
||||||
int ch2 = str_utf8_skeleton_next(&skel2);
|
int ch2 = str_utf8_skeleton_next(&skel2);
|
||||||
|
|
|
@ -72,7 +72,7 @@ void CGLSLProgram::DetachAllShaders()
|
||||||
{
|
{
|
||||||
TWGLuint aShaders[100];
|
TWGLuint aShaders[100];
|
||||||
GLsizei ReturnedCount = 0;
|
GLsizei ReturnedCount = 0;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
glGetAttachedShaders(m_ProgramID, 100, &ReturnedCount, aShaders);
|
glGetAttachedShaders(m_ProgramID, 100, &ReturnedCount, aShaders);
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ CClient::CClient() :
|
||||||
|
|
||||||
m_CurrentInput[0] = 0;
|
m_CurrentInput[0] = 0;
|
||||||
m_CurrentInput[1] = 0;
|
m_CurrentInput[1] = 0;
|
||||||
m_LastDummy = 0;
|
m_LastDummy = false;
|
||||||
|
|
||||||
mem_zero(&m_aInputs, sizeof(m_aInputs));
|
mem_zero(&m_aInputs, sizeof(m_aInputs));
|
||||||
|
|
||||||
|
@ -2518,7 +2518,7 @@ void CClient::Update()
|
||||||
{
|
{
|
||||||
// switch dummy snapshot
|
// switch dummy snapshot
|
||||||
int64_t Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get());
|
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];
|
CSnapshotStorage::CHolder *pCur = m_aSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT];
|
||||||
int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
|
int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
|
||||||
|
@ -2557,7 +2557,7 @@ void CClient::Update()
|
||||||
Repredict = 1;
|
Repredict = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
CSnapshotStorage::CHolder *pCur = m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT];
|
CSnapshotStorage::CHolder *pCur = m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT];
|
||||||
int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
|
int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
|
||||||
|
@ -2979,7 +2979,7 @@ void CClient::Run()
|
||||||
int64_t LastTime = time_get_microseconds();
|
int64_t LastTime = time_get_microseconds();
|
||||||
int64_t LastRenderTime = time_get();
|
int64_t LastRenderTime = time_get();
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
set_new_tick();
|
set_new_tick();
|
||||||
|
|
||||||
|
|
|
@ -1194,7 +1194,7 @@ void CServerBrowser::Update(bool ForceResort)
|
||||||
|
|
||||||
CServerEntry *pEntry = m_pFirstReqServer;
|
CServerEntry *pEntry = m_pFirstReqServer;
|
||||||
int Count = 0;
|
int Count = 0;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(!pEntry) // no more entries
|
if(!pEntry) // no more entries
|
||||||
break;
|
break;
|
||||||
|
@ -1223,7 +1223,7 @@ void CServerBrowser::Update(bool ForceResort)
|
||||||
{
|
{
|
||||||
//reset old ones
|
//reset old ones
|
||||||
pEntry = m_pFirstReqServer;
|
pEntry = m_pFirstReqServer;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(!pEntry) // no more entries
|
if(!pEntry) // no more entries
|
||||||
break;
|
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
|
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;
|
pEntry = m_pFirstReqServer;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(!pEntry) // no more entries
|
if(!pEntry) // no more entries
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -264,7 +264,7 @@ class CTextRender : public IEngineTextRender
|
||||||
int WordLength(const char *pText)
|
int WordLength(const char *pText)
|
||||||
{
|
{
|
||||||
const char *pCursor = pText;
|
const char *pCursor = pText;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(*pCursor == 0)
|
if(*pCursor == 0)
|
||||||
return pCursor - pText;
|
return pCursor - pText;
|
||||||
|
|
|
@ -132,7 +132,7 @@ void CDbConnectionPool::Worker()
|
||||||
// enter fail mode when a sql request fails, skip read request during it and
|
// enter fail mode when a sql request fails, skip read request during it and
|
||||||
// write to the backup database until all requests are handled
|
// write to the backup database until all requests are handled
|
||||||
bool FailMode = false;
|
bool FailMode = false;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(FailMode && m_NumElem.GetApproximateValue() == 0)
|
if(FailMode && m_NumElem.GetApproximateValue() == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,7 +159,7 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat)
|
||||||
|
|
||||||
pStr = pResult->m_pArgsStart;
|
pStr = pResult->m_pArgsStart;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(!Command)
|
if(!Command)
|
||||||
break;
|
break;
|
||||||
|
@ -198,7 +198,7 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat)
|
||||||
pResult->AddArgument(pStr);
|
pResult->AddArgument(pStr);
|
||||||
|
|
||||||
pDst = pStr; // we might have to process escape data
|
pDst = pStr; // we might have to process escape data
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(pStr[0] == '"')
|
if(pStr[0] == '"')
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -126,7 +126,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
|
||||||
sha256_init(&Sha256Ctxt);
|
sha256_init(&Sha256Ctxt);
|
||||||
unsigned char aBuffer[BUFFER_SIZE];
|
unsigned char aBuffer[BUFFER_SIZE];
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
unsigned Bytes = io_read(File, aBuffer, BUFFER_SIZE);
|
unsigned Bytes = io_read(File, aBuffer, BUFFER_SIZE);
|
||||||
if(Bytes <= 0)
|
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)))
|
if(sizeof(Header) != io_read(File, &Header, sizeof(Header)))
|
||||||
{
|
{
|
||||||
dbg_msg("datafile", "couldn't load 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] != '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')
|
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]);
|
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)
|
if(Header.m_Version != 3 && Header.m_Version != 4)
|
||||||
{
|
{
|
||||||
dbg_msg("datafile", "wrong version. version=%x", Header.m_Version);
|
dbg_msg("datafile", "wrong version. version=%x", Header.m_Version);
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read in the rest except the data
|
// read in the rest except the data
|
||||||
|
|
|
@ -152,7 +152,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// write map data
|
// write map data
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
unsigned char aChunk[1024 * 64];
|
unsigned char aChunk[1024 * 64];
|
||||||
int Bytes = io_read(MapFile, &aChunk, sizeof(aChunk));
|
int Bytes = io_read(MapFile, &aChunk, sizeof(aChunk));
|
||||||
|
@ -487,7 +487,7 @@ void CDemoPlayer::ScanFile()
|
||||||
StartPos = io_tell(m_File);
|
StartPos = io_tell(m_File);
|
||||||
m_Info.m_SeekablePoints = 0;
|
m_Info.m_SeekablePoints = 0;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
long CurrentPos = io_tell(m_File);
|
long CurrentPos = io_tell(m_File);
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ void CDemoPlayer::DoTick()
|
||||||
if(m_UpdateIntraTimesFunc)
|
if(m_UpdateIntraTimesFunc)
|
||||||
m_UpdateIntraTimesFunc();
|
m_UpdateIntraTimesFunc();
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(ReadChunkHeader(&ChunkType, &ChunkSize, &ChunkTick))
|
if(ReadChunkHeader(&ChunkType, &ChunkSize, &ChunkTick))
|
||||||
{
|
{
|
||||||
|
@ -672,7 +672,7 @@ void CDemoPlayer::DoTick()
|
||||||
|
|
||||||
void CDemoPlayer::Pause()
|
void CDemoPlayer::Pause()
|
||||||
{
|
{
|
||||||
m_Info.m_Info.m_Paused = 1;
|
m_Info.m_Info.m_Paused = true;
|
||||||
#if defined(CONF_VIDEORECORDER)
|
#if defined(CONF_VIDEORECORDER)
|
||||||
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
|
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
|
||||||
IVideo::Current()->Pause(true);
|
IVideo::Current()->Pause(true);
|
||||||
|
@ -685,7 +685,7 @@ void CDemoPlayer::Unpause()
|
||||||
{
|
{
|
||||||
/*m_Info.start_tick = m_Info.current_tick;
|
/*m_Info.start_tick = m_Info.current_tick;
|
||||||
m_Info.start_time = time_get();*/
|
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 defined(CONF_VIDEORECORDER)
|
||||||
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
|
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
|
||||||
|
@ -991,7 +991,7 @@ int CDemoPlayer::Update(bool RealTime)
|
||||||
int64_t Freq = time_freq();
|
int64_t Freq = time_freq();
|
||||||
m_Info.m_CurrentTime += (int64_t)(Deltatime * (double)m_Info.m_Info.m_Speed);
|
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;
|
int64_t CurtickStart = (m_Info.m_Info.m_CurrentTick) * Freq / SERVER_TICK_SPEED;
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ int CHuffman::Decompress(const void *pInput, int InputSize, void *pOutput, int O
|
||||||
CNode *pEof = &m_aNodes[HUFFMAN_EOF_SYMBOL];
|
CNode *pEof = &m_aNodes[HUFFMAN_EOF_SYMBOL];
|
||||||
CNode *pNode = 0;
|
CNode *pNode = 0;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
// {A} try to load a node now, this will reduce dependency at location {D}
|
// {A} try to load a node now, this will reduce dependency at location {D}
|
||||||
pNode = 0;
|
pNode = 0;
|
||||||
|
@ -246,7 +246,7 @@ int CHuffman::Decompress(const void *pInput, int InputSize, void *pOutput, int O
|
||||||
Bitcount -= HUFFMAN_LUTBITS;
|
Bitcount -= HUFFMAN_LUTBITS;
|
||||||
|
|
||||||
// walk the tree bit by bit
|
// walk the tree bit by bit
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
// traverse tree
|
// traverse tree
|
||||||
pNode = &m_aNodes[pNode->m_aLeafs[Bits & 1]];
|
pNode = &m_aNodes[pNode->m_aLeafs[Bits & 1]];
|
||||||
|
|
|
@ -15,7 +15,7 @@ char *CLineReader::Get()
|
||||||
unsigned LineStart = m_BufferPos;
|
unsigned LineStart = m_BufferPos;
|
||||||
bool CRLFBreak = false;
|
bool CRLFBreak = false;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(m_BufferPos >= m_BufferSize)
|
if(m_BufferPos >= m_BufferSize)
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,7 @@ public:
|
||||||
|
|
||||||
CLineReader LineReader;
|
CLineReader LineReader;
|
||||||
LineReader.Init(File);
|
LineReader.Init(File);
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
CMasterInfo Info = {{0}};
|
CMasterInfo Info = {{0}};
|
||||||
const char *pLine = LineReader.Get();
|
const char *pLine = LineReader.Get();
|
||||||
|
|
|
@ -26,7 +26,7 @@ int CNetRecvUnpacker::FetchChunk(CNetChunk *pChunk)
|
||||||
CNetChunkHeader Header;
|
CNetChunkHeader Header;
|
||||||
unsigned char *pEnd = m_Data.m_aChunkData + m_Data.m_DataSize;
|
unsigned char *pEnd = m_Data.m_aChunkData + m_Data.m_DataSize;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
unsigned char *pData = m_Data.m_aChunkData;
|
unsigned char *pData = m_Data.m_aChunkData;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ int CNetClient::ResetErrorString()
|
||||||
|
|
||||||
int CNetClient::Recv(CNetChunk *pChunk)
|
int CNetClient::Recv(CNetChunk *pChunk)
|
||||||
{
|
{
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
// check for a chunk
|
// check for a chunk
|
||||||
if(m_RecvUnpacker.FetchChunk(pChunk))
|
if(m_RecvUnpacker.FetchChunk(pChunk))
|
||||||
|
|
|
@ -68,7 +68,7 @@ void CNetConnection::Init(NETSOCKET Socket, bool BlockCloseMsg)
|
||||||
|
|
||||||
void CNetConnection::AckChunks(int Ack)
|
void CNetConnection::AckChunks(int Ack)
|
||||||
{
|
{
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
CNetChunkResend *pResend = m_Buffer.First();
|
CNetChunkResend *pResend = m_Buffer.First();
|
||||||
if(!pResend)
|
if(!pResend)
|
||||||
|
|
|
@ -627,7 +627,7 @@ static bool IsDDNetControlMsg(const CNetPacketConstruct *pPacket)
|
||||||
*/
|
*/
|
||||||
int CNetServer::Recv(CNetChunk *pChunk, SECURITY_TOKEN *pResponseToken)
|
int CNetServer::Recv(CNetChunk *pChunk, SECURITY_TOKEN *pResponseToken)
|
||||||
{
|
{
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
NETADDR Addr;
|
NETADDR Addr;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ void *CRingBufferBase::Allocate(int Size)
|
||||||
if(WantedSize > m_Size)
|
if(WantedSize > m_Size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
// check for space
|
// check for space
|
||||||
if(m_pProduce->m_Free)
|
if(m_pProduce->m_Free)
|
||||||
|
@ -153,7 +153,7 @@ void *CRingBufferBase::Prev(void *pCurrent)
|
||||||
{
|
{
|
||||||
CItem *pItem = ((CItem *)pCurrent) - 1;
|
CItem *pItem = ((CItem *)pCurrent) - 1;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
pItem = PrevBlock(pItem);
|
pItem = PrevBlock(pItem);
|
||||||
if(pItem == m_pProduce)
|
if(pItem == m_pProduce)
|
||||||
|
@ -167,7 +167,7 @@ void *CRingBufferBase::Next(void *pCurrent)
|
||||||
{
|
{
|
||||||
CItem *pItem = ((CItem *)pCurrent) - 1;
|
CItem *pItem = ((CItem *)pCurrent) - 1;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
pItem = NextBlock(pItem);
|
pItem = NextBlock(pItem);
|
||||||
if(pItem == m_pProduce)
|
if(pItem == m_pProduce)
|
||||||
|
|
|
@ -67,7 +67,7 @@ int ParseUuid(CUuid *pUuid, const char *pBuffer)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
aCopy[8] = aCopy[13] = aCopy[18] = aCopy[23] = 0;
|
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 + 0, 4, aCopy + 0) ||
|
||||||
str_hex_decode(pUuid->m_aData + 4, 2, aCopy + 9) ||
|
str_hex_decode(pUuid->m_aData + 4, 2, aCopy + 9) ||
|
||||||
str_hex_decode(pUuid->m_aData + 6, 2, aCopy + 14) ||
|
str_hex_decode(pUuid->m_aData + 6, 2, aCopy + 14) ||
|
||||||
|
|
|
@ -1344,8 +1344,8 @@ void CGameClient::OnNewSnapshot()
|
||||||
}
|
}
|
||||||
else if(Item.m_Type == NETOBJTYPE_GAMEINFO)
|
else if(Item.m_Type == NETOBJTYPE_GAMEINFO)
|
||||||
{
|
{
|
||||||
static bool s_GameOver = 0;
|
static bool s_GameOver = false;
|
||||||
static bool s_GamePaused = 0;
|
static bool s_GamePaused = false;
|
||||||
m_Snap.m_pGameInfoObj = (const CNetObj_GameInfo *)pData;
|
m_Snap.m_pGameInfoObj = (const CNetObj_GameInfo *)pData;
|
||||||
bool CurrentTickGameOver = (bool)(m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER);
|
bool CurrentTickGameOver = (bool)(m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER);
|
||||||
if(!s_GameOver && CurrentTickGameOver)
|
if(!s_GameOver && CurrentTickGameOver)
|
||||||
|
@ -1813,7 +1813,7 @@ void CGameClient::OnPredict()
|
||||||
|
|
||||||
// detect mispredictions of other players and make corrections smoother when possible
|
// detect mispredictions of other players and make corrections smoother when possible
|
||||||
static vec2 s_aLastPos[MAX_CLIENTS] = {{0, 0}};
|
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)
|
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()
|
bool CGameClient::IsLocalCharSuper()
|
||||||
{
|
{
|
||||||
if(m_Snap.m_LocalClientID < 0)
|
if(m_Snap.m_LocalClientID < 0)
|
||||||
return 0;
|
return false;
|
||||||
return m_aClients[m_Snap.m_LocalClientID].m_Super;
|
return m_aClients[m_Snap.m_LocalClientID].m_Super;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,8 +369,8 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos, //Pos
|
ProjStartPos, //Pos
|
||||||
Direction, //Dir
|
Direction, //Dir
|
||||||
Lifetime, //Span
|
Lifetime, //Span
|
||||||
0, //Freeze
|
false, //Freeze
|
||||||
0, //Explosive
|
false, //Explosive
|
||||||
0, //Force
|
0, //Force
|
||||||
-1 //SoundImpact
|
-1 //SoundImpact
|
||||||
);
|
);
|
||||||
|
@ -397,8 +397,8 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos, //Pos
|
ProjStartPos, //Pos
|
||||||
vec2(cosf(a), sinf(a)) * Speed, //Dir
|
vec2(cosf(a), sinf(a)) * Speed, //Dir
|
||||||
(int)(GameWorld()->GameTickSpeed() * Tuning()->m_ShotgunLifetime), //Span
|
(int)(GameWorld()->GameTickSpeed() * Tuning()->m_ShotgunLifetime), //Span
|
||||||
0, //Freeze
|
false, //Freeze
|
||||||
0, //Explosive
|
false, //Explosive
|
||||||
0, //Force
|
0, //Force
|
||||||
-1 //SoundImpact
|
-1 //SoundImpact
|
||||||
);
|
);
|
||||||
|
@ -424,7 +424,7 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos, //Pos
|
ProjStartPos, //Pos
|
||||||
Direction, //Dir
|
Direction, //Dir
|
||||||
Lifetime, //Span
|
Lifetime, //Span
|
||||||
0, //Freeze
|
false, //Freeze
|
||||||
true, //Explosive
|
true, //Explosive
|
||||||
0, //Force
|
0, //Force
|
||||||
SOUND_GRENADE_EXPLODE //SoundImpact
|
SOUND_GRENADE_EXPLODE //SoundImpact
|
||||||
|
@ -1064,7 +1064,7 @@ CCharacter::CCharacter(CGameWorld *pGameWorld, int ID, CNetObj_Character *pChar,
|
||||||
mem_zero(&m_SavedInput, sizeof(m_SavedInput));
|
mem_zero(&m_SavedInput, sizeof(m_SavedInput));
|
||||||
m_LatestInput = m_LatestPrevInput = m_PrevInput = m_Input = m_SavedInput;
|
m_LatestInput = m_LatestPrevInput = m_PrevInput = m_Input = m_SavedInput;
|
||||||
m_ProximityRadius = ms_PhysSize;
|
m_ProximityRadius = ms_PhysSize;
|
||||||
m_Core.m_LeftWall = 1;
|
m_Core.m_LeftWall = true;
|
||||||
m_ReloadTimer = 0;
|
m_ReloadTimer = 0;
|
||||||
m_NumObjectsHit = 0;
|
m_NumObjectsHit = 0;
|
||||||
m_LastRefillJumps = false;
|
m_LastRefillJumps = false;
|
||||||
|
@ -1101,8 +1101,8 @@ void CCharacter::ResetPrediction()
|
||||||
m_NumInputs = 0;
|
m_NumInputs = 0;
|
||||||
m_FreezeTime = 0;
|
m_FreezeTime = 0;
|
||||||
m_FreezeTick = 0;
|
m_FreezeTick = 0;
|
||||||
m_DeepFreeze = 0;
|
m_DeepFreeze = false;
|
||||||
m_LiveFreeze = 0;
|
m_LiveFreeze = false;
|
||||||
m_FrozenLastTick = false;
|
m_FrozenLastTick = false;
|
||||||
m_Super = false;
|
m_Super = false;
|
||||||
for(int w = 0; w < NUM_WEAPONS; w++)
|
for(int w = 0; w < NUM_WEAPONS; w++)
|
||||||
|
|
|
@ -173,7 +173,7 @@ CProjectile::CProjectile(CGameWorld *pGameWorld, int ID, CProjectileData *pProj,
|
||||||
{
|
{
|
||||||
m_Owner = -1;
|
m_Owner = -1;
|
||||||
m_Bouncing = 0;
|
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_Explosive = (pProj->m_Type == WEAPON_GRENADE) && (fabs(1.0f - length(m_Direction)) < 0.015f);
|
||||||
}
|
}
|
||||||
m_Type = pProj->m_Type;
|
m_Type = pProj->m_Type;
|
||||||
|
|
|
@ -484,8 +484,8 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos, //Pos
|
ProjStartPos, //Pos
|
||||||
Direction, //Dir
|
Direction, //Dir
|
||||||
Lifetime, //Span
|
Lifetime, //Span
|
||||||
0, //Freeze
|
false, //Freeze
|
||||||
0, //Explosive
|
false, //Explosive
|
||||||
0, //Force
|
0, //Force
|
||||||
-1 //SoundImpact
|
-1 //SoundImpact
|
||||||
);
|
);
|
||||||
|
@ -541,7 +541,7 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos, //Pos
|
ProjStartPos, //Pos
|
||||||
Direction, //Dir
|
Direction, //Dir
|
||||||
Lifetime, //Span
|
Lifetime, //Span
|
||||||
0, //Freeze
|
false, //Freeze
|
||||||
true, //Explosive
|
true, //Explosive
|
||||||
0, //Force
|
0, //Force
|
||||||
SOUND_GRENADE_EXPLODE //SoundImpact
|
SOUND_GRENADE_EXPLODE //SoundImpact
|
||||||
|
|
|
@ -3872,7 +3872,7 @@ void CGameContext::Whisper(int ClientID, char *pStr)
|
||||||
|
|
||||||
pName = pStr;
|
pName = pStr;
|
||||||
char *pDst = pStr; // we might have to process escape data
|
char *pDst = pStr; // we might have to process escape data
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(pStr[0] == '"')
|
if(pStr[0] == '"')
|
||||||
{
|
{
|
||||||
|
@ -3911,7 +3911,7 @@ void CGameContext::Whisper(int ClientID, char *pStr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pName = pStr;
|
pName = pStr;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
if(pStr[0] == 0)
|
if(pStr[0] == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,7 @@ void CPlayer::Reset()
|
||||||
m_ShowOthers = g_Config.m_SvShowOthersDefault;
|
m_ShowOthers = g_Config.m_SvShowOthersDefault;
|
||||||
m_ShowAll = g_Config.m_SvShowAllDefault;
|
m_ShowAll = g_Config.m_SvShowAllDefault;
|
||||||
m_ShowDistance = vec2(1200, 800);
|
m_ShowDistance = vec2(1200, 800);
|
||||||
m_SpecTeam = 0;
|
m_SpecTeam = false;
|
||||||
m_NinjaJetpack = false;
|
m_NinjaJetpack = false;
|
||||||
|
|
||||||
m_Paused = PAUSE_NONE;
|
m_Paused = PAUSE_NONE;
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Run(unsigned short Port, NETADDR Dest)
|
||||||
MMSGS m;
|
MMSGS m;
|
||||||
net_init_mmsgs(&m);
|
net_init_mmsgs(&m);
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
static int Lastcfg = 0;
|
static int Lastcfg = 0;
|
||||||
int n = ((time_get() / time_freq()) / m_ConfigInterval) % m_ConfigNumpingconfs;
|
int n = ((time_get() / time_freq()) / m_ConfigInterval) % m_ConfigNumpingconfs;
|
||||||
|
@ -64,7 +64,7 @@ void Run(unsigned short Port, NETADDR Dest)
|
||||||
Lastcfg = n;
|
Lastcfg = n;
|
||||||
|
|
||||||
// handle incoming packets
|
// handle incoming packets
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
// fetch data
|
// fetch data
|
||||||
int DataTrash = 0;
|
int DataTrash = 0;
|
||||||
|
@ -142,7 +142,7 @@ void Run(unsigned short Port, NETADDR Dest)
|
||||||
{*/
|
{*/
|
||||||
CPacket *p = 0;
|
CPacket *p = 0;
|
||||||
CPacket *pNext = m_pFirst;
|
CPacket *pNext = m_pFirst;
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
p = pNext;
|
p = pNext;
|
||||||
if(!p)
|
if(!p)
|
||||||
|
|
|
@ -116,7 +116,7 @@ static int Run()
|
||||||
if(!pNet->Open(BindAddr, 0, 0, 0, 0))
|
if(!pNet->Open(BindAddr, 0, 0, 0, 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
CNetChunk p;
|
CNetChunk p;
|
||||||
pNet->Update();
|
pNet->Update();
|
||||||
|
|
|
@ -17,7 +17,7 @@ void Run(NETADDR Dest)
|
||||||
Socket = net_udp_create(BindAddr);
|
Socket = net_udp_create(BindAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1)
|
while(true)
|
||||||
{
|
{
|
||||||
unsigned char aData[1024];
|
unsigned char aData[1024];
|
||||||
int Size = 0;
|
int Size = 0;
|
||||||
|
|
Loading…
Reference in a new issue