<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40171 >
I explored the code more and it paid off. Similar bug exists when doing
Select -> CMA -> Custom, and there is at least one city under custom CMA. The
solution is to also test idx != CMA_CUSTOM, so that we don't call
cmafec_preset_get_parameter(CMA_CUSTOM).
It is correct because if the first test:
if (idx == CMA_CUSTOM && controlled
&& cmafec_preset_get_index_of_parameter(¶meter) == -1) {
fails, we know that pcity isn't under custom CMA.
I attach a patch against version 2.1.3.
There are only 2 exceptions (CMA_NONE and CMA_CUSTOM), so when both are taken
into account, it should work (here i am only talking about passing bad params
to cmafec_preset_get_parameter).
--- client/gui-gtk-2.0/cityrep.c.orig 2008-03-23 21:28:50.000000000 +0000
+++ client/gui-gtk-2.0/cityrep.c 2008-03-29 13:53:56.000000000 +0000
@@ -505,7 +505,7 @@
select = TRUE;
} else if (idx == CMA_NONE && !controlled) {
select = TRUE;
- } else if (idx >= 0 && controlled &&
+ } else if (idx >= 0 && controlled && idx != CMA_NONE && idx != CMA_CUSTOM &&
cm_are_parameter_equal(¶meter,
cmafec_preset_get_parameter(idx))) {
select = TRUE;
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev