Author: cazfi
Date: Sun Feb 28 13:28:10 2016
New Revision: 32116

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

See patch #7015

Modified:
    branches/S2_5/server/srv_main.c

Modified: branches/S2_5/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/srv_main.c?rev=32116&r1=32115&r2=32116&view=diff
==============================================================================
--- branches/S2_5/server/srv_main.c     (original)
+++ branches/S2_5/server/srv_main.c     Sun Feb 28 13:28:10 2016
@@ -1032,7 +1032,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
@@ -1441,6 +1441,17 @@
 **************************************************************************/
 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 (eot_timer != NULL) {
     timer_destroy(eot_timer);
   }


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

Reply via email to