[Freeciv-Dev] (PR#12105) safer trade-routes in citydlg_common
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12105 >
This patch makes the trade-routes code in the tooltip text a little safer.
-jason
? mask-64x32.png
? newgrid.fig
? newgrid.png
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.59
diff -u -r1.59 citydlg_common.c
--- client/citydlg_common.c 4 Feb 2005 01:15:09 -0000 1.59
+++ client/citydlg_common.c 4 Feb 2005 01:38:08 -0000
@@ -423,10 +423,15 @@
for (i = 0; i < NUM_TRADEROUTES; i++) {
if (pcity->trade[i] != 0 && pcity->trade_value[i] != 0) {
+ /* There have been bugs causing the trade city to not be sent
+ * properly to the client. If this happens we trust the
+ * trade_value[] array and simply don't give the name of the
+ * city. */
struct city *trade_city = find_city_by_id(pcity->trade[i]);
+ char *name = trade_city ? trade_city->name : _("(unknown)");
cat_snprintf(buf, bufsz, _("%+4d : Trade route with %s\n"),
- pcity->trade_value[i], trade_city->name);
+ pcity->trade_value[i], name);
total += pcity->trade_value[i];
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12105) safer trade-routes in citydlg_common,
Jason Short <=
|
|