Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] Re: (PR#6905) Possible Solution
Home

[Freeciv-Dev] Re: (PR#6905) Possible Solution

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: vanevery@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6905) Possible Solution
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Dec 2003 00:32:49 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6905 >

Guest wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=6905 >
> 
> I think I've found the problem:

Indeed.

In a "cvs diff" from 4 months ago:

@@ -1723,10 +1721,11 @@
        if ((x>=pdialog->map.x)&&(x<(pdialog->map.x+pdialog->map_w)))
         {
           int tile_x,tile_y;
-         xr=x-pdialog->map.x;
-         yr=y-pdialog->map.y;
-         canvas_pos_to_city_pos(xr,yr,&tile_x,&tile_y);
-         city_toggle_worker(pdialog->pcity, tile_x, tile_y);
+
+         if (canvas_to_city_pos(&tile_x, &tile_y,
+                                pdialog->map.x, pdialog->map.y)) {
+           city_toggle_worker(pdialog->pcity, tile_x, tile_y);
+         }
         }
      }
    xr=x-pdialog->pop_x;

So obviously xr and yr have been dropped and replaced with incorrect 
values.  My mistake.

The attached patch should fix it.  I can't test it, though.

jason

Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.63
diff -u -r1.63 citydlg.c
--- client/gui-win32/citydlg.c  2003/11/09 16:45:01     1.63
+++ client/gui-win32/citydlg.c  2003/12/04 08:31:31
@@ -1721,9 +1721,10 @@
       if ((x>=pdialog->map.x)&&(x<(pdialog->map.x+pdialog->map_w)))
        {
          int tile_x,tile_y;
+         xr = x - pdialog->map.x;
+         yr = y - pdialog->map.y;
 
-         if (canvas_to_city_pos(&tile_x, &tile_y,
-                                pdialog->map.x, pdialog->map.y)) {
+         if (canvas_to_city_pos(&tile_x, &tile_y, xr, yr)) {
            city_toggle_worker(pdialog->pcity, tile_x, tile_y);
          }
        }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#6905) Possible Solution, Jason Short <=