[Freeciv-Dev] (PR#19044) 2.0 => 2.1 forward compatibility
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#19044) 2.0 => 2.1 forward compatibility |
From: |
"Jason Dorje Short" <jdorje@xxxxxxxxx> |
Date: |
Sun, 30 Jul 2006 10:17:02 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=19044 >
This patch allows S2_0 to load (some) games from S2_1.
The unhappysize and cityfactor values are ignored (the defaults are
used), and no specials can be loaded (so the map will have no specials).
Nonetheless this is better than nothing.
There is still a problem in that 2.1 has a lot of nations not available
in 2.0. We should probably have a general fix here so that if a nation
isn't available, another one is picked.
-jason
Index: server/savegame.c
===================================================================
--- server/savegame.c (revision 12001)
+++ server/savegame.c (working copy)
@@ -621,11 +621,14 @@
}
/* get 4-bit segments of 16-bit "special" field. */
+ whole_map_iterate(ptile) {
+ ptile->special = 0;
+ } whole_map_iterate_end;
LOAD_MAP_DATA(ch, nat_y, ptile,
- secfile_lookup_str(file, "map.l%03d", nat_y),
- ptile->special = ascii_hex2bin(ch, 0));
+ secfile_lookup_str_default(file, NULL, "map.l%03d", nat_y),
+ ptile->special |= ascii_hex2bin(ch, 0));
LOAD_MAP_DATA(ch, nat_y, ptile,
- secfile_lookup_str(file, "map.u%03d", nat_y),
+ secfile_lookup_str_default(file, NULL, "map.u%03d", nat_y),
ptile->special |= ascii_hex2bin(ch, 1));
LOAD_MAP_DATA(ch, nat_y, ptile,
secfile_lookup_str_default(file, NULL, "map.n%03d", nat_y),
@@ -2265,13 +2268,16 @@
char2terrain(ch));
/* get 4-bit segments of 12-bit "special" field. */
+ whole_map_iterate(ptile) {
+ map_get_player_tile(ptile, plr)->special = 0;
+ } whole_map_iterate_end;
LOAD_MAP_DATA(ch, nat_y, ptile,
- secfile_lookup_str(file, "player%d.map_l%03d",
+ secfile_lookup_str_default(file, NULL, "player%d.map_l%03d",
plrno, nat_y),
- map_get_player_tile(ptile, plr)->special =
+ map_get_player_tile(ptile, plr)->special |=
ascii_hex2bin(ch, 0));
LOAD_MAP_DATA(ch, nat_y, ptile,
- secfile_lookup_str(file, "player%d.map_u%03d",
+ secfile_lookup_str_default(file, NULL, "player%d.map_u%03d",
plrno, nat_y),
map_get_player_tile(ptile, plr)->special |=
ascii_hex2bin(ch, 1));
@@ -3132,11 +3138,11 @@
game.coolinglevel = secfile_lookup_int_default(file, 8,
"game.coolinglevel");
game.notradesize = secfile_lookup_int_default(file, 0,
"game.notradesize");
game.fulltradesize = secfile_lookup_int_default(file, 1,
"game.fulltradesize");
- game.unhappysize = secfile_lookup_int(file, "game.unhappysize");
+ game.unhappysize = secfile_lookup_int_default(file,
GAME_DEFAULT_UNHAPPYSIZE, "game.unhappysize");
game.angrycitizen = secfile_lookup_bool_default(file, FALSE,
"game.angrycitizen");
if (game.version >= 10100) {
- game.cityfactor = secfile_lookup_int(file, "game.cityfactor");
+ game.cityfactor = secfile_lookup_int_default(file,
GAME_DEFAULT_CITYFACTOR, "game.cityfactor");
game.diplcost = secfile_lookup_int(file, "game.diplcost");
game.freecost = secfile_lookup_int(file, "game.freecost");
game.conquercost = secfile_lookup_int(file, "game.conquercost");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#19044) 2.0 => 2.1 forward compatibility,
Jason Dorje Short <=
|
|