Author: cazfi
Date: Sun Aug  9 19:30:49 2015
New Revision: 29430

URL: http://svn.gna.org/viewcvs/freeciv?rev=29430&view=rev
Log:
Save player phase_done information. Use it after loading the savegame if game 
is in turnblock mode.

See patch #6192

Modified:
    branches/S2_6/common/player.c
    branches/S2_6/server/savegame.c
    branches/S2_6/server/savegame2.c
    branches/S2_6/server/srv_main.c

Modified: branches/S2_6/common/player.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/player.c?rev=29430&r1=29429&r2=29430&view=diff
==============================================================================
--- branches/S2_6/common/player.c       (original)
+++ branches/S2_6/common/player.c       Sun Aug  9 19:30:49 2015
@@ -533,6 +533,7 @@
   pplayer->turns_alive = 0;
   pplayer->is_winner = FALSE;
   pplayer->last_war_action = -1;
+  pplayer->phase_done = FALSE;
 
   pplayer->revolution_finishes = -1;
 

Modified: branches/S2_6/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame.c?rev=29430&r1=29429&r2=29430&view=diff
==============================================================================
--- branches/S2_6/server/savegame.c     (original)
+++ branches/S2_6/server/savegame.c     Sun Aug  9 19:30:49 2015
@@ -1788,6 +1788,7 @@
   fc_assert_exit_msg(secfile_lookup_bool(file, &plr->ai_controlled,
                                          "player%d.ai.control", plrno),
                      "%s", secfile_error());
+  plr->phase_done = FALSE;
 
   /* Backwards-compatibility: the tech goal value is still stored in the
    * "ai" section even though it was moved into the research struct. */

Modified: branches/S2_6/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=29430&r1=29429&r2=29430&view=diff
==============================================================================
--- branches/S2_6/server/savegame2.c    (original)
+++ branches/S2_6/server/savegame2.c    Sun Aug  9 19:30:49 2015
@@ -3988,6 +3988,8 @@
                                                 "player%d.turns_alive", plrno);
   plr->last_war_action = secfile_lookup_int_default(loading->file, -1,
                                                     "player%d.last_war", 
plrno);
+  plr->phase_done = secfile_lookup_bool_default(loading->file, FALSE,
+                                                "player%d.phase_done", plrno);
   sg_failure_ret(secfile_lookup_int(loading->file, &plr->economic.gold,
                                     "player%d.gold", plrno),
                  "%s", secfile_error());
@@ -4225,6 +4227,8 @@
                      "player%d.last_war", plrno);
   secfile_insert_bool(saving->file, plr->ai_controlled,
                       "player%d.ai.control", plrno);
+  secfile_insert_bool(saving->file, plr->phase_done,
+                      "player%d.phase_done", plrno);
 
   players_iterate(pplayer) {
     char buf[32];

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=29430&r1=29429&r2=29430&view=diff
==============================================================================
--- branches/S2_6/server/srv_main.c     (original)
+++ branches/S2_6/server/srv_main.c     Sun Aug  9 19:30:49 2015
@@ -967,7 +967,10 @@
   conn_list_do_buffer(game.est_connections);
 
   phase_players_iterate(pplayer) {
-    pplayer->phase_done = FALSE;
+    if (is_new_phase || !game.server.turnblock) {
+      /* Otherwise respect what was loaded from the savegame. */
+      pplayer->phase_done = FALSE;
+    }
     pplayer->ai_phase_done = FALSE;
   } phase_players_iterate_end;
   send_player_all_c(NULL, NULL);


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

Reply via email to