Author: cazfi
Date: Mon Sep 28 03:16:52 2015
New Revision: 29986

URL: http://svn.gna.org/viewcvs/freeciv?rev=29986&view=rev
Log:
Moved score related entries from player sections to new score sections in the 
savegame.

See patch #6370

Modified:
    trunk/server/savecompat.c
    trunk/server/savegame2.c
    trunk/server/savegame3.c

Modified: trunk/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/server/savecompat.c   (original)
+++ trunk/server/savecompat.c   Mon Sep 28 03:16:52 2015
@@ -803,6 +803,7 @@
     enum barbarian_type new_barb_type;
     int i;
     const char *name;
+    int score;
 
     /* Renamed 'capital' to 'got_first_city'. */
     if (secfile_lookup_bool(loading->file, &got_first_city, 
@@ -840,6 +841,24 @@
                                         "player%d.trait.mod%d", plrno, i),
                      "Trait mod: %s", secfile_error());
       secfile_insert_int(loading->file, val, "player%d.trait%d.mod", plrno, i);
+    }
+
+    score = secfile_lookup_int_default(loading->file, -1,
+                                       "player%d.units_built", plrno);
+    if (score >= 0) {
+      secfile_insert_int(loading->file, score, "score%d.units_built", plrno);
+    }
+
+    score = secfile_lookup_int_default(loading->file, -1,
+                                       "player%d.units_killed", plrno);
+    if (score >= 0) {
+      secfile_insert_int(loading->file, score, "score%d.units_killed", plrno);
+    }
+
+    score = secfile_lookup_int_default(loading->file, -1,
+                                       "player%d.units_lost", plrno);
+    if (score >= 0) {
+      secfile_insert_int(loading->file, score, "score%d.units_lost", plrno);
     }
   }
 

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Mon Sep 28 03:16:52 2015
@@ -2894,13 +2894,13 @@
   /* Unit statistics. */
   plr->score.units_built =
       secfile_lookup_int_default(loading->file, 0,
-                                 "player%d.units_built", plrno);
+                                 "score%d.units_built", plrno);
   plr->score.units_killed =
       secfile_lookup_int_default(loading->file, 0,
-                                 "player%d.units_killed", plrno);
+                                 "score%d.units_killed", plrno);
   plr->score.units_lost =
       secfile_lookup_int_default(loading->file, 0,
-                                 "player%d.units_lost", plrno);
+                                 "score%d.units_lost", plrno);
 
   /* Load space ship data. */
   {

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Mon Sep 28 03:16:52 2015
@@ -3772,13 +3772,13 @@
   /* Unit statistics. */
   plr->score.units_built =
       secfile_lookup_int_default(loading->file, 0,
-                                 "player%d.units_built", plrno);
+                                 "score%d.units_built", plrno);
   plr->score.units_killed =
       secfile_lookup_int_default(loading->file, 0,
-                                 "player%d.units_killed", plrno);
+                                 "score%d.units_killed", plrno);
   plr->score.units_lost =
       secfile_lookup_int_default(loading->file, 0,
-                                 "player%d.units_lost", plrno);
+                                 "score%d.units_lost", plrno);
 
   /* Load space ship data. */
   {
@@ -4043,11 +4043,11 @@
 
   /* Unit statistics. */
   secfile_insert_int(saving->file, plr->score.units_built,
-                     "player%d.units_built", plrno);
+                     "score%d.units_built", plrno);
   secfile_insert_int(saving->file, plr->score.units_killed,
-                     "player%d.units_killed", plrno);
+                     "score%d.units_killed", plrno);
   secfile_insert_int(saving->file, plr->score.units_lost,
-                     "player%d.units_lost", plrno);
+                     "score%d.units_lost", plrno);
 
   /* Save space ship status. */
   secfile_insert_int(saving->file, ship->state, "player%d.spaceship.state",


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

Reply via email to