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

Sorry for the spam, Core. I was trying to send this to the list. I
really have to learn some things about operating email...

Here is an email I *should* have sent to the bugtracker yesterday.

Ulrik

---------- Forwarded message ----------
From: Ulrik Sverdrup <[EMAIL PROTECTED]>
Date: 10.04.2008 21:55
Subject: Re: [Freeciv-Dev] (PR#39821) Global Lists Bug... Can't Add to
top of list?
To: [EMAIL PROTECTED]


2008/4/10, Ulrik Sverdrup <[EMAIL PROTECTED]>:

>
 >  <URL: http://bugs.freeciv.org/Ticket/Display.html?id=39821 >
 >
 >
 >  The worklist editor assumes that if ptr->pcity is NULL, you can't edit
 >  the worklist. This reverses that to allow the global worklist editor
 >  to enable all buttons.
 >
 >  The original reporter only mentions the prepend button but the append
 >  button should also have been affected.
 >
 >  Attached simple patches to trunk and 21 branches that fix this by
 >  modifying the sensitivity check.
 >
 >  Old check:
 >  client can issue commands AND pcity not NULL AND player owns pcity
 >  New check
 >  client can issue commands AND ( (pcity not NULL AND player owns pcity)
 >  OR pcity is NULL)
 >
 >  The "extra" null check is so that we don't get a crash on looking up
 >  an owner for city NULL, of course.
 >
 >  Can someone test this? I can't find any other case than the global
 >  worklist editor where pcity is NULL.
 >
 >  Ulrik
 >


Always embarrassing to send something twice. Staring at the logic
 above long enough, you'll see that it's simpler to write the
 conditional as in this patch, taking advantage of course of C's
 cross-circuiting rules.


 Ulrik

>From 3dbfd15b8272d12981e5de5be629f801ea62e584 Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup <[EMAIL PROTECTED]>
Date: Thu, 10 Apr 2008 17:41:50 +0200
Subject: [PATCH] (PR#39821) Global Lists Bug... Can't Add to top of list?

The global worklist editor would not allow the < buttons (prepend and
append) to become sensitive, since ptr->pcity is NULL for global
worklits. This fixes that case.

This is the fix for S2_1 branch
---
 client/gui-gtk-2.0/wldlg.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/client/gui-gtk-2.0/wldlg.c b/client/gui-gtk-2.0/wldlg.c
index 29cccdc..0b1bab6 100644
--- a/client/gui-gtk-2.0/wldlg.c
+++ b/client/gui-gtk-2.0/wldlg.c
@@ -898,7 +898,8 @@ static void src_selection_callback(GtkTreeSelection *selection, gpointer data)
   /* update widget sensitivity. */
   if (gtk_tree_selection_get_selected(selection, NULL, NULL)) {
     if (can_client_issue_orders()
-	&& ptr->pcity && city_owner(ptr->pcity) == game.player_ptr) {
+      && (!ptr->pcity || city_owner(ptr->pcity) == game.player_ptr)) {
+      /* if ptr->pcity is NULL, this is a global worklist */
       gtk_widget_set_sensitive(ptr->change_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->prepend_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->append_cmd, TRUE);
-- 
1.5.4.4

>From 10d5e1cb71b0293c58e854c2b5e76d091bdadeb0 Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup <[EMAIL PROTECTED]>
Date: Thu, 10 Apr 2008 17:41:50 +0200
Subject: [PATCH] (PR#39821) Global Lists Bug... Can't Add to top of list?

The global worklist editor would not allow the < buttons (prepend and
append) to become sensitive, since ptr->pcity is NULL for global
worklits. This fixes that case.
---
 client/gui-gtk-2.0/wldlg.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/client/gui-gtk-2.0/wldlg.c b/client/gui-gtk-2.0/wldlg.c
index a3373d1..6bdf509 100644
--- a/client/gui-gtk-2.0/wldlg.c
+++ b/client/gui-gtk-2.0/wldlg.c
@@ -873,7 +873,8 @@ static void src_selection_callback(GtkTreeSelection *selection, gpointer data)
   /* update widget sensitivity. */
   if (gtk_tree_selection_get_selected(selection, NULL, NULL)) {
     if (can_client_issue_orders()
-	&& ptr->pcity && city_owner(ptr->pcity) == client.conn.playing) {
+      && (!ptr->pcity || city_owner(ptr->pcity) == client.conn.playing)) {
+      /* if ptr->pcity is NULL, this is a global worklist */
       gtk_widget_set_sensitive(ptr->change_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->prepend_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->append_cmd, TRUE);
-- 
1.5.4.4

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to