diff options
| author | Marius "Teelevision" Neugebauer <marius@teele.eu> | 2014-03-26 19:18:04 +0100 |
|---|---|---|
| committer | Marius "Teelevision" Neugebauer <marius@teele.eu> | 2014-03-26 19:18:04 +0100 |
| commit | 58246b4a528d92b2d0863ca7f3e085fbe7c2ecc8 (patch) | |
| tree | d0c86f03ac67f1602fa6b02937f48e0bd7d62dd3 /src | |
| parent | 4affc155a906b6091aafc3f9635acc3b8b0aed8a (diff) | |
| download | zcatch-58246b4a528d92b2d0863ca7f3e085fbe7c2ecc8.tar.gz zcatch-58246b4a528d92b2d0863ca7f3e085fbe7c2ecc8.zip | |
initial zCatch/TeeVi commit
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/server/server.cpp | 17 | ||||
| -rw-r--r-- | src/engine/server/server.h | 11 | ||||
| -rw-r--r-- | src/engine/shared/config_variables.h | 2 | ||||
| -rw-r--r-- | src/game/server/gamemodes/zcatch.cpp | 3 |
4 files changed, 30 insertions, 3 deletions
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 4fa872eb..4be9809b 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modified by Teelevision for zCatch/TeeVi, see readme.txt and license.txt. */ #include <base/math.h> #include <base/system.h> @@ -299,7 +300,10 @@ CServer::CServer() : m_DemoRecorder(&m_SnapshotDelta) m_RconClientID = IServer::RCON_CID_SERV; m_RconAuthLevel = AUTHED_ADMIN; - + + // when starting there are no admins + numLoggedInAdmins = 0; + Init(); } @@ -728,6 +732,11 @@ int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser) // notify the mod about the drop if(pThis->m_aClients[ClientID].m_State >= CClient::STATE_READY) pThis->GameServer()->OnClientDrop(ClientID, pReason); + + // check if dropped player is admin + if (pThis->m_aClients[ClientID].m_Authed == AUTHED_ADMIN) { + pThis->DecreaseLoggedInAdmins(); + } pThis->m_aClients[ClientID].m_State = CClient::STATE_EMPTY; pThis->m_aClients[ClientID].m_aName[0] = 0; @@ -1017,6 +1026,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) char aBuf[256]; str_format(aBuf, sizeof(aBuf), "ClientID=%d authed (admin)", ClientID); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); + IncreaseLoggedInAdmins(); } else if(g_Config.m_SvRconModPassword[0] && str_comp(pPw, g_Config.m_SvRconModPassword) == 0) { @@ -1115,7 +1125,8 @@ void CServer::SendServerInfo(const NETADDR *pAddr, int Token) p.AddString(aBuf, 6); p.AddString(GameServer()->Version(), 32); - p.AddString(g_Config.m_SvName, 64); + // send the alternative server name when a admin is online + p.AddString((numLoggedInAdmins && str_length(g_Config.m_SvNameAdmin)) ? g_Config.m_SvNameAdmin : g_Config.m_SvName, 64); p.AddString(GetMapName(), 32); // gametype @@ -1559,6 +1570,7 @@ void CServer::ConLogout(IConsole::IResult *pResult, void *pUser) char aBuf[32]; str_format(aBuf, sizeof(aBuf), "ClientID=%d logged out", pServer->m_RconClientID); pServer->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); + pServer->DecreaseLoggedInAdmins(); } } @@ -1634,6 +1646,7 @@ void CServer::RegisterCommands() Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, ""); Console()->Chain("sv_name", ConchainSpecialInfoupdate, this); + Console()->Chain("sv_name_admin", 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 4a1f7344..0d14d53e 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modified by Teelevision for zCatch/TeeVi, see readme.txt and license.txt. */ #ifndef ENGINE_SERVER_SERVER_H #define ENGINE_SERVER_SERVER_H @@ -64,6 +65,16 @@ class CServer : public IServer class IGameServer *m_pGameServer; class IConsole *m_pConsole; class IStorage *m_pStorage; + + // keep track of how many admins are logged in + int numLoggedInAdmins; + void DecreaseLoggedInAdmins() { + if (--numLoggedInAdmins < 1) UpdateServerInfo(); + } + void IncreaseLoggedInAdmins() { + if (++numLoggedInAdmins) UpdateServerInfo(); + } + public: class IGameServer *GameServer() { return m_pGameServer; } class IConsole *Console() { return m_pConsole; } diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index c588be5c..2a43f6d0 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +/* Modified by Teelevision for zCatch/TeeVi, see readme.txt and license.txt. */ #ifndef ENGINE_SHARED_CONFIG_VARIABLES_H #define ENGINE_SHARED_CONFIG_VARIABLES_H #undef ENGINE_SHARED_CONFIG_VARIABLES_H // this file will be included several times @@ -79,6 +80,7 @@ MACRO_CONFIG_INT(GfxThreaded, gfx_threaded, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity") MACRO_CONFIG_STR(SvName, sv_name, 128, "unnamed server", CFGFLAG_SERVER, "Server name") +MACRO_CONFIG_STR(SvNameAdmin, sv_name_admin, 128, "", CFGFLAG_SERVER, "Server name when an admin is logged in") MACRO_CONFIG_STR(Bindaddr, bindaddr, 128, "", CFGFLAG_CLIENT|CFGFLAG_SERVER|CFGFLAG_MASTER, "Address to bind the client/server to") MACRO_CONFIG_INT(SvPort, sv_port, 8303, 0, 0, CFGFLAG_SERVER, "Port to use for the server") MACRO_CONFIG_INT(SvExternalPort, sv_external_port, 0, 0, 0, CFGFLAG_SERVER, "External port to report to the master servers") diff --git a/src/game/server/gamemodes/zcatch.cpp b/src/game/server/gamemodes/zcatch.cpp index 9bf12374..bb6f9ec3 100644 --- a/src/game/server/gamemodes/zcatch.cpp +++ b/src/game/server/gamemodes/zcatch.cpp @@ -1,6 +1,7 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ /* zCatch by erd and Teetime */ +/* Modified by Teelevision for zCatch/TeeVi, see readme.txt and license.txt. */ #include <engine/shared/config.h> #include <game/server/gamecontext.h> @@ -12,7 +13,7 @@ CGameController_zCatch::CGameController_zCatch(class CGameContext *pGameServer) : IGameController(pGameServer) { - m_pGameType = "zCatch"; + m_pGameType = "zCatch/TeeVi"; m_OldMode = g_Config.m_SvMode; } |