<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39722 >

This transaction appears to have no content
Sorry erase previous PR#39721, I submit wrong patch file :(


With gcc-4.2, I have bug.
How to reproduce :
- Start game
- Build a city
- Press F1 (open city panel management)
- select city(ies)
- menu "Change" -> "CMA" -> "Food Max" (anyone except none)
- nothing append

- Open city panel by click on city on map, apply CMA
- Go to F1 panel
- menu "Change" -> "CMA" -> "Food Max" (anyone except none)
- CMA of city is set to none

It's not happend with gcc4.1 and seems due to
when you ask once GINT_TO_POINTER(-1) and after call to
GINT_TO_POINTER(x) is :
GINT_TO_POINTER(x) = GINT_TO_POINTER(-1).

Patch, put CMA called 'none' at the end of list of preset CMA.

Cheers

-- 
Carl
Sorry erase previous PR#39721, I submit wrong patch file :(


With gcc-4.2, I have bug.
How to reproduce :
- Start game
- Build a city
- Press F1 (open city panel management)
- select city(ies)
- menu "Change" -> "CMA" -> "Food Max" (anyone except none)
- nothing append

- Open city panel by click on city on map, apply CMA
- Go to F1 panel
- menu "Change" -> "CMA" -> "Food Max" (anyone except none)
- CMA of city is set to none

It's not happend with gcc4.1 and seems due to 
when you ask once GINT_TO_POINTER(-1) and after call to
GINT_TO_POINTER(x) is :
GINT_TO_POINTER(x) = GINT_TO_POINTER(-1).

Patch, put CMA called 'none' at the end of list of preset CMA.

Cheers

--
Carl
diff -urda client/gui-gtk-2.0/cityrep.c.orig client/gui-gtk-2.0/cityrep.c
--- client/gui-gtk-2.0/cityrep.c.orig	2007-07-09 11:59:02.000000000 +0200
+++ client/gui-gtk-2.0/cityrep.c	2007-09-25 18:26:47.000000000 +0200
@@ -470,7 +470,7 @@
   gtk_tree_model_get(GTK_TREE_MODEL(city_model), it, 0, &res, -1);
   pcity = res;
 
-   if (idx == CMA_NONE) {
+   if (idx == cmafec_preset_num()) {
      cma_release_city(pcity);
    } else {
      cma_put_city_under_agent(pcity, cmafec_preset_get_parameter(idx));
@@ -548,8 +548,8 @@
   gtk_menu_item_set_submenu(parent_item, menu);
 
   if (change_cma) {
-    for (i = -1; i < cmafec_preset_num(); i++) {
-      w = (i == -1 ? gtk_menu_item_new_with_label(_("none"))
+    for (i = 0; i <= cmafec_preset_num(); i++) {
+      w = (i == cmafec_preset_num() ? gtk_menu_item_new_with_label(_("none"))
 	   : gtk_menu_item_new_with_label(cmafec_preset_get_descr(i)));
       gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
       g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback),
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to