Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] Re: (PR#11688) civserver still runs when client has stoppe
Home

[Freeciv-Dev] Re: (PR#11688) civserver still runs when client has stoppe

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: benoithudson+freeciv@xxxxxxxxx, carllobo@xxxxxxxxx, chrisk@xxxxxxxxx, excellent.one@xxxxxxxxxxxx, superfli@xxxxxxxxx, vbpekez@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11688) civserver still runs when client has stopped
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 14 Aug 2005 20:27:11 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Here's the patch I'll commit to 2.0.  It's a minimal excerpt from the 
other patch.

-jason


Index: server/sernet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v
retrieving revision 1.123.2.7
diff -p -u -r1.123.2.7 sernet.c
--- server/sernet.c     23 Jun 2005 20:35:46 -0000      1.123.2.7
+++ server/sernet.c     15 Aug 2005 02:17:32 -0000
@@ -401,6 +401,9 @@ int sniff_packets(void)
       if(conn_list_size(&game.est_connections) == 0) {
        if (last_noplayers != 0) {
          if (time(NULL)>last_noplayers + srvarg.quitidle) {
+           if (srvarg.exit_on_end) {
+             save_game_auto();
+           }
            set_meta_message_string("restarting for lack of players");
            freelog(LOG_NORMAL, get_meta_message_string());
            (void) send_server_info_to_metaserver(META_INFO);
@@ -411,6 +414,11 @@ int sniff_packets(void)
               lost_connection_to_client(pconn);
               close_connection(pconn);
             } conn_list_iterate_end;
+
+           if (srvarg.exit_on_end) {
+             /* No need for anything more; just quit. */
+             server_quit();
+           }
          }
        } else {
           char buf[256];
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.201.2.11
diff -p -u -r1.201.2.11 srv_main.c
--- server/srv_main.c   29 Jun 2005 02:17:54 -0000      1.201.2.11
+++ server/srv_main.c   15 Aug 2005 02:17:32 -0000
@@ -112,7 +112,6 @@ static void before_end_year(void);
 static void end_turn(void);
 static void ai_start_turn(void);
 static bool is_game_over(void);
-static void save_game_auto(void);
 static void generate_ai_players(void);
 static void mark_nation_as_used(Nation_Type_id nation);
 static void announce_ai_player(struct player *pplayer);
@@ -754,7 +753,7 @@ void save_game(char *orig_filename)
 /**************************************************************************
 Save game with autosave filename, and call gamelog_save().
 **************************************************************************/
-static void save_game_auto(void)
+void save_game_auto(void)
 {
   char filename[512];
 
Index: server/srv_main.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.h,v
retrieving revision 1.24.2.2
diff -p -u -r1.24.2.2 srv_main.h
--- server/srv_main.h   24 Dec 2004 04:01:31 -0000      1.24.2.2
+++ server/srv_main.h   15 Aug 2005 02:17:32 -0000
@@ -56,6 +56,8 @@ void srv_init(void);
 void srv_main(void);
 void server_quit(void);
 
+void save_game_auto(void);
+
 bool handle_packet_input(struct connection *pconn, void *packet, int type);
 void start_game(void);
 void save_game(char *orig_filename);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#11688) civserver still runs when client has stopped, Jason Short <=