about summary refs log tree commit diff
path: root/src/game/server/hooks.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2009-01-11 15:16:34 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2009-01-11 15:16:34 +0000
commit6b886e8ed6ae378e0f8e23dda148cb86083d9657 (patch)
tree5d19a6e06debaa72bc21d5a730295857f194970d /src/game/server/hooks.cpp
parentf29276e8d544f77e6297ece5264b451740f0c19e (diff)
downloadzcatch-6b886e8ed6ae378e0f8e23dda148cb86083d9657.tar.gz
zcatch-6b886e8ed6ae378e0f8e23dda148cb86083d9657.zip
fixed so that the tuning is resetting itself if running a pure server
Diffstat (limited to 'src/game/server/hooks.cpp')
-rw-r--r--src/game/server/hooks.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game/server/hooks.cpp b/src/game/server/hooks.cpp
index f4ef4686..8ce2cf56 100644
--- a/src/game/server/hooks.cpp
+++ b/src/game/server/hooks.cpp
@@ -25,6 +25,21 @@ extern "C"
 
 TUNING_PARAMS tuning;
 
+static void check_pure_tuning()
+{
+	if(	strcmp(game.controller->gametype, "DM")==0 ||
+		strcmp(game.controller->gametype, "TDM")==0 ||
+		strcmp(game.controller->gametype, "CTF")==0)
+	{
+		TUNING_PARAMS p;
+		if(memcmp(&p, &tuning, sizeof(TUNING_PARAMS)) != 0)
+		{
+			dbg_msg("server", "resetting tuning due to pure server");
+			tuning = p;
+		}
+	}	
+}
+
 struct VOTEOPTION
 {
 	VOTEOPTION *next;
@@ -38,6 +53,8 @@ static VOTEOPTION *voteoption_last = 0;
 
 void send_tuning_params(int cid)
 {
+	check_pure_tuning();
+	
 	msg_pack_start(NETMSGTYPE_SV_TUNEPARAMS, MSGFLAG_VITAL);
 	int *params = (int *)&tuning;
 	for(unsigned i = 0; i < sizeof(tuning)/sizeof(int); i++)
@@ -62,6 +79,8 @@ void mods_client_predicted_input(int client_id, void *input)
 // Server hooks
 void mods_tick()
 {
+	check_pure_tuning();
+	
 	game.tick();
 
 	if(config.dbg_dummies)