mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed compiler warnings. Closes #679
This commit is contained in:
parent
41ebc9bc9d
commit
5fbf6d0bfd
|
@ -316,9 +316,12 @@ int io_seek(IOHANDLE io, int offset, int origin)
|
||||||
break;
|
break;
|
||||||
case IOSEEK_END:
|
case IOSEEK_END:
|
||||||
real_origin = SEEK_END;
|
real_origin = SEEK_END;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fseek((FILE*)io, offset, origin);
|
return fseek((FILE*)io, offset, real_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
long int io_tell(IOHANDLE io)
|
long int io_tell(IOHANDLE io)
|
||||||
|
|
|
@ -1718,7 +1718,6 @@ void CClient::Update()
|
||||||
int64 PrevtickStart = (m_aSnapshots[SNAP_PREV]->m_Tick)*time_freq()/50;
|
int64 PrevtickStart = (m_aSnapshots[SNAP_PREV]->m_Tick)*time_freq()/50;
|
||||||
int PrevPredTick = (int)(PredNow*50/time_freq());
|
int PrevPredTick = (int)(PredNow*50/time_freq());
|
||||||
int NewPredTick = PrevPredTick+1;
|
int NewPredTick = PrevPredTick+1;
|
||||||
static float LastPredintra = 0;
|
|
||||||
|
|
||||||
m_GameIntraTick = (Now - PrevtickStart) / (float)(CurtickStart-PrevtickStart);
|
m_GameIntraTick = (Now - PrevtickStart) / (float)(CurtickStart-PrevtickStart);
|
||||||
m_GameTickTime = (Now - PrevtickStart) / (float)Freq; //(float)SERVER_TICK_SPEED);
|
m_GameTickTime = (Now - PrevtickStart) / (float)Freq; //(float)SERVER_TICK_SPEED);
|
||||||
|
@ -1735,15 +1734,12 @@ void CClient::Update()
|
||||||
|
|
||||||
if(NewPredTick > m_PredTick)
|
if(NewPredTick > m_PredTick)
|
||||||
{
|
{
|
||||||
LastPredintra = m_PredIntraTick;
|
|
||||||
m_PredTick = NewPredTick;
|
m_PredTick = NewPredTick;
|
||||||
Repredict = 1;
|
Repredict = 1;
|
||||||
|
|
||||||
// send input
|
// send input
|
||||||
SendInput();
|
SendInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
LastPredintra = m_PredIntraTick;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only do sane predictions
|
// only do sane predictions
|
||||||
|
|
|
@ -570,7 +570,6 @@ public:
|
||||||
float DrawX = 0.0f, DrawY = 0.0f;
|
float DrawX = 0.0f, DrawY = 0.0f;
|
||||||
int LineCount = 0;
|
int LineCount = 0;
|
||||||
float CursorX, CursorY;
|
float CursorX, CursorY;
|
||||||
const char *pEnd;
|
|
||||||
|
|
||||||
float Size = pCursor->m_FontSize;
|
float Size = pCursor->m_FontSize;
|
||||||
|
|
||||||
|
@ -605,8 +604,6 @@ public:
|
||||||
if(Length < 0)
|
if(Length < 0)
|
||||||
Length = str_length(pText);
|
Length = str_length(pText);
|
||||||
|
|
||||||
pEnd = pText + Length;
|
|
||||||
|
|
||||||
// if we don't want to render, we can just skip the first outline pass
|
// if we don't want to render, we can just skip the first outline pass
|
||||||
i = 1;
|
i = 1;
|
||||||
if(pCursor->m_Flags&TEXTFLAG_RENDER)
|
if(pCursor->m_Flags&TEXTFLAG_RENDER)
|
||||||
|
|
|
@ -273,7 +273,9 @@ void *CDataFileReader::GetDataImpl(int Index, int Swap)
|
||||||
{
|
{
|
||||||
// fetch the data size
|
// fetch the data size
|
||||||
int DataSize = GetDataSize(Index);
|
int DataSize = GetDataSize(Index);
|
||||||
|
#if defined(CONF_ARCH_ENDIAN_BIG)
|
||||||
int SwapSize = DataSize;
|
int SwapSize = DataSize;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(m_pDataFile->m_Header.m_Version == 4)
|
if(m_pDataFile->m_Header.m_Version == 4)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +294,9 @@ void *CDataFileReader::GetDataImpl(int Index, int Swap)
|
||||||
// decompress the data, TODO: check for errors
|
// decompress the data, TODO: check for errors
|
||||||
s = UncompressedSize;
|
s = UncompressedSize;
|
||||||
uncompress((Bytef*)m_pDataFile->m_ppDataPtrs[Index], &s, (Bytef*)pTemp, DataSize); // ignore_convention
|
uncompress((Bytef*)m_pDataFile->m_ppDataPtrs[Index], &s, (Bytef*)pTemp, DataSize); // ignore_convention
|
||||||
|
#if defined(CONF_ARCH_ENDIAN_BIG)
|
||||||
SwapSize = s;
|
SwapSize = s;
|
||||||
|
#endif
|
||||||
|
|
||||||
// clean up the temporary buffers
|
// clean up the temporary buffers
|
||||||
mem_free(pTemp);
|
mem_free(pTemp);
|
||||||
|
|
|
@ -79,9 +79,9 @@ int CNetServer::Close()
|
||||||
int CNetServer::Drop(int ClientID, const char *pReason)
|
int CNetServer::Drop(int ClientID, const char *pReason)
|
||||||
{
|
{
|
||||||
// TODO: insert lots of checks here
|
// TODO: insert lots of checks here
|
||||||
NETADDR Addr = ClientAddr(ClientID);
|
/*NETADDR Addr = ClientAddr(ClientID);
|
||||||
|
|
||||||
/*dbg_msg("net_server", "client dropped. cid=%d ip=%d.%d.%d.%d reason=\"%s\"",
|
dbg_msg("net_server", "client dropped. cid=%d ip=%d.%d.%d.%d reason=\"%s\"",
|
||||||
ClientID,
|
ClientID,
|
||||||
Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3],
|
Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3],
|
||||||
pReason
|
pReason
|
||||||
|
|
|
@ -645,8 +645,6 @@ void CMenus::RenderLoading()
|
||||||
|
|
||||||
RenderBackground();
|
RenderBackground();
|
||||||
|
|
||||||
float tw;
|
|
||||||
|
|
||||||
float w = 700;
|
float w = 700;
|
||||||
float h = 200;
|
float h = 200;
|
||||||
float x = Screen.w/2-w/2;
|
float x = Screen.w/2-w/2;
|
||||||
|
@ -663,7 +661,6 @@ void CMenus::RenderLoading()
|
||||||
|
|
||||||
const char *pCaption = Localize("Loading");
|
const char *pCaption = Localize("Loading");
|
||||||
|
|
||||||
tw = TextRender()->TextWidth(0, 48.0f, pCaption, -1);
|
|
||||||
CUIRect r;
|
CUIRect r;
|
||||||
r.x = x;
|
r.x = x;
|
||||||
r.y = y+20;
|
r.y = y+20;
|
||||||
|
|
|
@ -188,10 +188,12 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
||||||
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
|
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
|
||||||
Button.VSplitLeft(Button.h, &Button, 0);
|
Button.VSplitLeft(Button.h, &Button, 0);
|
||||||
if(DoButton_Toggle(&s_aPlayerIDs[i][1], m_pClient->m_aClients[i].m_Friend, &Button))
|
if(DoButton_Toggle(&s_aPlayerIDs[i][1], m_pClient->m_aClients[i].m_Friend, &Button))
|
||||||
|
{
|
||||||
if(m_pClient->m_aClients[i].m_Friend)
|
if(m_pClient->m_aClients[i].m_Friend)
|
||||||
m_pClient->Friends()->RemoveFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
m_pClient->Friends()->RemoveFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
||||||
else
|
else
|
||||||
m_pClient->Friends()->AddFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
m_pClient->Friends()->AddFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -482,15 +482,12 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
||||||
{
|
{
|
||||||
// logic
|
// logic
|
||||||
static float s_Value;
|
static float s_Value;
|
||||||
int Ret = 0;
|
|
||||||
int Inside = UI()->MouseInside(pRect);
|
int Inside = UI()->MouseInside(pRect);
|
||||||
|
|
||||||
if(UI()->ActiveItem() == pID)
|
if(UI()->ActiveItem() == pID)
|
||||||
{
|
{
|
||||||
if(!UI()->MouseButton(0))
|
if(!UI()->MouseButton(0))
|
||||||
{
|
{
|
||||||
if(Inside)
|
|
||||||
Ret = 1;
|
|
||||||
m_LockMouse = false;
|
m_LockMouse = false;
|
||||||
UI()->SetActiveItem(0);
|
UI()->SetActiveItem(0);
|
||||||
}
|
}
|
||||||
|
@ -1192,8 +1189,6 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar, bool ShowPicker)
|
||||||
|
|
||||||
static float s_StartWx = 0;
|
static float s_StartWx = 0;
|
||||||
static float s_StartWy = 0;
|
static float s_StartWy = 0;
|
||||||
static float s_StartMx = 0;
|
|
||||||
static float s_StartMy = 0;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -1281,8 +1276,6 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar, bool ShowPicker)
|
||||||
{
|
{
|
||||||
s_StartWx = wx;
|
s_StartWx = wx;
|
||||||
s_StartWy = wy;
|
s_StartWy = wy;
|
||||||
s_StartMx = mx;
|
|
||||||
s_StartMy = my;
|
|
||||||
|
|
||||||
if(Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL) || UI()->MouseButton(2))
|
if(Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL) || UI()->MouseButton(2))
|
||||||
{
|
{
|
||||||
|
@ -1768,14 +1761,6 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
||||||
CUIRect Slot, Button;
|
CUIRect Slot, Button;
|
||||||
char aBuf[64];
|
char aBuf[64];
|
||||||
|
|
||||||
int ValidGroup = 0;
|
|
||||||
int ValidLayer = 0;
|
|
||||||
if(m_SelectedGroup >= 0 && m_SelectedGroup < m_Map.m_lGroups.size())
|
|
||||||
ValidGroup = 1;
|
|
||||||
|
|
||||||
if(ValidGroup && m_SelectedLayer >= 0 && m_SelectedLayer < m_Map.m_lGroups[m_SelectedGroup]->m_lLayers.size())
|
|
||||||
ValidLayer = 1;
|
|
||||||
|
|
||||||
float LayersHeight = 12.0f; // Height of AddGroup button
|
float LayersHeight = 12.0f; // Height of AddGroup button
|
||||||
static int s_ScrollBar = 0;
|
static int s_ScrollBar = 0;
|
||||||
static float s_ScrollValue = 0;
|
static float s_ScrollValue = 0;
|
||||||
|
@ -2213,7 +2198,8 @@ void CEditor::AddFileDialogEntry(int Index, CUIRect *pView)
|
||||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
if(DoButton_File((void*)(10+(int)Button.y), m_FileList[Index].m_aName, m_FilesSelectedIndex == Index, &Button, 0, 0))
|
static int s_FileButton = 0;
|
||||||
|
if(DoButton_File(&s_FileButton, m_FileList[Index].m_aName, m_FilesSelectedIndex == Index, &Button, 0, 0))
|
||||||
{
|
{
|
||||||
if(!m_FileList[Index].m_IsDir)
|
if(!m_FileList[Index].m_IsDir)
|
||||||
str_copy(m_aFileDialogFileName, m_FileList[Index].m_aFilename, sizeof(m_aFileDialogFileName));
|
str_copy(m_aFileDialogFileName, m_FileList[Index].m_aFilename, sizeof(m_aFileDialogFileName));
|
||||||
|
@ -2807,8 +2793,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
||||||
|
|
||||||
// render handles
|
// render handles
|
||||||
{
|
{
|
||||||
static bool s_Move = false;
|
|
||||||
|
|
||||||
int CurrentValue = 0, CurrentTime = 0;
|
int CurrentValue = 0, CurrentTime = 0;
|
||||||
|
|
||||||
Graphics()->TextureSet(-1);
|
Graphics()->TextureSet(-1);
|
||||||
|
@ -2842,7 +2826,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
||||||
if(!UI()->MouseButton(0))
|
if(!UI()->MouseButton(0))
|
||||||
{
|
{
|
||||||
UI()->SetActiveItem(0);
|
UI()->SetActiveItem(0);
|
||||||
s_Move = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,8 +115,6 @@ void CCharacter::HandleNinja()
|
||||||
if(m_ActiveWeapon != WEAPON_NINJA)
|
if(m_ActiveWeapon != WEAPON_NINJA)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vec2 Direction = normalize(vec2(m_LatestInput.m_TargetX, m_LatestInput.m_TargetY));
|
|
||||||
|
|
||||||
if ((Server()->Tick() - m_Ninja.m_ActivationTick) > (g_pData->m_Weapons.m_Ninja.m_Duration * Server()->TickSpeed() / 1000))
|
if ((Server()->Tick() - m_Ninja.m_ActivationTick) > (g_pData->m_Weapons.m_Ninja.m_Duration * Server()->TickSpeed() / 1000))
|
||||||
{
|
{
|
||||||
// time's up, return
|
// time's up, return
|
||||||
|
@ -436,8 +434,6 @@ void CCharacter::HandleWeapons()
|
||||||
//ninja
|
//ninja
|
||||||
HandleNinja();
|
HandleNinja();
|
||||||
|
|
||||||
vec2 Direction = normalize(vec2(m_LatestInput.m_TargetX, m_LatestInput.m_TargetY));
|
|
||||||
|
|
||||||
// check reload timer
|
// check reload timer
|
||||||
if(m_ReloadTimer)
|
if(m_ReloadTimer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,6 @@ void CLaser::DoBounce()
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 To = m_Pos + m_Dir * m_Energy;
|
vec2 To = m_Pos + m_Dir * m_Energy;
|
||||||
vec2 OrgTo = To;
|
|
||||||
|
|
||||||
if(GameServer()->Collision()->IntersectLine(m_Pos, To, 0x0, &To))
|
if(GameServer()->Collision()->IntersectLine(m_Pos, To, 0x0, &To))
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,7 +183,6 @@ CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, v
|
||||||
{
|
{
|
||||||
// Find other players
|
// Find other players
|
||||||
float ClosestLen = distance(Pos0, Pos1) * 100.0f;
|
float ClosestLen = distance(Pos0, Pos1) * 100.0f;
|
||||||
vec2 LineDir = normalize(Pos1-Pos0);
|
|
||||||
CCharacter *pClosest = 0;
|
CCharacter *pClosest = 0;
|
||||||
|
|
||||||
CCharacter *p = (CCharacter *)FindFirst(ENTTYPE_CHARACTER);
|
CCharacter *p = (CCharacter *)FindFirst(ENTTYPE_CHARACTER);
|
||||||
|
|
Loading…
Reference in a new issue