Map cycle breaks on empty or bot only servers

Ben Noordhuis bnoordhuis at gmail.com
Sat Mar 31 04:18:21 EDT 2007


Dear all,

This is the e-mail accompanying
https://bugzilla.icculus.org/show_bug.cgi?id=3076 - I hereby submit to
your approval a patch to remedy the behavior as described both below
and in the bug report:

***
The summary says it all, really: due to a logic error in code/g_main.c's
CheckIntermissionExit(), the ExitLevel() function is never called if the server
is empty or populated by bots only and the server thus remains in intermission
mode indefinitely.

Reproducibility: always
***

For completeness sake, I have attached the patch to this message also.
Sincerely,

Ben Noordhuis a.k.a. mis
-------------- next part --------------
Index: code/game/g_main.c
===================================================================
--- code/game/g_main.c	(revision 1053)
+++ code/game/g_main.c	(working copy)
@@ -1189,7 +1189,7 @@
 =================
 */
 void CheckIntermissionExit( void ) {
-	int			ready, notReady;
+	int			ready, notReady, playerCount;
 	int			i;
 	gclient_t	*cl;
 	int			readyMask;
@@ -1202,8 +1202,9 @@
 	ready = 0;
 	notReady = 0;
 	readyMask = 0;
+	playerCount = 0;
 	for (i=0 ; i< g_maxclients.integer ; i++) {
-		cl = level.clients + i;
+ 		cl = level.clients + i;
 		if ( cl->pers.connected != CON_CONNECTED ) {
 			continue;
 		}
@@ -1211,6 +1212,7 @@
 			continue;
 		}
 
+		playerCount++;
 		if ( cl->readyToExit ) {
 			ready++;
 			if ( i < 16 ) {
@@ -1236,16 +1238,21 @@
 		return;
 	}
 
-	// if nobody wants to go, clear timer
-	if ( !ready ) {
-		level.readyToExit = qfalse;
-		return;
-	}
+	// 070331 mis - empty or bot only servers make the server
+	// hang indefinitely in the intermission, so execute the
+	// logic below only if there are any *real* players here.
+	if ( playerCount > 0 ) {
+		// if nobody wants to go, clear timer
+		if ( !ready ) {
+			level.readyToExit = qfalse;
+			return;
+		}
 
-	// if everyone wants to go, go now
-	if ( !notReady ) {
-		ExitLevel();
-		return;
+		// if everyone wants to go, go now
+		if ( !notReady ) {
+			ExitLevel();
+			return;
+		}
 	}
 
 	// the first person to ready starts the ten second timeout


More information about the quake3 mailing list