about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius "Teelevision" Neugebauer <marius@teele.eu>2014-03-26 19:18:04 +0100
committerMarius "Teelevision" Neugebauer <marius@teele.eu>2014-03-26 19:18:04 +0100
commit58246b4a528d92b2d0863ca7f3e085fbe7c2ecc8 (patch)
treed0c86f03ac67f1602fa6b02937f48e0bd7d62dd3
parent4affc155a906b6091aafc3f9635acc3b8b0aed8a (diff)
downloadzcatch-58246b4a528d92b2d0863ca7f3e085fbe7c2ecc8.tar.gz
zcatch-58246b4a528d92b2d0863ca7f3e085fbe7c2ecc8.zip
initial zCatch/TeeVi commit
-rw-r--r--license.txt31
-rw-r--r--readme.txt28
-rw-r--r--src/engine/server/server.cpp17
-rw-r--r--src/engine/server/server.h11
-rw-r--r--src/engine/shared/config_variables.h2
-rw-r--r--src/game/server/gamemodes/zcatch.cpp3
6 files changed, 79 insertions, 13 deletions
diff --git a/license.txt b/license.txt
index 24b0564f..5241dee5 100644
--- a/license.txt
+++ b/license.txt
@@ -1,3 +1,34 @@
+This software called "zCatch/TeeVi" is a modification of "zCatch" which is
+a modification of "Teeworlds".
+
+#############################################################################
+The following license applies only to "zCatch/TeeVi":
+#############################################################################
+
+Copyright (c) 2014 Marius "Teelevision" Neugebauer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+#############################################################################
+The following is the license that "zCatch" was distributed under:
+#############################################################################
+
 Copyright (C) 2007-2012 Magnus Auvinen
 
 This software is provided 'as-is', without any express or implied
diff --git a/readme.txt b/readme.txt
index 6469b492..7ddaa340 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,10 +1,18 @@
-Copyright (c) 2012 Magnus Auvinen

-

-

-This software is provided 'as-is', without any express or implied

-warranty. In no event will the authors be held liable for any damages

-arising from the use of this software.

-

-

-Please visit http://www.teeworlds.com for up-to-date information about 

-the game, including new versions, custom maps and much more.

+This software called "zCatch/TeeVi" is a modification of "zCatch" which is
+a modification of "Teeworlds".
+See license.txt.
+
+#############################################################################
+The following is the content of the readme.txt distributed with zCatch:
+#############################################################################
+
+Copyright (c) 2012 Magnus Auvinen
+
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+
+Please visit http://www.teeworlds.com for up-to-date information about 
+the game, including new versions, custom maps and much more.
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;
 }