From 7bd79f9f4399c63d2d9cd77d7cb2ff58b84d5e32 Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 27 Mar 2011 18:05:11 +0200 Subject: added remove_favorite command by Choupom --- src/engine/client/client.cpp | 9 +++++++++ src/engine/client/client.h | 1 + src/game/client/components/menus.cpp | 1 + 3 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 297828dc..198f5f1a 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2134,6 +2134,14 @@ void CClient::Con_AddFavorite(IConsole::IResult *pResult, void *pUserData) pSelf->m_ServerBrowser.AddFavorite(Addr); } +void CClient::Con_RemoveFavorite(IConsole::IResult *pResult, void *pUserData) +{ + CClient *pSelf = (CClient *)pUserData; + NETADDR Addr; + if(net_addr_from_str(&Addr, pResult->GetString(0)) == 0) + pSelf->m_ServerBrowser.RemoveFavorite(Addr); +} + const char *CClient::DemoPlayer_Play(const char *pFilename, int StorageType) { int Crc; @@ -2285,6 +2293,7 @@ void CClient::RegisterCommands() m_pConsole->Register("record", "?s", CFGFLAG_CLIENT, Con_Record, this, "Record to the file"); m_pConsole->Register("stoprecord", "", CFGFLAG_CLIENT, Con_StopRecord, this, "Stop recording"); m_pConsole->Register("add_favorite", "s", CFGFLAG_CLIENT, Con_AddFavorite, this, "Add a server as a favorite"); + m_pConsole->Register("remove_favorite", "s", CFGFLAG_CLIENT, Con_RemoveFavorite, this, "Remove a server from favorites"); // used for server browser update m_pConsole->Chain("br_filter_string", ConchainServerBrowserUpdate, this); diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 31364cd2..b0696b96 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -303,6 +303,7 @@ public: static void Con_Rcon(IConsole::IResult *pResult, void *pUserData); static void Con_RconAuth(IConsole::IResult *pResult, void *pUserData); static void Con_AddFavorite(IConsole::IResult *pResult, void *pUserData); + static void Con_RemoveFavorite(IConsole::IResult *pResult, void *pUserData); static void Con_Play(IConsole::IResult *pResult, void *pUserData); static void Con_Record(IConsole::IResult *pResult, void *pUserData); static void Con_StopRecord(IConsole::IResult *pResult, void *pUserData); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 7264e412..b7328e06 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -721,6 +721,7 @@ void CMenus::OnInit() g_Config.m_ClShowWelcome = 0; Console()->Chain("add_favorite", ConchainServerbrowserUpdate, this); + Console()->Chain("remove_favorite", ConchainServerbrowserUpdate, this); // setup load amount m_LoadCurrent = 0; -- cgit 1.4.1