Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] (PR#15087) let quitidle work in pregame
Home

[Freeciv-Dev] (PR#15087) let quitidle work in pregame

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#15087) let quitidle work in pregame
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Jan 2006 00:15:55 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15087 >

quitidle doesn't apply during pregame.  On pubserver this means you can 
connect, change all settings, and leave, and nobody will know.

This patch fixes it.  quitidle takes effect as soon as the first player 
connects.

-jason

Index: server/sernet.c
===================================================================
--- server/sernet.c     (revision 11421)
+++ server/sernet.c     (working copy)
@@ -479,11 +479,16 @@
 
     get_lanserver_announcement();
 
-    /* end server if no players for 'srvarg.quitidle' seconds */
-    if (srvarg.quitidle != 0 && server_state != PRE_GAME_STATE) {
+    /* end server if no players for 'srvarg.quitidle' seconds,
+     * but only if at least one player has previously connected. */
+    if (srvarg.quitidle != 0) {
       static time_t last_noplayers;
+      static bool connections;
 
-      if (conn_list_size(game.est_connections) == 0) {
+      if (conn_list_size(game.est_connections) > 0) {
+       connections = TRUE;
+      }
+      if (connections && conn_list_size(game.est_connections) == 0) {
        if (last_noplayers != 0) {
          if (time(NULL) > last_noplayers + srvarg.quitidle) {
            save_game_auto("Lost all connections");
Index: data/civserver.dsc.in
===================================================================
--- data/civserver.dsc.in       (revision 11421)
+++ data/civserver.dsc.in       (working copy)
@@ -19,8 +19,8 @@
 # Freeciv bots are handled internally, but aren't visible to GGZ
 #BotsAllowed = 
 PlayersAllowed = 1..30
-# This should be 0, but civserver doesn't exit correctly in pregame
-KillWhenEmpty = 1
+# Because of -q 180 -e options, above
+KillWhenEmpty = 0
 AllowSpectators = 0
 
 [Statistics]

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#15087) let quitidle work in pregame, Jason Short <=