[Freeciv-Dev] (PR#7265) Re: Re: (PR#10831) 1: unexpected exit from tabul
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7265 >
Here is a patch that improve the behavior. Explanation is in the patch
(if it's not good enough we need to write something better).
jason
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.204
diff -u -r1.204 savegame.c
--- server/savegame.c 4 Nov 2004 06:09:39 -0000 1.204
+++ server/savegame.c 10 Nov 2004 05:12:38 -0000
@@ -2668,8 +2668,9 @@
secfile_insert_str(file, act_buf,
"player%d.u%d.activity_list", plrno, i);
} else {
- /* Put all the same fields into the savegame. Otherwise the
- * registry code gets confused (although it still works). */
+ /* Put all the same fields into the savegame - otherwise the
+ * registry code can't correctly use a tabular format and the
+ * savegame will be bigger. */
secfile_insert_int(file, 0, "player%d.u%d.orders_length", plrno, i);
secfile_insert_int(file, 0, "player%d.u%d.orders_index", plrno, i);
secfile_insert_bool(file, FALSE,
@@ -2680,6 +2681,8 @@
"player%d.u%d.orders_list", plrno, i);
secfile_insert_str(file, "-",
"player%d.u%d.dir_list", plrno, i);
+ secfile_insert_str(file, "-",
+ "player%d.u%d.activity_list", plrno, i);
}
}
unit_list_iterate_end;
Index: utility/registry.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/registry.c,v
retrieving revision 1.67
diff -u -r1.67 registry.c
--- utility/registry.c 7 Sep 2004 08:04:16 -0000 1.67
+++ utility/registry.c 10 Nov 2004 05:12:38 -0000
@@ -732,8 +732,24 @@
/* break out of tabular if doesn't match: */
if((!pentry) || (strcmp(pentry->name, expect) != 0)) {
if(icol != 0) {
- freelog(LOG_ERROR, "unexpected exit from tabular at %s (%s)",
- pentry->name, real_filename);
+ /* If the second or later row of a table is missing some
+ * entries that the first row had, we drop out of the tabular
+ * format. This is inefficient so we print a warning message;
+ * the calling code probably needs to be fixed so that it can
+ * use the more efficient tabular format.
+ *
+ * FIXME: If the first row is missing some entries that the
+ * second or later row has, then we'll drop out of tabular
+ * format without an error message. */
+ freelog(LOG_ERROR,
+ "In file %s, there is no entry in the registry for \n"
+ "%s (or the entries are out of order. This means a \n"
+ "less efficient non-tabular format will be used. To\n"
+ "avoid this make sure all rows of a table are filled\n"
+ "out with an entry for every column. This is surely\n"
+ "a bug so if you're reading this message, report it\n"
+ "to bugs@xxxxxxxxxxx.",
+ real_filename, expect);
fz_fprintf(fs, "\n");
}
fz_fprintf(fs, "}\n");
|
|