From f8d69b2fe61eb40709d98ed227f91e7df29daa14 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Tue, 1 Jun 2010 21:55:08 +0200 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(-) 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 61fdee33679dc50fd119f32a3b9590f57332b015 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Tue, 1 Jun 2010 21:59:04 +0200 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(-) 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 f2920ea5d85ea54a8000fdf6b6f8ccba36ebfdfb 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(-) 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 9a5a19e7c7b0d4364f32540b012bce970807f9b6 Mon Sep 17 00:00:00 2001 From: NoxNebula Date: Wed, 2 Jun 2010 04:42:17 +0200 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(+) 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 edcfbc2f28b59ae430c5c2d2d33fb78e747ce838 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Wed, 2 Jun 2010 11:46:07 +0200 Subject: cleaned up the configure.lua a little bit --- configure.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.lua b/configure.lua index 993ed51a..3b36d484 100644 --- a/configure.lua +++ b/configure.lua @@ -76,7 +76,7 @@ function NewConfig(on_configured_callback) local options_table = {} if not options_func then - print("auto configuration", options_func) + print("auto configuration") self:Config(filename) options_func = loadfile(filename) end -- cgit 1.4.1 From b2a55766d1d1696c80bad39f8651e8029a6a0d77 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 2 Jun 2010 19:39:28 +0200 Subject: fixed shotbug (#80) --- src/game/client/components/controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 25408a102bc4f48af62f67d69566195778b94359 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 2 Jun 2010 20:27:53 +0200 Subject: added fix for portuguese translation by slinack --- data/languages/portuguese.txt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index 3f811a6d..64bf7e6c 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -23,7 +23,7 @@ Are you sure that you want to quit? == Você tem certeza que deseja sair? As this is the first time you have launched the game, please enter your nickname below. It is recommended that you check your settings so you adjust them to your preferences before joining a server. -== Como esta é a primeira vez que você abriu o jogo, por favor, entre com seu apelido abaixo. É recomendado que você cheque suas configurações e então ajuste elaspara suas preferências antes de entrar em um servidor. +== Como esta é a primeira vez que você abriu o jogo, por favor, entre com seu apelido abaixo. É recomendado que você cheque suas configurações e então ajuste elas para suas preferências antes de entrar em um servidor. Blue team == Time azul @@ -113,7 +113,7 @@ Fire == Atirar Force vote -== Forçar votação +== Forçar Fullscreen == Tela cheia @@ -167,13 +167,13 @@ Internet == Internet Join blue -== Entre no az. +== Azul Join game == Entre no jogo Join red -== Entre no verm. +== Vermelho Jump == Pular @@ -218,7 +218,7 @@ Movement == Movimento Mute when not active -== Silenciar quando não ativo +== Silenciar quando inativo Name == Nome @@ -260,13 +260,13 @@ Pistol == Pistola Play -== Jogar +== Assistir Player == Jogador Players -== Jogador +== Jogadores Prev. weapon == Arma anterior @@ -320,7 +320,7 @@ Score board == Placar Score limit -== Pontuação máxima +== Placar máx. Scoreboard == Placar @@ -343,6 +343,9 @@ Settings Shotgun == Espingarda +Show chat +== Mostrar conversa + Show name plates == Mostrar apelidos @@ -389,7 +392,7 @@ The server is running a non-standard tuning on a pure game type. == O servidor está rodando uma modificação não padrão em um tipo de jogo puro. Time limit -== Limite de tempo +== Tempo máx. Try again == Tente novamente @@ -435,8 +438,6 @@ Your skin ##### needs translation #### -Show chat -== Show chat ##### old translations #### -- cgit 1.4.1 From 7a1953e60b58544144986d30cb30acfab6e0d465 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 2 Jun 2010 20:50:48 +0200 Subject: added fix for editor quad editing by ghost91 Closes #18 --- src/game/editor/ed_editor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index b2b3e1ca..387ce104 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -1029,6 +1029,14 @@ void CEditor::DoQuadPoint(CQuad *q, int QuadIndex, int v) s_Operation = OP_CONTEXT_MENU; m_SelectedQuad = QuadIndex; UI()->SetActiveItem(pId); + if(!(m_SelectedPoints&(1<KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) + m_SelectedPoints |= 1< Date: Wed, 2 Jun 2010 21:03:15 +0200 Subject: Some localization fixes --- data/languages/czech.txt | 7 +++++-- data/languages/dutch.txt | 7 +++++-- data/languages/french.txt | 7 +++++-- data/languages/german.txt | 7 +++++-- data/languages/italian.txt | 7 +++++-- data/languages/portuguese.txt | 7 +++++-- data/languages/swedish.txt | 7 +++++-- src/game/client/components/menus.cpp | 2 +- 8 files changed, 36 insertions(+), 15 deletions(-) diff --git a/data/languages/czech.txt b/data/languages/czech.txt index 652c4089..c788edcf 100644 --- a/data/languages/czech.txt +++ b/data/languages/czech.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Kvalitní textury -Quick search -== Rychlé hledání +Quick search: +== Rychlé hledání: Quit == Ukončit @@ -438,5 +438,8 @@ Your skin Show chat == Show chat +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt index 1ec28c8d..fe9c65b8 100644 --- a/data/languages/dutch.txt +++ b/data/languages/dutch.txt @@ -273,8 +273,8 @@ Prev. weapon Quality Textures == Kwalteit Textures -Quick search -== Snel Zoken +Quick search: +== Snel Zoken: Quit == Stoppen @@ -437,4 +437,7 @@ Show chat Your skin == Your skin +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/french.txt b/data/languages/french.txt index 9d7bcd40..fa360da9 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Textures haute qualité -Quick search -== Recherche rapide +Quick search: +== Recherche rapide: Quit == Quitter @@ -438,5 +438,8 @@ Your skin ##### needs translation #### +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/german.txt b/data/languages/german.txt index 967c3f5b..235e08ec 100644 --- a/data/languages/german.txt +++ b/data/languages/german.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Hochaufgelöste Texturen -Quick search -== Schnelle Suche +Quick search: +== Schnellsuche: Quit == Beenden @@ -436,6 +436,9 @@ You must restart the game for all settings to take effect. Your skin == Dein Skin +Password incorrect +== Passwort falsch + ##### needs translation #### diff --git a/data/languages/italian.txt b/data/languages/italian.txt index 4befc772..9ec49350 100644 --- a/data/languages/italian.txt +++ b/data/languages/italian.txt @@ -271,8 +271,8 @@ Prev. weapon Quality Textures == Textures di qualità -Quick search -== Ricerca rapida +Quick search: +== Ricerca rapida: Quit == Esci @@ -438,5 +438,8 @@ Show chat Your skin == Your skin +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index 3f811a6d..90521ecc 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Texturas de Qualidade -Quick search -== Pesquisa Rápida +Quick search: +== Pesquisa Rápida: Quit == Sair @@ -438,5 +438,8 @@ Your skin Show chat == Show chat +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt index 627f3fa0..de64615f 100644 --- a/data/languages/swedish.txt +++ b/data/languages/swedish.txt @@ -271,8 +271,8 @@ Prev. weapon Quality Textures == Kvalitetstexturer -Quick search -== Snabbsök +Quick search: +== Snabbsök: Quit == Avsluta @@ -438,5 +438,8 @@ Show chat Your skin == Your skin +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 585c6d7a..b752f8cb 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -840,7 +840,7 @@ int CMenus::Render() } else if(m_Popup == POPUP_PASSWORD) { - pTitle = Localize("Password Incorrect"); + pTitle = Localize("Password incorrect"); pExtraText = Client()->ErrorString(); pButtonText = Localize("Try again"); } -- cgit 1.4.1 From 7cbf0f93cacdd694e61961e18d44921881e3d489 Mon Sep 17 00:00:00 2001 From: Fujnky Date: Wed, 2 Jun 2010 21:03:15 +0200 Subject: Some localization fixes --- data/languages/czech.txt | 7 +++++-- data/languages/dutch.txt | 7 +++++-- data/languages/french.txt | 7 +++++-- data/languages/german.txt | 7 +++++-- data/languages/italian.txt | 7 +++++-- data/languages/portuguese.txt | 7 +++++-- data/languages/swedish.txt | 7 +++++-- src/game/client/components/menus.cpp | 2 +- 8 files changed, 36 insertions(+), 15 deletions(-) diff --git a/data/languages/czech.txt b/data/languages/czech.txt index 652c4089..c788edcf 100644 --- a/data/languages/czech.txt +++ b/data/languages/czech.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Kvalitní textury -Quick search -== Rychlé hledání +Quick search: +== Rychlé hledání: Quit == Ukončit @@ -438,5 +438,8 @@ Your skin Show chat == Show chat +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt index 1ec28c8d..fe9c65b8 100644 --- a/data/languages/dutch.txt +++ b/data/languages/dutch.txt @@ -273,8 +273,8 @@ Prev. weapon Quality Textures == Kwalteit Textures -Quick search -== Snel Zoken +Quick search: +== Snel Zoken: Quit == Stoppen @@ -437,4 +437,7 @@ Show chat Your skin == Your skin +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/french.txt b/data/languages/french.txt index 9d7bcd40..fa360da9 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Textures haute qualité -Quick search -== Recherche rapide +Quick search: +== Recherche rapide: Quit == Quitter @@ -438,5 +438,8 @@ Your skin ##### needs translation #### +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/german.txt b/data/languages/german.txt index 967c3f5b..235e08ec 100644 --- a/data/languages/german.txt +++ b/data/languages/german.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Hochaufgelöste Texturen -Quick search -== Schnelle Suche +Quick search: +== Schnellsuche: Quit == Beenden @@ -436,6 +436,9 @@ You must restart the game for all settings to take effect. Your skin == Dein Skin +Password incorrect +== Passwort falsch + ##### needs translation #### diff --git a/data/languages/italian.txt b/data/languages/italian.txt index 4befc772..9ec49350 100644 --- a/data/languages/italian.txt +++ b/data/languages/italian.txt @@ -271,8 +271,8 @@ Prev. weapon Quality Textures == Textures di qualità -Quick search -== Ricerca rapida +Quick search: +== Ricerca rapida: Quit == Esci @@ -438,5 +438,8 @@ Show chat Your skin == Your skin +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index 64bf7e6c..cb76f50e 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -274,8 +274,8 @@ Prev. weapon Quality Textures == Texturas de Qualidade -Quick search -== Pesquisa Rápida +Quick search: +== Pesquisa Rápida: Quit == Sair @@ -439,5 +439,8 @@ Your skin ##### needs translation #### +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt index 627f3fa0..de64615f 100644 --- a/data/languages/swedish.txt +++ b/data/languages/swedish.txt @@ -271,8 +271,8 @@ Prev. weapon Quality Textures == Kvalitetstexturer -Quick search -== Snabbsök +Quick search: +== Snabbsök: Quit == Avsluta @@ -438,5 +438,8 @@ Show chat Your skin == Your skin +Password incorrect +== Password incorrect + ##### old translations #### diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 585c6d7a..b752f8cb 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -840,7 +840,7 @@ int CMenus::Render() } else if(m_Popup == POPUP_PASSWORD) { - pTitle = Localize("Password Incorrect"); + pTitle = Localize("Password incorrect"); pExtraText = Client()->ErrorString(); pButtonText = Localize("Try again"); } -- cgit 1.4.1 From d581e413c8fa94e4d1069b20bbe4edf1ebe2dbff Mon Sep 17 00:00:00 2001 From: Fujnky Date: Thu, 3 Jun 2010 11:30:05 +0200 Subject: More localization fixes --- data/languages/czech.txt | 15 +++++++++++++++ data/languages/dutch.txt | 15 +++++++++++++++ data/languages/french.txt | 15 +++++++++++++++ data/languages/german.txt | 15 +++++++++++++++ data/languages/italian.txt | 15 +++++++++++++++ data/languages/portuguese.txt | 16 +++++++++++++++- data/languages/swedish.txt | 15 +++++++++++++++ src/game/client/components/hud.cpp | 12 ++++++------ 8 files changed, 111 insertions(+), 7 deletions(-) diff --git a/data/languages/czech.txt b/data/languages/czech.txt index c788edcf..d13c140a 100644 --- a/data/languages/czech.txt +++ b/data/languages/czech.txt @@ -441,5 +441,20 @@ Show chat Password incorrect == Password incorrect +Please balance teams! +== Please balance teams! + +Connection Problems... +== Connection Problems... + +Warmup +== Warmup + +Sudden Death +== Sudden Death + +%ds left +== %ds left + ##### old translations #### diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt index fe9c65b8..f0fd647e 100644 --- a/data/languages/dutch.txt +++ b/data/languages/dutch.txt @@ -440,4 +440,19 @@ Your skin Password incorrect == Password incorrect +Please balance teams! +== Please balance teams! + +Connection Problems... +== Connection Problems... + +Warmup +== Warmup + +Sudden Death +== Sudden Death + +%ds left +== %ds left + ##### old translations #### diff --git a/data/languages/french.txt b/data/languages/french.txt index fa360da9..9f0fdee3 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -441,5 +441,20 @@ Your skin Password incorrect == Password incorrect +Please balance teams! +== Please balance teams! + +Connection Problems... +== Connection Problems... + +Warmup +== Warmup + +Sudden Death +== Sudden Death + +%ds left +== %ds left + ##### old translations #### diff --git a/data/languages/german.txt b/data/languages/german.txt index 235e08ec..684ce4ee 100644 --- a/data/languages/german.txt +++ b/data/languages/german.txt @@ -439,6 +439,21 @@ Your skin Password incorrect == Passwort falsch +Please balance teams! +== Bitte Teams ausgleichen! + +Connection Problems... +== Verbindungsprobleme... + +Warmup +== Aufwärmen + +Sudden Death +== Sudden Death + +%ds left +== Noch %ds + ##### needs translation #### diff --git a/data/languages/italian.txt b/data/languages/italian.txt index 9ec49350..806da7c1 100644 --- a/data/languages/italian.txt +++ b/data/languages/italian.txt @@ -441,5 +441,20 @@ Your skin Password incorrect == Password incorrect +Please balance teams! +== Please balance teams! + +Connection Problems... +== Connection Problems... + +Warmup +== Warmup + +Sudden Death +== Sudden Death + +%ds left +== %ds left + ##### old translations #### diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index cb76f50e..13f7cc1d 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -438,9 +438,23 @@ Your skin ##### needs translation #### - Password incorrect == Password incorrect +Please balance teams! +== Please balance teams! + +Connection Problems... +== Connection Problems... + +Warmup +== Warmup + +Sudden Death +== Sudden Death + +%ds left +== %ds left + ##### old translations #### diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt index de64615f..c5eee40a 100644 --- a/data/languages/swedish.txt +++ b/data/languages/swedish.txt @@ -441,5 +441,20 @@ Your skin Password incorrect == Password incorrect +Please balance teams! +== Please balance teams! + +Connection Problems... +== Connection Problems... + +Warmup +== Warmup + +Sudden Death +== Sudden Death + +%ds left +== %ds left + ##### old translations #### diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index fd44af41..a3ae5a4d 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -56,7 +56,7 @@ void CHud::RenderSuddenDeath() if(m_pClient->m_Snap.m_pGameobj->m_SuddenDeath) { float Half = 300.0f*Graphics()->ScreenAspect()/2.0f; - const char *pText = "Sudden Death"; + const char *pText = Localize("Sudden Death"); float FontSize = 12.0f; float w = TextRender()->TextWidth(0, FontSize, pText, -1); TextRender()->Text(0, Half-w/2, 2, FontSize, pText, -1); @@ -133,8 +133,8 @@ void CHud::RenderWarmupTimer() { char Buf[256]; float FontSize = 20.0f; - float w = TextRender()->TextWidth(0, FontSize, "Warmup", -1); - TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 50, FontSize, "Warmup", -1); + float w = TextRender()->TextWidth(0, FontSize, Localize("Warmup"), -1); + TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 50, FontSize, Localize("Warmup"), -1); int Seconds = m_pClient->m_Snap.m_pGameobj->m_Warmup/SERVER_TICK_SPEED; if(Seconds < 5) @@ -171,7 +171,7 @@ void CHud::RenderConnectionWarning() { if(Client()->ConnectionProblems()) { - const char *pText = "Connection Problems..."; + const char *pText = Localize("Connection Problems..."); float w = TextRender()->TextWidth(0, 24, pText, -1); TextRender()->Text(0, 150*Graphics()->ScreenAspect()-w/2, 50, 24, pText, -1); } @@ -186,7 +186,7 @@ void CHud::RenderTeambalanceWarning() int TeamDiff = m_pClient->m_Snap.m_aTeamSize[0]-m_pClient->m_Snap.m_aTeamSize[1]; if (g_Config.m_ClWarningTeambalance && (TeamDiff >= 2 || TeamDiff <= -2)) { - const char *pText = "Please balance teams!"; + const char *pText = Localize("Please balance teams!"); if(Flash) TextRender()->TextColor(1,1,0.5f,1); else @@ -214,7 +214,7 @@ void CHud::RenderVoting() char Buf[512]; TextRender()->Text(0x0, 5, 60, 6, m_pClient->m_pVoting->VoteDescription(), -1); - str_format(Buf, sizeof(Buf), "%ds left", m_pClient->m_pVoting->SecondsLeft()); + str_format(Buf, sizeof(Buf), Localize("%ds left"), m_pClient->m_pVoting->SecondsLeft()); float tw = TextRender()->TextWidth(0x0, 6, Buf, -1); TextRender()->Text(0x0, 5+100-tw, 60, 6, Buf, -1); -- cgit 1.4.1 From 5988b9d38801f0987f38c99fb944e1a861d07ef3 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 3 Jun 2010 14:48:32 +0200 Subject: - show connecting players with rcon status command - make it possible to limit the number of clients with the same ip that can connect to the server --- src/engine/server/server.cpp | 23 +++++++++++++++++----- src/engine/server/server.h | 1 + src/engine/shared/config_variables.h | 1 + src/engine/shared/network.h | 6 +++++- src/engine/shared/network_server.cpp | 37 +++++++++++++++++++++++++++++++++++- src/tools/fake_server.cpp | 2 +- 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index b5a01a99..2545103b 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1018,7 +1018,7 @@ int CServer::Run() } - if(!m_NetServer.Open(BindAddr, g_Config.m_SvMaxClients, 0)) + if(!m_NetServer.Open(BindAddr, g_Config.m_SvMaxClients, g_Config.m_SvMaxClientsPerIP, 0)) { dbg_msg("server", "couldn't open socket. port might already be in use"); return -1; @@ -1250,12 +1250,16 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser) for(i = 0; i < MAX_CLIENTS; i++) { - if(pServer->m_aClients[i].m_State == CClient::STATE_INGAME) + if(pServer->m_aClients[i].m_State != CClient::STATE_EMPTY) { Addr = pServer->m_NetServer.ClientAddr(i); - str_format(aBuf, sizeof(aBuf), "id=%d addr=%d.%d.%d.%d:%d name='%s' score=%d", - i, Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3], Addr.port, - pServer->m_aClients[i].m_aName, pServer->m_aClients[i].m_Score); + if(pServer->m_aClients[i].m_State == CClient::STATE_INGAME) + str_format(aBuf, sizeof(aBuf), "id=%d addr=%d.%d.%d.%d:%d name='%s' score=%d", + i, Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3], Addr.port, + pServer->m_aClients[i].m_aName, pServer->m_aClients[i].m_Score); + else + str_format(aBuf, sizeof(aBuf), "id=%d addr=%d.%d.%d.%d:%d connecting", + i, Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3], Addr.port); pServer->Console()->Print(aBuf); dbg_msg("server", "%s", aBuf); } @@ -1291,6 +1295,13 @@ void CServer::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserD ((CServer *)pUserData)->UpdateServerInfo(); } +void CServer::ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData) +{ + pfnCallback(pResult, pCallbackUserData); + if(pResult->NumArguments()) + ((CServer *)pUserData)->m_NetServer.SetMaxClientsPerIP(pResult->GetInteger(0)); +} + void CServer::RegisterCommands() { m_pConsole = Kernel()->RequestInterface(); @@ -1309,6 +1320,8 @@ void CServer::RegisterCommands() Console()->Chain("sv_name", ConchainSpecialInfoupdate, this); Console()->Chain("password", ConchainSpecialInfoupdate, this); + + Console()->Chain("sv_max_clients_per_ip", ConchainMaxclientsperipUpdate, this); } diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 895a4bd1..70c8899c 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -185,6 +185,7 @@ public: static void ConStopRecord(IConsole::IResult *pResult, void *pUser); static void ConMapReload(IConsole::IResult *pResult, void *pUser); static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); + static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); void RegisterCommands(); diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index cc36b932..e11eab6d 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -64,6 +64,7 @@ MACRO_CONFIG_INT(SvPort, sv_port, 8303, 0, 0, CFGFLAG_SERVER, "Port to use for t MACRO_CONFIG_INT(SvExternalPort, sv_external_port, 0, 0, 0, CFGFLAG_SERVER, "External port to report to the master servers") MACRO_CONFIG_STR(SvMap, sv_map, 128, "dm1", CFGFLAG_SERVER, "Map to use on the server") MACRO_CONFIG_INT(SvMaxClients, sv_max_clients, 8, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients that are allowed on a server") +MACRO_CONFIG_INT(SvMaxClientsPerIP, sv_max_clients_per_ip, 8, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients with the same IP that can connect to the server") MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only") MACRO_CONFIG_INT(SvRegister, sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing") MACRO_CONFIG_STR(SvRconPassword, sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password") diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h index 11a1b70d..7de534a4 100644 --- a/src/engine/shared/network.h +++ b/src/engine/shared/network.h @@ -244,6 +244,7 @@ private: NETSOCKET m_Socket; CSlot m_aSlots[NET_MAX_CLIENTS]; int m_MaxClients; + int m_MaxClientsPerIP; CBan *m_aBans[256]; CBan m_BanPool[NET_SERVER_MAXBANS]; @@ -262,7 +263,7 @@ public: int SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser); // - bool Open(NETADDR BindAddr, int MaxClients, int Flags); + bool Open(NETADDR BindAddr, int MaxClients, int MaxClientsPerIP, int Flags); int Close(); // @@ -283,6 +284,9 @@ public: NETADDR ClientAddr(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddress(); } NETSOCKET Socket() const { return m_Socket; } int MaxClients() const { return m_MaxClients; } + + // + void SetMaxClientsPerIP(int Max); }; diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index 32b08bf6..2d30a7d1 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -24,7 +24,7 @@ #define MACRO_LIST_FIND(Start, Next, Expression) \ { while(Start && !(Expression)) Start = Start->Next; } -bool CNetServer::Open(NETADDR BindAddr, int MaxClients, int Flags) +bool CNetServer::Open(NETADDR BindAddr, int MaxClients, int MaxClientsPerIP, int Flags) { // zero out the whole structure mem_zero(this, sizeof(*this)); @@ -40,6 +40,8 @@ bool CNetServer::Open(NETADDR BindAddr, int MaxClients, int Flags) m_MaxClients = NET_MAX_CLIENTS; if(m_MaxClients < 1) m_MaxClients = 1; + + m_MaxClientsPerIP = MaxClientsPerIP; for(int i = 0; i < NET_MAX_CLIENTS; i++) m_aSlots[i].m_Connection.Init(m_Socket); @@ -335,6 +337,29 @@ int CNetServer::Recv(CNetChunk *pChunk) // client that wants to connect if(!Found) { + // only allow a specific number of players with the same ip + NETADDR ThisAddr = Addr, OtherAddr; + int FoundAddr = 1; + ThisAddr.port = 0; + for(int i = 0; i < MaxClients(); ++i) + { + if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_OFFLINE) + continue; + + OtherAddr = m_aSlots[i].m_Connection.PeerAddress(); + OtherAddr.port = 0; + if(!net_addr_comp(&ThisAddr, &OtherAddr)) + { + if(FoundAddr++ >= m_MaxClientsPerIP) + { + char aBuf[128]; + str_format(aBuf, sizeof(aBuf), "only %i players with same ip allowed", m_MaxClientsPerIP); + CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, aBuf, sizeof(aBuf)); + return 0; + } + } + } + for(int i = 0; i < MaxClients(); i++) { if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_OFFLINE) @@ -411,3 +436,13 @@ int CNetServer::Send(CNetChunk *pChunk) return 0; } +void CNetServer::SetMaxClientsPerIP(int Max) +{ + // clamp + if(Max < 1) + Max = 1; + else if(Max > NET_MAX_CLIENTS) + Max = NET_MAX_CLIENTS; + + m_MaxClientsPerIP = Max; +} diff --git a/src/tools/fake_server.cpp b/src/tools/fake_server.cpp index b833c1b1..9442c7ba 100644 --- a/src/tools/fake_server.cpp +++ b/src/tools/fake_server.cpp @@ -111,7 +111,7 @@ static int Run() int64 NextHeartBeat = 0; NETADDR BindAddr = {NETTYPE_IPV4, {0},0}; - if(!pNet->Open(BindAddr, 0, 0)) + if(!pNet->Open(BindAddr, 0, 0, 0)) return 0; while(1) -- cgit 1.4.1