Author: cazfi
Date: Mon Jan 18 12:15:07 2016
New Revision: 31482

URL: http://svn.gna.org/viewcvs/freeciv?rev=31482&view=rev
Log:
Added players' consequtive idle turns count to savegame.

Requested by Michal Mazurek <akfaew>

See bug #24312

Modified:
    branches/S2_6/data/scenarios/tileset-demo.sav
    branches/S2_6/server/savecompat.c
    branches/S2_6/server/savegame2.c

Modified: branches/S2_6/data/scenarios/tileset-demo.sav
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/scenarios/tileset-demo.sav?rev=31482&r1=31481&r2=31482&view=diff
==============================================================================
--- branches/S2_6/data/scenarios/tileset-demo.sav       (original)
+++ branches/S2_6/data/scenarios/tileset-demo.sav       Mon Jan 18 12:15:07 2016
@@ -890,6 +890,7 @@
 team_no=0
 government_name="Despotism"
 style_by_name="Classical"
+idle_turns=0
 is_male=TRUE
 is_alive=TRUE
 turns_alive=0
@@ -1529,6 +1530,7 @@
 team_no=1
 government_name="Despotism"
 style_by_name="Babylonian"
+idle_turns=0
 is_male=TRUE
 is_alive=TRUE
 turns_alive=0
@@ -2141,6 +2143,7 @@
 team_no=2
 government_name="Despotism"
 style_by_name="Classical"
+idle_turns=0
 is_male=TRUE
 is_alive=TRUE
 turns_alive=0
@@ -2775,6 +2778,7 @@
 team_no=3
 government_name="Despotism"
 style_by_name="Celtic"
+idle_turns=0
 is_male=TRUE
 is_alive=TRUE
 turns_alive=0
@@ -3405,6 +3409,7 @@
 team_no=4
 government_name="Despotism"
 style_by_name="Classical"
+idle_turns=0
 is_male=TRUE
 is_alive=TRUE
 turns_alive=0

Modified: branches/S2_6/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savecompat.c?rev=31482&r1=31481&r2=31482&view=diff
==============================================================================
--- branches/S2_6/server/savecompat.c   (original)
+++ branches/S2_6/server/savecompat.c   Mon Jan 18 12:15:07 2016
@@ -821,7 +821,10 @@
     secfile_insert_int(loading->file, turn, "player%d.turns_alive", plrno);
 
     /* As if there never has been a war. */
-    secfile_insert_int(loading->file, -1, "player%d.last_war", plrno); 
+    secfile_insert_int(loading->file, -1, "player%d.last_war", plrno);
+
+    /* Assume people were playing until current reload */
+    secfile_insert_int(loading->file, 0, "player%d.idle_turns", plrno);
 
     for (i = 0; i < tsize; i++) {
       int val;

Modified: branches/S2_6/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=31482&r1=31481&r2=31482&view=diff
==============================================================================
--- branches/S2_6/server/savegame2.c    (original)
+++ branches/S2_6/server/savegame2.c    Mon Jan 18 12:15:07 2016
@@ -4230,7 +4230,9 @@
     plr->style = style;
   }
 
-  plr->nturns_idle = 0;
+  sg_failure_ret(secfile_lookup_int(loading->file, &plr->nturns_idle,
+                                    "player%d.idle_turns", plrno),
+                 "%s", secfile_error());             
   plr->is_male = secfile_lookup_bool_default(loading->file, TRUE,
                                              "player%d.is_male", plrno);
   sg_failure_ret(secfile_lookup_bool(loading->file, &plr->is_alive,
@@ -4545,6 +4547,8 @@
   secfile_insert_str(saving->file, style_rule_name(plr->style),
                       "player%d.style_by_name", plrno);
 
+  secfile_insert_int(saving->file, plr->nturns_idle,
+                     "player%d.idle_turns", plrno);
   secfile_insert_bool(saving->file, plr->is_male,
                       "player%d.is_male", plrno);
   secfile_insert_bool(saving->file, plr->is_alive,


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

Reply via email to