[Freeciv-Dev] Re: (PR#14967) Roads are not saved
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14967 >
Guillaume Melquiond wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14967 >
>
> Due to a patch committed on December 23th, roads and railroads are no
> longer restored when loading a game recently saved. Older files are
> loaded fine. Irrigation and farmlands are saved fine.
>
> To reproduce, start a new game, build a road with your workers, save
> and exit. Then reload, the road is not here anymore.
I cannot reproduce this, but I suspect it's caused by translation issues
and this patch will fix it. Please test.
-jason
Index: server/savegame.c
===================================================================
--- server/savegame.c (revision 11381)
+++ server/savegame.c (working copy)
@@ -3404,7 +3404,7 @@
special_order = fc_calloc(nmod + (4 - (nmod % 4)),
sizeof(*special_order));
for (j = 0; j < nmod; j++) {
- special_order[j] = get_special_by_name(modname[j]);
+ special_order[j] = get_special_by_name_orig(modname[j]);
}
free(modname);
for (; j < S_LAST + (4 - (S_LAST % 4)); j++) {
@@ -4047,7 +4047,7 @@
/* Save specials order */
modname = fc_calloc(S_LAST, sizeof(*modname));
for (j = 0; j < S_LAST; j++) {
- modname[j] = get_special_name(j);
+ modname[j] = get_special_name_orig(j);
}
secfile_insert_str_vec(file, modname, S_LAST,
"savefile.specials");
Index: common/terrain.c
===================================================================
--- common/terrain.c (revision 11381)
+++ common/terrain.c (working copy)
@@ -301,7 +301,7 @@
FIXME: should be find_special_by_name().
****************************************************************************/
-enum tile_special_type get_special_by_name(const char *name)
+enum tile_special_type get_special_by_name_orig(const char *name)
{
enum tile_special_type i;
@@ -316,7 +316,7 @@
}
/****************************************************************************
- Return the name of the given special.
+ Return the translated name of the given special.
****************************************************************************/
const char *get_special_name(enum tile_special_type type)
{
@@ -326,6 +326,16 @@
}
/****************************************************************************
+ Return the untranslated name of the given special.
+****************************************************************************/
+const char *get_special_name_orig(enum tile_special_type type)
+{
+ assert(ARRAY_SIZE(tile_special_type_names) == S_LAST);
+ assert(type >= 0 && type < S_LAST);
+ return tile_special_type_names[type];
+}
+
+/****************************************************************************
Add the given special to the set.
****************************************************************************/
void set_special(bv_special *set, enum tile_special_type to_set)
Index: common/terrain.h
===================================================================
--- common/terrain.h (revision 11381)
+++ common/terrain.h (working copy)
@@ -195,8 +195,9 @@
enum mapgen_terrain_property prop);
/* General special accessor functions. */
-enum tile_special_type get_special_by_name(const char * name);
+enum tile_special_type get_special_by_name_orig(const char * name);
const char *get_special_name(enum tile_special_type type);
+const char *get_special_name_orig(enum tile_special_type type);
void set_special(bv_special *set, enum tile_special_type to_set);
void clear_special(bv_special *set, enum tile_special_type to_clear);
void clear_all_specials(bv_special *set);
Index: common/requirements.c
===================================================================
--- common/requirements.c (revision 11381)
+++ common/requirements.c (working copy)
@@ -122,7 +122,7 @@
}
break;
case REQ_SPECIAL:
- source.value.special = get_special_by_name(value);
+ source.value.special = get_special_by_name_orig(value);
if (source.value.special != S_LAST) {
return source;
}
- [Freeciv-Dev] Re: (PR#14967) Roads are not saved,
Jason Short <=
|
|