From b12ae69feebc12d6962fcd14222a715bae4fe5c5 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Wed, 2 Jun 2010 03:55:08 +0800 Subject: fixed compile errors for osx --- src/engine/client/text.cpp | 2 +- src/engine/shared/datafile.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index b05d49f8..57e1b43b 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -52,7 +52,7 @@ struct CFontSizeData int m_FontSize; FT_Face *m_pFace; - unsigned m_aTextures[2]; + GLuint m_aTextures[2]; int m_TextureWidth; int m_TextureHeight; diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index dcc32ef2..e7905f81 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -154,7 +154,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename) } #if defined(CONF_ARCH_ENDIAN_BIG) - swap_endian(m_pDataFile->m_pData, sizeof(int), Header.Swaplen / sizeof(int)); + swap_endian(m_pDataFile->m_pData, sizeof(int), Header.m_Swaplen / sizeof(int)); #endif //if(DEBUG) @@ -476,7 +476,7 @@ int CDataFileWriter::AddDataSwapped(int Size, void *pData) int Index; mem_copy(pSwapped, pData, Size); swap_endian(&pSwapped, sizeof(int), Size/sizeof(int)); - Index = AddData(Size, Swapped); + Index = AddData(Size, pSwapped); mem_free(pSwapped); return Index; #else -- cgit 1.4.1 From b851bc8799027a3e6a6369ef31189f7a1d73bb5c Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Wed, 2 Jun 2010 03:59:04 +0800 Subject: fixed so that SDL_main is declared as a C function so linking gets done correctly --- src/engine/client/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 97adeeac..613a8137 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1949,7 +1949,7 @@ static CClient m_Client; */ #if defined(CONF_PLATFORM_MACOSX) -int SDL_main(int argc, const char **argv) // ignore_convention +extern "C" int SDL_main(int argc, const char **argv) // ignore_convention #else int main(int argc, const char **argv) // ignore_convention #endif -- cgit 1.4.1 From 8e1712c744a6641dbe79f250719531c4036cbda9 Mon Sep 17 00:00:00 2001 From: xalduin Date: Wed, 2 Jun 2010 04:49:35 +0800 Subject: Sort by map name when opening map When opening a map, the list of map names is now sorted alphabetically. --- src/game/editor/ed_editor.cpp | 36 +++++++++++++++++------------------- src/game/editor/ed_editor.h | 2 ++ 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index 480a6827..b2b3e1ca 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -1,7 +1,8 @@ // copyright (c) 2007 magnus auvinen, see licence.txt for more info #include - +#include +#include #include #include @@ -1885,21 +1886,21 @@ static char gs_FileDialogFileName[512] = {0}; static char gs_aFileDialogPath[512] = {0}; static char gs_aFileDialogCompleteFilename[512] = {0}; static int gs_FilesNum = 0; +static sorted_array gs_FileList; int g_FilesStartAt = 0; int g_FilesCur = 0; int g_FilesStopAt = 999; -struct CListDirInfo -{ - CUIRect *m_pRect; - CEditor *m_pEditor; -}; - static void EditorListdirCallback(const char *pName, int IsDir, void *pUser) { if(pName[0] == '.' || IsDir) // skip this shit! return; + gs_FileList.add(string(pName)); +} + +void CEditor::AddFileDialogEntry(const char *pName, CUIRect *pView) +{ if(g_FilesCur > gs_FilesNum) gs_FilesNum = g_FilesCur; @@ -1907,14 +1908,12 @@ static void EditorListdirCallback(const char *pName, int IsDir, void *pUser) if(g_FilesCur-1 < g_FilesStartAt || g_FilesCur > g_FilesStopAt) return; - CListDirInfo *pInfo = (CListDirInfo *)pUser; - CUIRect *pView = pInfo->m_pRect; CUIRect Button; pView->HSplitTop(15.0f, &Button, pView); pView->HSplitTop(2.0f, 0, pView); //char buf[512]; - if(pInfo->m_pEditor->DoButton_File((void*)(10+(int)Button.y), pName, 0, &Button, 0, 0)) + if(DoButton_File((void*)(10+(int)Button.y), pName, 0, &Button, 0, 0)) { str_copy(gs_FileDialogFileName, pName, sizeof(gs_FileDialogFileName)); @@ -1922,11 +1921,11 @@ static void EditorListdirCallback(const char *pName, int IsDir, void *pUser) str_append(gs_aFileDialogCompleteFilename, gs_aFileDialogPath, sizeof(gs_aFileDialogCompleteFilename)); str_append(gs_aFileDialogCompleteFilename, gs_FileDialogFileName, sizeof(gs_aFileDialogCompleteFilename)); - if(pInfo->m_pEditor->Input()->MouseDoubleClick()) + if(Input()->MouseDoubleClick()) { if(gs_pfnFileDialogFunc) - gs_pfnFileDialogFunc(gs_aFileDialogCompleteFilename, pInfo->m_pEditor); - pInfo->m_pEditor->m_Dialog = DIALOG_NONE; + gs_pfnFileDialogFunc(gs_aFileDialogCompleteFilename, this); + m_Dialog = DIALOG_NONE; } } } @@ -1997,13 +1996,12 @@ void CEditor::RenderFileDialog() // set clipping UI()->ClipEnable(&View); - // the list - CListDirInfo Info; - Info.m_pRect = &View; - Info.m_pEditor = this; - // TODO: lazy ass coding, should store the interface pointer somewere - Kernel()->RequestInterface()->ListDirectory(gs_FileDialogDirTypes, gs_aFileDialogPath, EditorListdirCallback, &Info); + Kernel()->RequestInterface()->ListDirectory(gs_FileDialogDirTypes, gs_aFileDialogPath, EditorListdirCallback, 0); + + for(int i = 0; i < gs_FileList.size(); i++) + AddFileDialogEntry(gs_FileList[i].cstr(), &View); + gs_FileList.clear(); // disable clipping again UI()->ClipDisable(); diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h index 1730fb0a..d027c162 100644 --- a/src/game/editor/ed_editor.h +++ b/src/game/editor/ed_editor.h @@ -606,6 +606,8 @@ public: void RenderMenubar(CUIRect Menubar); void RenderFileDialog(); + + void AddFileDialogEntry(const char *pName, CUIRect *pView); }; // make sure to inline this function -- cgit 1.4.1 From ad1ce014469acd56caab6c74d04474e029952193 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 3 Jun 2010 01:39:28 +0800 Subject: fixed shotbug (#80) --- src/game/client/components/controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 0b4918b2..7b3f4716 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -19,7 +19,10 @@ void CControls::OnReset() { m_LastData.m_Direction = 0; m_LastData.m_Hook = 0; - m_LastData.m_Fire = 0; + // simulate releasing the fire button + if((m_LastData.m_Fire&1) != 0) + m_LastData.m_Fire++; + m_LastData.m_Fire &= INPUT_STATE_MASK; m_LastData.m_Jump = 0; m_InputData = m_LastData; -- cgit 1.4.1 From dd19074deba2df94592f454f4333fcbfe0f66893 Mon Sep 17 00:00:00 2001 From: NoxNebula Date: Wed, 2 Jun 2010 10:42:17 +0800 Subject: Admin-Kick-Protection Add IsAuthed(int ClientID); function. Add kickprotection for admins (Remote Console logged in players) Add Anti-Self-Kick (minor) --- src/engine/server.h | 2 ++ src/engine/server/server.cpp | 7 +++++++ src/engine/server/server.h | 1 + src/game/server/gamecontext.cpp | 13 +++++++++++++ 4 files changed, 23 insertions(+) (limited to 'src') diff --git a/src/engine/server.h b/src/engine/server.h index 52e6ec6a..fa5d2498 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -49,6 +49,8 @@ public: virtual void *SnapNewItem(int Type, int Id, int Size) = 0; virtual void SnapSetStaticsize(int ItemType, int Size) = 0; + + virtual bool IsAuthed(int ClientID) = 0; }; class IGameServer : public IInterface diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 05e56a74..b5a01a99 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -293,6 +293,13 @@ int CServer::Init() return 0; } +bool CServer::IsAuthed(int ClientID) +{ + if(m_aClients[ClientID].m_Authed) + return true; + return false; +} + int CServer::GetClientInfo(int ClientID, CClientInfo *pInfo) { dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "client_id is not valid"); diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 7d56bd33..895a4bd1 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -138,6 +138,7 @@ public: int Init(); + bool IsAuthed(int ClientID); int GetClientInfo(int ClientID, CClientInfo *pInfo); void GetClientIP(int ClientID, char *pIPString, int Size); const char *ClientName(int ClientId); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 795bb65f..c04dd945 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -647,6 +647,19 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) SendChatTarget(ClientId, "Invalid client id to kick"); return; } + if(KickId == ClientId) + { + SendChatTarget(ClientId, "You cant kick yourself"); + return; + } + if(Server()->IsAuthed(KickId)) + { + SendChatTarget(ClientId, "You cant kick admins"); + char aBufKick[128]; + str_format(aBufKick, sizeof(aBufKick), "%s called for vote to kick you", Server()->ClientName(ClientId)); + SendChatTarget(KickId, aBufKick); + return; + } str_format(aChatmsg, sizeof(aChatmsg), "%s called for vote to kick '%s'", Server()->ClientName(ClientId), Server()->ClientName(KickId)); str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId)); -- cgit 1.4.1 From c37335b115f69f8ab54403742640faff384d2747 Mon Sep 17 00:00:00 2001 From: SushiTee Date: Wed, 2 Jun 2010 21:33:19 +0200 Subject: shortened IsAuthed a bit --- src/engine/server/server.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index b5a01a99..7380235d 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -295,9 +295,7 @@ int CServer::Init() bool CServer::IsAuthed(int ClientID) { - if(m_aClients[ClientID].m_Authed) - return true; - return false; + return m_aClients[ClientID].m_Authed; } int CServer::GetClientInfo(int ClientID, CClientInfo *pInfo) -- cgit 1.4.1