r2056 - branches/nexuiz-2.0/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Dec 18 04:19:33 EST 2006


Author: div0
Date: 2006-12-18 04:19:33 -0500 (Mon, 18 Dec 2006)
New Revision: 2056

Modified:
   branches/nexuiz-2.0/data/qcsrc/server/bots.qc
   branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc
   branches/nexuiz-2.0/data/qcsrc/server/defs.qh
   branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
Log:
quit_when_empty


Modified: branches/nexuiz-2.0/data/qcsrc/server/bots.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/bots.qc	2006-12-18 08:53:29 UTC (rev 2055)
+++ branches/nexuiz-2.0/data/qcsrc/server/bots.qc	2006-12-18 09:19:33 UTC (rev 2056)
@@ -1239,7 +1239,6 @@
 .float isbot; // true if this client is actually a bot
 
 float skill;
-float currentbots;
 entity bot_list;
 .entity nextbot;
 

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc	2006-12-18 08:53:29 UTC (rev 2055)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc	2006-12-18 09:19:33 UTC (rev 2056)
@@ -668,7 +668,11 @@
 	self.flags = self.flags | FL_CLIENT;
 	self.version_nagtime = time + 10 + random() * 10;
 
-	if(player_count<0) player_count = 0;
+	if(player_count<0)
+	{
+		dprint("BUG player count is lower than zero, this cannot happen!\n");
+		player_count = 0;
+	}
 
 	bot_clientconnect();
 

Modified: branches/nexuiz-2.0/data/qcsrc/server/defs.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2006-12-18 08:53:29 UTC (rev 2055)
+++ branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2006-12-18 09:19:33 UTC (rev 2056)
@@ -5,6 +5,7 @@
 string	string_null;
 
 float player_count;
+float currentbots;
 float lms_lowest_lives;
 float lms_next_place;
 float() LMS_NewPlayerLives;

Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2006-12-18 08:53:29 UTC (rev 2055)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2006-12-18 09:19:33 UTC (rev 2056)
@@ -591,6 +591,15 @@
 		return;
 	}
 
+	if(cvar("quit_when_empty"))
+	{
+		if(player_count <= currentbots)
+		{
+			localcmd("quit\n");
+			return;
+		}
+	}
+
 	if (cvar("samelevel")) // if samelevel is set, stay on same level
 	{
 		// this does not work because it tries to exec maps/nexdm01.mapcfg (which doesn't exist, it should be trying maps/dm_nexdm01.mapcfg for example)




More information about the nexuiz-commits mailing list