From 5fbf6d0bfd32ab520c6cf67a330c9a2240882750 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 5 May 2011 01:43:27 +0200 Subject: [PATCH] fixed compiler warnings. Closes #679 --- src/base/system.c | 5 ++++- src/engine/client/client.cpp | 4 ---- src/engine/client/text.cpp | 3 --- src/engine/shared/datafile.cpp | 4 ++++ src/engine/shared/network_server.cpp | 4 ++-- src/game/client/components/menus.cpp | 3 --- src/game/client/components/menus_ingame.cpp | 2 ++ src/game/editor/editor.cpp | 21 ++------------------- src/game/server/entities/character.cpp | 4 ---- src/game/server/entities/laser.cpp | 1 - src/game/server/gameworld.cpp | 1 - 11 files changed, 14 insertions(+), 38 deletions(-) diff --git a/src/base/system.c b/src/base/system.c index 2f4c5c7b9..897719296 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -316,9 +316,12 @@ int io_seek(IOHANDLE io, int offset, int origin) break; case IOSEEK_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) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 61a96eeef..ad51c1ad0 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1718,7 +1718,6 @@ void CClient::Update() int64 PrevtickStart = (m_aSnapshots[SNAP_PREV]->m_Tick)*time_freq()/50; int PrevPredTick = (int)(PredNow*50/time_freq()); int NewPredTick = PrevPredTick+1; - static float LastPredintra = 0; m_GameIntraTick = (Now - PrevtickStart) / (float)(CurtickStart-PrevtickStart); m_GameTickTime = (Now - PrevtickStart) / (float)Freq; //(float)SERVER_TICK_SPEED); @@ -1735,15 +1734,12 @@ void CClient::Update() if(NewPredTick > m_PredTick) { - LastPredintra = m_PredIntraTick; m_PredTick = NewPredTick; Repredict = 1; // send input SendInput(); } - - LastPredintra = m_PredIntraTick; } // only do sane predictions diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index b0896b925..4a3a2eb33 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -570,7 +570,6 @@ public: float DrawX = 0.0f, DrawY = 0.0f; int LineCount = 0; float CursorX, CursorY; - const char *pEnd; float Size = pCursor->m_FontSize; @@ -605,8 +604,6 @@ public: if(Length < 0) Length = str_length(pText); - pEnd = pText + Length; - // if we don't want to render, we can just skip the first outline pass i = 1; if(pCursor->m_Flags&TEXTFLAG_RENDER) diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index 3a5a4b1d5..004100384 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -273,7 +273,9 @@ void *CDataFileReader::GetDataImpl(int Index, int Swap) { // fetch the data size int DataSize = GetDataSize(Index); +#if defined(CONF_ARCH_ENDIAN_BIG) int SwapSize = DataSize; +#endif 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 s = UncompressedSize; uncompress((Bytef*)m_pDataFile->m_ppDataPtrs[Index], &s, (Bytef*)pTemp, DataSize); // ignore_convention +#if defined(CONF_ARCH_ENDIAN_BIG) SwapSize = s; +#endif // clean up the temporary buffers mem_free(pTemp); diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index 3078ab9f6..f3fbfa323 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -79,9 +79,9 @@ int CNetServer::Close() int CNetServer::Drop(int ClientID, const char *pReason) { // 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, Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3], pReason diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 6b577fd46..64754c68c 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -645,8 +645,6 @@ void CMenus::RenderLoading() RenderBackground(); - float tw; - float w = 700; float h = 200; float x = Screen.w/2-w/2; @@ -663,7 +661,6 @@ void CMenus::RenderLoading() const char *pCaption = Localize("Loading"); - tw = TextRender()->TextWidth(0, 48.0f, pCaption, -1); CUIRect r; r.x = x; r.y = y+20; diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 33aaa14f2..1afef9224 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -188,10 +188,12 @@ void CMenus::RenderPlayers(CUIRect MainView) Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button); Button.VSplitLeft(Button.h, &Button, 0); if(DoButton_Toggle(&s_aPlayerIDs[i][1], m_pClient->m_aClients[i].m_Friend, &Button)) + { 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); else m_pClient->Friends()->AddFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan); + } } /* diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index e12b20bf4..eb6182be3 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -482,15 +482,12 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in { // logic static float s_Value; - int Ret = 0; int Inside = UI()->MouseInside(pRect); if(UI()->ActiveItem() == pID) { if(!UI()->MouseButton(0)) { - if(Inside) - Ret = 1; m_LockMouse = false; UI()->SetActiveItem(0); } @@ -1192,8 +1189,6 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar, bool ShowPicker) static float s_StartWx = 0; static float s_StartWy = 0; - static float s_StartMx = 0; - static float s_StartMy = 0; enum { @@ -1281,8 +1276,6 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar, bool ShowPicker) { s_StartWx = wx; s_StartWy = wy; - s_StartMx = mx; - s_StartMy = my; 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; 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 static int s_ScrollBar = 0; static float s_ScrollValue = 0; @@ -2213,7 +2198,8 @@ void CEditor::AddFileDialogEntry(int Index, CUIRect *pView) Graphics()->QuadsDrawTL(&QuadItem, 1); 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) str_copy(m_aFileDialogFileName, m_FileList[Index].m_aFilename, sizeof(m_aFileDialogFileName)); @@ -2807,8 +2793,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) // render handles { - static bool s_Move = false; - int CurrentValue = 0, CurrentTime = 0; Graphics()->TextureSet(-1); @@ -2842,7 +2826,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) if(!UI()->MouseButton(0)) { UI()->SetActiveItem(0); - s_Move = false; } else { diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 821aade58..8ab41df36 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -115,8 +115,6 @@ void CCharacter::HandleNinja() if(m_ActiveWeapon != WEAPON_NINJA) 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)) { // time's up, return @@ -436,8 +434,6 @@ void CCharacter::HandleWeapons() //ninja HandleNinja(); - vec2 Direction = normalize(vec2(m_LatestInput.m_TargetX, m_LatestInput.m_TargetY)); - // check reload timer if(m_ReloadTimer) { diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp index 30ed0a9b5..af66fe0c8 100644 --- a/src/game/server/entities/laser.cpp +++ b/src/game/server/entities/laser.cpp @@ -44,7 +44,6 @@ void CLaser::DoBounce() } vec2 To = m_Pos + m_Dir * m_Energy; - vec2 OrgTo = To; if(GameServer()->Collision()->IntersectLine(m_Pos, To, 0x0, &To)) { diff --git a/src/game/server/gameworld.cpp b/src/game/server/gameworld.cpp index 6444cce57..89f4808db 100644 --- a/src/game/server/gameworld.cpp +++ b/src/game/server/gameworld.cpp @@ -183,7 +183,6 @@ CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, v { // Find other players float ClosestLen = distance(Pos0, Pos1) * 100.0f; - vec2 LineDir = normalize(Pos1-Pos0); CCharacter *pClosest = 0; CCharacter *p = (CCharacter *)FindFirst(ENTTYPE_CHARACTER);