Re: [Freeciv-Dev] (PR#40620) fortress vanished after save/load

2009-01-03 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40620 

2009/1/2 Matthias Pfafferodt:

 see engineer near Vigo; after that turn the fortress will be build save the
 game and reload it - no fortress

 Fix


 - ML

diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c   2008-12-19 17:45:57.0 +0200
+++ freeciv/server/savegame.c   2009-01-03 13:08:22.0 +0200
@@ -1181,7 +1181,7 @@
 int l;
 
 for (l = 0; l  4; l++) {
-  mod[l] = MIN(4 * j + l, -1);
+  mod[l] = MAX(4 * j + l, -1);
 }
 sprintf (buf, map.b%02d_%%03d, j);
 SAVE_NORMAL_MAP_DATA(ptile, file, buf,
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40620) fortress vanished after save/load

2009-01-03 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40620 

2009/1/3 Marko Lindqvist cazf...@gmail.com:
 2009/1/2 Matthias Pfafferodt:

 see engineer near Vigo; after that turn the fortress will be build save the
 game and reload it - no fortress

  Fix

 And better one.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c   2008-12-19 17:45:57.0 +0200
+++ freeciv/server/savegame.c   2009-01-03 13:47:34.0 +0200
@@ -1181,7 +1181,11 @@
 int l;
 
 for (l = 0; l  4; l++) {
-  mod[l] = MIN(4 * j + l, -1);
+  if (4 * j + 1  game.control.num_base_types) {
+mod[l] = -1;
+  } else {
+mod[l] = 4 * j + l;
+  }
 }
 sprintf (buf, map.b%02d_%%03d, j);
 SAVE_NORMAL_MAP_DATA(ptile, file, buf,
@@ -3690,7 +3694,11 @@
 int l;
 
 for (l = 0; l  4; l++) {
-  mod[l] = MAX(4 * j + l, -1);
+  if (4 * j + 1  game.control.num_base_types) {
+mod[l] = -1;
+  } else {
+mod[l] = 4 * j + l;
+  }
 }
 sprintf (buf, player%%d.map_b%02d_%%03d, j);
 SAVE_PLAYER_MAP_DATA(ptile, file, buf, plrno,
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev