Author: cazfi
Date: Sun Feb 28 13:28:05 2016
New Revision: 32115

URL: http://svn.gna.org/viewcvs/freeciv?rev=32115&view=rev
Log:
Free open data phases when quitting server mid-game

See patch #7015

Modified:
    branches/S2_6/server/srv_main.c

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=32115&r1=32114&r2=32115&view=diff
==============================================================================
--- branches/S2_6/server/srv_main.c     (original)
+++ branches/S2_6/server/srv_main.c     Sun Feb 28 13:28:05 2016
@@ -1119,7 +1119,7 @@
 static void end_phase(void)
 {
   log_debug("Endphase");
- 
+
   /* 
    * This empties the client Messages window; put this before
    * everything else below, since otherwise any messages from the
@@ -1599,6 +1599,18 @@
 **************************************************************************/
 void server_quit(void)
 {
+  if (server_state() == S_S_RUNNING) {
+    /* Quitting mid-game. */
+
+    phase_players_iterate(pplayer) {
+      CALL_PLR_AI_FUNC(phase_finished, pplayer, pplayer);
+      /* This has to be after all access to advisor data. */
+      /* We used to run this for ai players only, but data phase
+         is initialized for human players also. */
+      adv_data_phase_done(pplayer);
+    } phase_players_iterate_end;
+  }
+
   if (game.server.save_timer != NULL) {
     timer_destroy(game.server.save_timer);
     game.server.save_timer = NULL;
@@ -2631,7 +2643,7 @@
         game.server.turn_change_time = timer_read_seconds(between_turns);
         log_debug("Inresponsive between turns %g seconds", 
game.server.turn_change_time);
       }
-      
+
       while (server_sniff_all_input() == S_E_OTHERWISE) {
         /* nothing */
       }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to