mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Implement changes suggested by -Wuseless-cast
But don't enable it yet because I'm not sure what the best way is.
This commit is contained in:
parent
279eeed9fc
commit
cde07b420b
|
@ -172,7 +172,8 @@ if(NOT MSVC)
|
|||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wduplicated-branches)
|
||||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wlogical-op)
|
||||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wrestrict)
|
||||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wuseless-cast)
|
||||
# TODO: Enable for C++ code except gtest
|
||||
#add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN "-Wuseless-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
|
|
@ -558,14 +558,14 @@ void CCommandProcessorFragment_OpenGL3_3::SetState(const CCommandBuffer::SState
|
|||
{
|
||||
if(pProgram->m_LastIsTextured != 1)
|
||||
{
|
||||
pProgram->SetUniform(pProgram->m_LocIsTextured, (int)1);
|
||||
pProgram->SetUniform(pProgram->m_LocIsTextured, 1);
|
||||
pProgram->m_LastIsTextured = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(pProgram->m_LastTextureSampler != Slot)
|
||||
{
|
||||
pProgram->SetUniform(pProgram->m_LocTextureSampler, (int)Slot);
|
||||
pProgram->SetUniform(pProgram->m_LocTextureSampler, Slot);
|
||||
pProgram->m_LastTextureSampler = Slot;
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ void CCommandProcessorFragment_OpenGL3_3::SetState(const CCommandBuffer::SState
|
|||
{
|
||||
if(pProgram->m_LastIsTextured != 0)
|
||||
{
|
||||
pProgram->SetUniform(pProgram->m_LocIsTextured, (int)0);
|
||||
pProgram->SetUniform(pProgram->m_LocIsTextured, 0);
|
||||
pProgram->m_LastIsTextured = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1204,7 +1204,7 @@ void CCommandProcessorFragment_OpenGL3_3::UploadStreamBufferData(unsigned int Pr
|
|||
glBindBuffer(GL_ARRAY_BUFFER, m_PrimitiveDrawBufferID[m_LastStreamBuffer]);
|
||||
|
||||
if(!m_UsePreinitializedVertexBuffer)
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(CCommandBuffer::SVertex) * Count, (const void*)pVertices, GL_STREAM_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(CCommandBuffer::SVertex) * Count, pVertices, GL_STREAM_DRAW);
|
||||
else
|
||||
{
|
||||
// This is better for some iGPUs. Probably due to not initializing a new buffer in the system memory again and again...(driver dependent)
|
||||
|
@ -1738,7 +1738,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadLayer(const CCommandBuff
|
|||
float Rotation = pCommand->m_pQuadInfo[0].m_Rotation;
|
||||
pProgram->SetUniformVec4(pProgram->m_LocColor, 1, (float*)aColor);
|
||||
pProgram->SetUniformVec2(pProgram->m_LocOffset, 1, (float*)aOffset);
|
||||
pProgram->SetUniform(pProgram->m_LocRotation, (float)Rotation);
|
||||
pProgram->SetUniform(pProgram->m_LocRotation, Rotation);
|
||||
|
||||
for(int i = 0; i < pCommand->m_QuadNum; ++i)
|
||||
{
|
||||
|
@ -1755,7 +1755,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadLayer(const CCommandBuff
|
|||
if(Rotation != pCommand->m_pQuadInfo[i].m_Rotation)
|
||||
{
|
||||
Rotation = pCommand->m_pQuadInfo[i].m_Rotation;
|
||||
pProgram->SetUniform(pProgram->m_LocRotation, (float)Rotation);
|
||||
pProgram->SetUniform(pProgram->m_LocRotation, Rotation);
|
||||
}
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, (void*)(i * 6 * sizeof(unsigned int)));
|
||||
}
|
||||
|
@ -1807,13 +1807,13 @@ void CCommandProcessorFragment_OpenGL3_3::RenderText(const CCommandBuffer::SStat
|
|||
|
||||
if(m_pTextProgram->m_LastTextSampler != SlotText)
|
||||
{
|
||||
m_pTextProgram->SetUniform(m_pTextProgram->m_LocTextSampler, (int)SlotText);
|
||||
m_pTextProgram->SetUniform(m_pTextProgram->m_LocTextSampler, SlotText);
|
||||
m_pTextProgram->m_LastTextSampler = SlotText;
|
||||
}
|
||||
|
||||
if(m_pTextProgram->m_LastTextOutlineSampler != SlotTextOutline)
|
||||
{
|
||||
m_pTextProgram->SetUniform(m_pTextProgram->m_LocTextOutlineSampler, (int)SlotTextOutline);
|
||||
m_pTextProgram->SetUniform(m_pTextProgram->m_LocTextOutlineSampler, SlotTextOutline);
|
||||
m_pTextProgram->m_LastTextOutlineSampler = SlotTextOutline;
|
||||
}
|
||||
|
||||
|
|
|
@ -2752,7 +2752,7 @@ void CClient::Run()
|
|||
m_pGraphics = CreateEngineGraphicsThreaded();
|
||||
|
||||
bool RegisterFail = false;
|
||||
RegisterFail = RegisterFail || !Kernel()->RegisterInterface(static_cast<IEngineGraphics*>(m_pGraphics)); // register graphics as both
|
||||
RegisterFail = RegisterFail || !Kernel()->RegisterInterface(m_pGraphics); // IEngineGraphics
|
||||
RegisterFail = RegisterFail || !Kernel()->RegisterInterface(static_cast<IGraphics*>(m_pGraphics), false);
|
||||
|
||||
if(RegisterFail || m_pGraphics->Init() != 0)
|
||||
|
@ -3714,19 +3714,19 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pConsole);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pConfig);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineSound*>(pEngineSound)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineSound); // IEngineSound
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<ISound*>(pEngineSound), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineInput*>(pEngineInput)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineInput); // IEngineInput
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IInput*>(pEngineInput), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineTextRender*>(pEngineTextRender)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineTextRender); // IEngineTextRender
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<ITextRender*>(pEngineTextRender), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineMap*>(pEngineMap)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineMap); // IEngineMap
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMap*>(pEngineMap), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineMasterServer*>(pEngineMasterServer)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineMasterServer); // IEngineMasterServer
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMasterServer*>(pEngineMasterServer), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateEditor(), false);
|
||||
|
|
|
@ -192,7 +192,7 @@ void CGraphics_Threaded::Rotate(const CCommandBuffer::SPoint &rCenter, CCommandB
|
|||
float x, y;
|
||||
int i;
|
||||
|
||||
CCommandBuffer::SVertex *pVertices = (CCommandBuffer::SVertex*) pPoints;
|
||||
CCommandBuffer::SVertex *pVertices = pPoints;
|
||||
for(i = 0; i < NumPoints; i++)
|
||||
{
|
||||
x = pVertices[i].m_Pos.x - rCenter.x;
|
||||
|
@ -755,7 +755,7 @@ void CGraphics_Threaded::ChangeColorOfQuadVertices(int QuadOffset, unsigned char
|
|||
|
||||
void CGraphics_Threaded::SetColor(CCommandBuffer::SVertex *pVertex, int ColorIndex)
|
||||
{
|
||||
CCommandBuffer::SVertex *pVert = (CCommandBuffer::SVertex*)pVertex;
|
||||
CCommandBuffer::SVertex *pVert = pVertex;
|
||||
pVert->m_Color.r = m_aColor[ColorIndex].r;
|
||||
pVert->m_Color.g = m_aColor[ColorIndex].g;
|
||||
pVert->m_Color.b = m_aColor[ColorIndex].b;
|
||||
|
|
|
@ -311,7 +311,7 @@ CPostJson::CPostJson(const char *pUrl, bool CanTimeout, const char *pJson)
|
|||
|
||||
bool CPostJson::AfterInit(void *pCurl)
|
||||
{
|
||||
CURL *pHandle = (CURL *)pCurl;
|
||||
CURL *pHandle = pCurl;
|
||||
|
||||
curl_slist *pHeaders = NULL;
|
||||
pHeaders = curl_slist_append(pHeaders, "Content-Type: application/json");
|
||||
|
|
|
@ -899,7 +899,7 @@ public:
|
|||
Cutter.m_Flags &= ~TEXTFLAG_RENDER;
|
||||
Cutter.m_Flags |= TEXTFLAG_STOP_AT_END;
|
||||
|
||||
TextEx(&Cutter, (const char *)pCurrent, Wlen);
|
||||
TextEx(&Cutter, pCurrent, Wlen);
|
||||
Wlen = Cutter.m_CharCount;
|
||||
NewLine = 1;
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ public:
|
|||
Cutter.m_Flags &= ~TEXTFLAG_RENDER;
|
||||
Cutter.m_Flags |= TEXTFLAG_STOP_AT_END;
|
||||
|
||||
TextEx(&Cutter, (const char *)pCurrent, Wlen);
|
||||
TextEx(&Cutter, pCurrent, Wlen);
|
||||
Wlen = Cutter.m_CharCount;
|
||||
NewLine = 1;
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ public:
|
|||
Cutter.m_Flags &= ~TEXTFLAG_RENDER;
|
||||
Cutter.m_Flags |= TEXTFLAG_STOP_AT_END;
|
||||
|
||||
TextEx(&Cutter, (const char *)pCurrent, Wlen);
|
||||
TextEx(&Cutter, pCurrent, Wlen);
|
||||
Wlen = Cutter.m_CharCount;
|
||||
NewLine = 1;
|
||||
|
||||
|
@ -1791,7 +1791,7 @@ public:
|
|||
int MaxSizeWidth = (MaxWidth - WidthLastChars);
|
||||
if(MaxSizeWidth > 0)
|
||||
{
|
||||
int SlotW = ((((unsigned int)MaxSizeWidth) < (unsigned int)pBitmap->width) ? MaxSizeWidth : pBitmap->width);
|
||||
int SlotW = ((((unsigned int)MaxSizeWidth) < pBitmap->width) ? MaxSizeWidth : pBitmap->width);
|
||||
int SlotH = pBitmap->rows;
|
||||
int SlotSize = SlotW*SlotH;
|
||||
|
||||
|
|
|
@ -2973,13 +2973,13 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pServer);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngine);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineMap*>(pEngineMap)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineMap); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMap*>(pEngineMap), false);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pGameServer);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pConsole);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pStorage);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pConfig);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineMasterServer*>(pEngineMasterServer)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngineMasterServer); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMasterServer*>(pEngineMasterServer), false);
|
||||
|
||||
if(RegisterFail)
|
||||
|
@ -3078,7 +3078,7 @@ const char *CServer::GetAnnouncementLine(char const *pFileName)
|
|||
|
||||
int *CServer::GetIdMap(int ClientID)
|
||||
{
|
||||
return (int *)(IdMap + VANILLA_MAX_CLIENTS * ClientID);
|
||||
return IdMap + VANILLA_MAX_CLIENTS * ClientID;
|
||||
}
|
||||
|
||||
bool CServer::SetTimedOut(int ClientID, int OrigID)
|
||||
|
|
|
@ -73,7 +73,7 @@ long CVariableInt::Decompress(const void *pSrc_, int Size, void *pDst_, int DstS
|
|||
pSrc = CVariableInt::Unpack(pSrc, pDst);
|
||||
pDst++;
|
||||
}
|
||||
return (long)((unsigned char *)pDst-(unsigned char *)pDst_);
|
||||
return (unsigned char *)pDst-(unsigned char *)pDst_;
|
||||
}
|
||||
|
||||
long CVariableInt::Compress(const void *pSrc_, int Size, void *pDst_, int DstSize)
|
||||
|
@ -90,5 +90,5 @@ long CVariableInt::Compress(const void *pSrc_, int Size, void *pDst_, int DstSiz
|
|||
Size--;
|
||||
pSrc++;
|
||||
}
|
||||
return (long)(pDst-(unsigned char *)pDst_);
|
||||
return pDst-(unsigned char *)pDst_;
|
||||
}
|
||||
|
|
|
@ -233,8 +233,8 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
|
|||
|
||||
m_pDataFile->m_Info.m_pItemTypes = (CDatafileItemType *)m_pDataFile->m_pData;
|
||||
m_pDataFile->m_Info.m_pItemOffsets = (int *)&m_pDataFile->m_Info.m_pItemTypes[m_pDataFile->m_Header.m_NumItemTypes];
|
||||
m_pDataFile->m_Info.m_pDataOffsets = (int *)&m_pDataFile->m_Info.m_pItemOffsets[m_pDataFile->m_Header.m_NumItems];
|
||||
m_pDataFile->m_Info.m_pDataSizes = (int *)&m_pDataFile->m_Info.m_pDataOffsets[m_pDataFile->m_Header.m_NumRawData];
|
||||
m_pDataFile->m_Info.m_pDataOffsets = &m_pDataFile->m_Info.m_pItemOffsets[m_pDataFile->m_Header.m_NumItems];
|
||||
m_pDataFile->m_Info.m_pDataSizes = &m_pDataFile->m_Info.m_pDataOffsets[m_pDataFile->m_Header.m_NumRawData];
|
||||
|
||||
if(Header.m_Version == 4)
|
||||
m_pDataFile->m_Info.m_pItemStart = (char *)&m_pDataFile->m_Info.m_pDataSizes[m_pDataFile->m_Header.m_NumRawData];
|
||||
|
|
|
@ -13,7 +13,7 @@ class CJobPool;
|
|||
|
||||
class IJob
|
||||
{
|
||||
friend CJobPool;
|
||||
friend class CJobPool;
|
||||
|
||||
private:
|
||||
std::shared_ptr<IJob> m_pNext;
|
||||
|
|
|
@ -294,8 +294,8 @@ void CNetServer::SendMsgs(NETADDR &Addr, const CMsgPacker *Msgs[], int num)
|
|||
Header.m_Sequence = i+1;
|
||||
pChunkData = Header.Pack(pChunkData);
|
||||
mem_copy(pChunkData, pMsg->Data(), pMsg->Size());
|
||||
*((unsigned char*)pChunkData) <<= 1;
|
||||
*((unsigned char*)pChunkData) |= 1;
|
||||
*pChunkData <<= 1;
|
||||
*pChunkData |= 1;
|
||||
pChunkData += pMsg->Size();
|
||||
m_Construct.m_NumChunks++;
|
||||
}
|
||||
|
@ -417,8 +417,8 @@ void CNetServer::OnPreConnMsg(NETADDR &Addr, CNetPacketConstruct &Packet)
|
|||
|
||||
CMsgPacker SnapEmptyMsg(NETMSG_SNAPEMPTY);
|
||||
SECURITY_TOKEN SecurityToken = GetVanillaToken(Addr);
|
||||
SnapEmptyMsg.AddInt((int)SecurityToken);
|
||||
SnapEmptyMsg.AddInt((int)SecurityToken + 1);
|
||||
SnapEmptyMsg.AddInt(SecurityToken);
|
||||
SnapEmptyMsg.AddInt(SecurityToken + 1);
|
||||
|
||||
// send all chunks/msgs in one packet
|
||||
const CMsgPacker *Msgs[] = {&MapChangeMsg, &MapDataMsg, &ConReadyMsg,
|
||||
|
|
|
@ -246,7 +246,7 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
|
|||
if(m_aItemSizes[pCurItem->Type()])
|
||||
pItemDataDst = pData+2;
|
||||
|
||||
if(DiffItem((int*)pPastItem->Data(), (int*)pCurItem->Data(), pItemDataDst, ItemSize/4))
|
||||
if(DiffItem(pPastItem->Data(), pCurItem->Data(), pItemDataDst, ItemSize/4))
|
||||
{
|
||||
|
||||
*pData++ = pCurItem->Type();
|
||||
|
@ -385,7 +385,7 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
|
|||
if(FromIndex != -1)
|
||||
{
|
||||
// we got an update so we need pTo apply the diff
|
||||
UndiffItem((int *)pFrom->GetItem(FromIndex)->Data(), pData, pNewData, ItemSize/4);
|
||||
UndiffItem(pFrom->GetItem(FromIndex)->Data(), pData, pNewData, ItemSize/4);
|
||||
m_aSnapshotDataUpdates[m_SnapshotCurrent]++;
|
||||
}
|
||||
else // no previous, just copy the pData
|
||||
|
@ -542,7 +542,7 @@ int *CSnapshotBuilder::GetItemData(int Key)
|
|||
for(i = 0; i < m_NumItems; i++)
|
||||
{
|
||||
if(GetItem(i)->Key() == Key)
|
||||
return (int *)GetItem(i)->Data();
|
||||
return GetItem(i)->Data();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ CBackground::~CBackground()
|
|||
void CBackground::OnInit()
|
||||
{
|
||||
m_pImages->m_pClient = GameClient();
|
||||
Kernel()->ReregisterInterface(static_cast<IEngineMap*>(m_pMap));
|
||||
Kernel()->ReregisterInterface(m_pMap);
|
||||
if(g_Config.m_ClBackgroundEntities[0] != '\0' && str_comp(g_Config.m_ClBackgroundEntities, CURRENT))
|
||||
LoadBackground();
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ void CGameConsole::OnRender()
|
|||
float ConsoleMaxHeight = Screen.h*3/5.0f;
|
||||
float ConsoleHeight;
|
||||
|
||||
float Progress = (TimeNow()-(m_StateChangeEnd-m_StateChangeDuration))/float(m_StateChangeDuration);
|
||||
float Progress = (TimeNow()-(m_StateChangeEnd-m_StateChangeDuration))/m_StateChangeDuration;
|
||||
|
||||
if (Progress >= 1.0f)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ void CMapImages::OnInit()
|
|||
str_format(buff, 4, "%d", i);
|
||||
|
||||
float x = (i%16) * 64;
|
||||
float y = (int)(i/16)* 64;
|
||||
float y = (i/16) * 64;
|
||||
TextRender()->UploadEntityLayerText(m_OverlayBottomTexture, buff, -1, x+1, y + 12 + 32, 20, 64-1);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void CMapImages::OnInit()
|
|||
str_format(buff, 4, "%d", i);
|
||||
|
||||
float x = (i%16) * 64;
|
||||
float y = (int)(i/16)* 64;
|
||||
float y = (i/16) * 64;
|
||||
TextRender()->UploadEntityLayerText(m_OverlayTopTexture, buff, -1, x+1, y+1, 20, 64-1);
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void CMapImages::OnInit()
|
|||
int len = str_length(buff);
|
||||
|
||||
float x = (i%16) * 64;
|
||||
float y = (int)(i/16)* 64;
|
||||
float y = (i/16) * 64;
|
||||
|
||||
int MinSize = (len == 3 ? 20 : 50);
|
||||
int OffY = (len == 3 ? 10 : 5);
|
||||
|
|
|
@ -576,7 +576,7 @@ void CMapLayers::OnMapLoad()
|
|||
TileSize = sizeof(CTile);
|
||||
}
|
||||
unsigned int Size = m_pLayers->Map()->GetDataSize(DataIndex);
|
||||
void* pTiles = (void*)m_pLayers->Map()->GetData(DataIndex);
|
||||
void* pTiles = m_pLayers->Map()->GetData(DataIndex);
|
||||
|
||||
if(Size >= pTMap->m_Width*pTMap->m_Height*TileSize)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ class CMapLayers : public CComponent
|
|||
public:
|
||||
bool DoDraw()
|
||||
{
|
||||
return (bool)((m_IndexBufferByteOffset&0x00000001) != 0);
|
||||
return (m_IndexBufferByteOffset&0x00000001) != 0;
|
||||
}
|
||||
|
||||
void Draw(bool SetDraw)
|
||||
|
@ -70,7 +70,7 @@ class CMapLayers : public CComponent
|
|||
|
||||
void AddIndexBufferByteOffset(offset_ptr32 IndexBufferByteOff)
|
||||
{
|
||||
m_IndexBufferByteOffset = (((offset_ptr32)(m_IndexBufferByteOffset & 0xFFFFFFFE)) + IndexBufferByteOff) | (m_IndexBufferByteOffset & 0x00000001);
|
||||
m_IndexBufferByteOffset = ((m_IndexBufferByteOffset & 0xFFFFFFFE) + IndexBufferByteOff) | (m_IndexBufferByteOffset & 0x00000001);
|
||||
}
|
||||
};
|
||||
STileVisual* m_TilesOfLayer;
|
||||
|
|
|
@ -275,7 +275,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
else
|
||||
{
|
||||
static float PrevAmount = 0.0f;
|
||||
float Amount = (UI()->MouseX()-SeekBar.x)/(float)SeekBar.w;
|
||||
float Amount = (UI()->MouseX()-SeekBar.x)/SeekBar.w;
|
||||
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
{
|
||||
|
|
|
@ -730,7 +730,7 @@ void CPlayers::RenderPlayer(
|
|||
int Phase1Tick = (Client()->GameTick() - Player.m_AttackTick);
|
||||
if(Phase1Tick < (g_pData->m_Weapons.m_aId[iw].m_Muzzleduration + 3))
|
||||
{
|
||||
float t = ((((float)Phase1Tick) + IntraTick)/(float)g_pData->m_Weapons.m_aId[iw].m_Muzzleduration);
|
||||
float t = (((float)Phase1Tick) + IntraTick)/g_pData->m_Weapons.m_aId[iw].m_Muzzleduration;
|
||||
Alpha = mix(2.0f, 0.0f, min(1.0f,max(0.0f,t)));
|
||||
}
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
|
||||
if (rendered++ < 0) continue;
|
||||
|
||||
int DDTeam = ((CGameClient *) m_pClient)->m_Teams.Team(pInfo->m_ClientID);
|
||||
int DDTeam = m_pClient->m_Teams.Team(pInfo->m_ClientID);
|
||||
int NextDDTeam = 0;
|
||||
|
||||
for(int j = i + 1; j < MAX_CLIENTS; j++)
|
||||
|
@ -345,7 +345,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
if(!pInfo2 || pInfo2->m_Team != Team)
|
||||
continue;
|
||||
|
||||
NextDDTeam = ((CGameClient *) m_pClient)->m_Teams.Team(pInfo2->m_ClientID);
|
||||
NextDDTeam = m_pClient->m_Teams.Team(pInfo2->m_ClientID);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
if(!pInfo2 || pInfo2->m_Team != Team)
|
||||
continue;
|
||||
|
||||
OldDDTeam = ((CGameClient *) m_pClient)->m_Teams.Team(pInfo2->m_ClientID);
|
||||
OldDDTeam = m_pClient->m_Teams.Team(pInfo2->m_ClientID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ void CSpectator::OnRender()
|
|||
}
|
||||
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_paInfoByDDTeam[i];
|
||||
int DDTeam = ((CGameClient *) m_pClient)->m_Teams.Team(pInfo->m_ClientID);
|
||||
int DDTeam = m_pClient->m_Teams.Team(pInfo->m_ClientID);
|
||||
int NextDDTeam = 0;
|
||||
|
||||
for(int j = i + 1; j < MAX_CLIENTS; j++)
|
||||
|
@ -305,7 +305,7 @@ void CSpectator::OnRender()
|
|||
if(!pInfo2 || pInfo2->m_Team == TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
||||
NextDDTeam = ((CGameClient *) m_pClient)->m_Teams.Team(pInfo2->m_ClientID);
|
||||
NextDDTeam = m_pClient->m_Teams.Team(pInfo2->m_ClientID);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ void CSpectator::OnRender()
|
|||
if(!pInfo2 || pInfo2->m_Team == TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
||||
OldDDTeam = ((CGameClient *) m_pClient)->m_Teams.Team(pInfo2->m_ClientID);
|
||||
OldDDTeam = m_pClient->m_Teams.Team(pInfo2->m_ClientID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ void CLineInput::Editing(const char *pString, int Cursor)
|
|||
|
||||
void CLineInput::Add(const char *pString)
|
||||
{
|
||||
if((int)sizeof(m_Str) - m_Len <= (int)str_length(pString))
|
||||
if((int)sizeof(m_Str) - m_Len <= str_length(pString))
|
||||
return;
|
||||
str_copy(m_Str + m_Len, pString, sizeof(m_Str) - m_Len);
|
||||
m_Len = str_length(m_Str);
|
||||
|
|
|
@ -604,7 +604,7 @@ int CEditor::DoButton_Editor_Common(const void *pID, const char *pText, int Chec
|
|||
}
|
||||
|
||||
if(UI()->HotItem() == pID && pToolTip)
|
||||
m_pTooltip = (const char *)pToolTip;
|
||||
m_pTooltip = pToolTip;
|
||||
|
||||
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
||||
|
||||
|
@ -3781,7 +3781,7 @@ void CEditor::SortImages()
|
|||
|
||||
if(!Sorted)
|
||||
{
|
||||
array<CEditorImage*> lTemp = array<CEditorImage*>(m_Map.m_lImages);
|
||||
array<CEditorImage*> lTemp = m_Map.m_lImages;
|
||||
gs_pSortedIndex = new int[lTemp.size()];
|
||||
|
||||
qsort(m_Map.m_lImages.base_ptr(), m_Map.m_lImages.size(), sizeof(CEditorImage*), CompareImageName);
|
||||
|
|
|
@ -517,8 +517,8 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View)
|
|||
{
|
||||
for(int k = 1; k < 4; k++)
|
||||
{
|
||||
lQuads[i]->m_aPoints[k].x = 1000.0f * (int(lQuads[i]->m_aPoints[k].x) / 1000);
|
||||
lQuads[i]->m_aPoints[k].y = 1000.0f * (int(lQuads[i]->m_aPoints[k].y) / 1000);
|
||||
lQuads[i]->m_aPoints[k].x = 1000.0f * (lQuads[i]->m_aPoints[k].x / 1000);
|
||||
lQuads[i]->m_aPoints[k].y = 1000.0f * (lQuads[i]->m_aPoints[k].y / 1000);
|
||||
}
|
||||
pEditor->m_Map.m_Modified = true;
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ bool CSqlScore::CheckBirthdayThread(CSqlServer* pSqlServer, const CSqlData *pGam
|
|||
|
||||
if(pSqlServer->GetResults()->next())
|
||||
{
|
||||
int yearsAgo = (int)pSqlServer->GetResults()->getInt("YearsAgo");
|
||||
int yearsAgo = pSqlServer->GetResults()->getInt("YearsAgo");
|
||||
str_format(aBuf, sizeof(aBuf), "Happy DDNet birthday to %s for finishing their first map %d year%s ago!", pData->m_Name.Str(), yearsAgo, yearsAgo > 1 ? "s" : "");
|
||||
pData->GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf, pData->m_ClientID);
|
||||
|
||||
|
@ -400,19 +400,19 @@ bool CSqlScore::MapInfoThread(CSqlServer* pSqlServer, const CSqlData *pGameData,
|
|||
else
|
||||
{
|
||||
pSqlServer->GetResults()->next();
|
||||
int points = (int)pSqlServer->GetResults()->getInt("Points");
|
||||
int stars = (int)pSqlServer->GetResults()->getInt("Stars");
|
||||
int finishes = (int)pSqlServer->GetResults()->getInt("Finishes");
|
||||
int finishers = (int)pSqlServer->GetResults()->getInt("Finishers");
|
||||
int average = (int)pSqlServer->GetResults()->getInt("Average");
|
||||
int points = pSqlServer->GetResults()->getInt("Points");
|
||||
int stars = pSqlServer->GetResults()->getInt("Stars");
|
||||
int finishes = pSqlServer->GetResults()->getInt("Finishes");
|
||||
int finishers = pSqlServer->GetResults()->getInt("Finishers");
|
||||
int average = pSqlServer->GetResults()->getInt("Average");
|
||||
char aMap[128];
|
||||
strcpy(aMap, pSqlServer->GetResults()->getString("Map").c_str());
|
||||
char aServer[32];
|
||||
strcpy(aServer, pSqlServer->GetResults()->getString("Server").c_str());
|
||||
char aMapper[128];
|
||||
strcpy(aMapper, pSqlServer->GetResults()->getString("Mapper").c_str());
|
||||
int stamp = (int)pSqlServer->GetResults()->getInt("Stamp");
|
||||
int ago = (int)pSqlServer->GetResults()->getInt("Ago");
|
||||
int stamp = pSqlServer->GetResults()->getInt("Stamp");
|
||||
int ago = pSqlServer->GetResults()->getInt("Ago");
|
||||
float ownTime = (float)pSqlServer->GetResults()->getDouble("OwnTime");
|
||||
|
||||
char pAgoString[40] = "\0";
|
||||
|
@ -533,7 +533,7 @@ bool CSqlScore::SaveScoreThread(CSqlServer* pSqlServer, const CSqlData *pGameDat
|
|||
if(pSqlServer->GetResults()->rowsCount() == 1)
|
||||
{
|
||||
pSqlServer->GetResults()->next();
|
||||
int points = (int)pSqlServer->GetResults()->getInt("Points");
|
||||
int points = pSqlServer->GetResults()->getInt("Points");
|
||||
if (points == 1)
|
||||
str_format(aBuf, sizeof(aBuf), "You earned %d point for finishing this map!", points);
|
||||
else
|
||||
|
@ -764,7 +764,7 @@ bool CSqlScore::ShowRankThread(CSqlServer* pSqlServer, const CSqlData *pGameData
|
|||
pSqlServer->GetResults()->next();
|
||||
|
||||
float Time = (float)pSqlServer->GetResults()->getDouble("Time");
|
||||
int Rank = (int)pSqlServer->GetResults()->getInt("Rank");
|
||||
int Rank = pSqlServer->GetResults()->getInt("Rank");
|
||||
if(g_Config.m_SvHideScore)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "Your time: %02d:%05.2f", (int)(Time/60), Time-((int)Time/60*60));
|
||||
|
@ -837,7 +837,7 @@ bool CSqlScore::ShowTeamRankThread(CSqlServer* pSqlServer, const CSqlData *pGame
|
|||
pSqlServer->GetResults()->first();
|
||||
|
||||
float Time = (float)pSqlServer->GetResults()->getDouble("Time");
|
||||
int Rank = (int)pSqlServer->GetResults()->getInt("Rank");
|
||||
int Rank = pSqlServer->GetResults()->getInt("Rank");
|
||||
|
||||
for(int Row = 0; Row < Rows; Row++)
|
||||
{
|
||||
|
@ -1105,8 +1105,8 @@ bool CSqlScore::ShowTimesThread(CSqlServer* pSqlServer, const CSqlData *pGameDat
|
|||
while(pSqlServer->GetResults()->next())
|
||||
{
|
||||
char pAgoString[40] = "\0";
|
||||
pSince = (int)pSqlServer->GetResults()->getInt("Ago");
|
||||
pStamp = (int)pSqlServer->GetResults()->getInt("Stamp");
|
||||
pSince = pSqlServer->GetResults()->getInt("Ago");
|
||||
pStamp = pSqlServer->GetResults()->getInt("Stamp");
|
||||
pTime = (float)pSqlServer->GetResults()->getDouble("Time");
|
||||
|
||||
sqlstr::AgoTimeToString(pSince,pAgoString);
|
||||
|
@ -1181,8 +1181,8 @@ bool CSqlScore::ShowPointsThread(CSqlServer* pSqlServer, const CSqlData *pGameDa
|
|||
else
|
||||
{
|
||||
pSqlServer->GetResults()->next();
|
||||
int count = (int)pSqlServer->GetResults()->getInt("Points");
|
||||
int rank = (int)pSqlServer->GetResults()->getInt("Rank");
|
||||
int count = pSqlServer->GetResults()->getInt("Points");
|
||||
int rank = pSqlServer->GetResults()->getInt("Rank");
|
||||
str_format(aBuf, sizeof(aBuf), "%d. %s Points: %d, requested by %s", rank, pSqlServer->GetResults()->getString("Name").c_str(), count, pData->m_aRequestingPlayer);
|
||||
pData->GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf, pData->m_ClientID);
|
||||
}
|
||||
|
@ -1554,7 +1554,7 @@ bool CSqlScore::LoadTeamThread(CSqlServer* pSqlServer, const CSqlData *pGameData
|
|||
}
|
||||
|
||||
pSqlServer->GetResults()->getInt("Ago");
|
||||
int since = (int)pSqlServer->GetResults()->getInt("Ago");
|
||||
int since = pSqlServer->GetResults()->getInt("Ago");
|
||||
|
||||
if(since < g_Config.m_SvSaveGamesDelay)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue