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

If there is more than one pillage target on a tile the gtk2
gui prevents selecting a road as the target. This is because
S_ROAD is equal to zero so it becomes NULL when casted to a
pointer as a callback userdata argument, which is then ignored
by pillage_callback.

Attached patch fixes pillage_callback to not discard the zero
value. (How it has worked in the past 5 years I have no idea...)


-----------------------------------------------------------------------
私はゼロだからといって、無視するな!
diff --git a/client/gui-gtk-2.0/dialogs.c b/client/gui-gtk-2.0/dialogs.c
index 678ef44..9948a0a 100644
--- a/client/gui-gtk-2.0/dialogs.c
+++ b/client/gui-gtk-2.0/dialogs.c
@@ -272,18 +272,17 @@ void popup_revolution_dialog(struct government *government)
 }
 
 
-/****************************************************************
-...
-*****************************************************************/
+/***********************************************************************
+  NB: 'data' is a value of enum tile_special_type casted to a pointer.
+***********************************************************************/
 static void pillage_callback(GtkWidget *w, gpointer data)
 {
-  if (data) {
-    struct unit *punit = game_find_unit_by_number(unit_to_use_to_pillage);
-    if (punit) {
-      request_new_unit_activity_targeted(punit,
-					 ACTIVITY_PILLAGE,
-					 GPOINTER_TO_INT(data));
-    }
+  struct unit *punit;
+
+  punit = game_find_unit_by_number(unit_to_use_to_pillage);
+  if (punit) {
+    request_new_unit_activity_targeted(punit, ACTIVITY_PILLAGE,
+                                       GPOINTER_TO_INT(data));
   }
 }
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to