Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] removing map_adjust from gui-mui (PR#1155)
Home

[Freeciv-Dev] removing map_adjust from gui-mui (PR#1155)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] removing map_adjust from gui-mui (PR#1155)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Sat, 22 Dec 2001 13:01:31 -0800 (PST)

Just for the record, this is my patch to remove map_adjust_x/map_adjust_y from gui-mui.

Without anyone to test it out, I'm not sure if applying it is wise. OTOH, not applying it will lead to code that definitely won't compile once map_adjust_x/map_adjust_y are removed, and it may be harder to fix then. So, without a gui-mui maintainer this is a problem.

Perhaps the diff file should just be put into CVS in the client/gui-mui directory? I don't know.

jason
Index: client/gui-mui/overviewclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/overviewclass.c,v
retrieving revision 1.14
diff -u -r1.14 overviewclass.c
--- client/gui-mui/overviewclass.c      2001/08/05 14:44:59     1.14
+++ client/gui-mui/overviewclass.c      2001/12/22 20:53:02
@@ -109,6 +109,9 @@
 
 static VOID Overview_HandleMouse(Object * o, struct Overview_Data *data, LONG 
x, LONG y)
 {
+  /* For now we only ascertain that the _center_ position is real. */
+  nearest_real_pos(&x, &y);
+
   x = ((x - _mleft(o)) % _mwidth(o))/data->ov_ScaleX;
   y = (y - _mtop(o))/data->ov_ScaleY;
 
@@ -122,13 +125,6 @@
     y -= data->rect_height / 2;
   }
 
-  x = map_adjust_x(x);
-
-  if (y < 0)
-    y = 0;
-  if (y + data->rect_height > data->ov_MapHeight)
-    y = data->ov_MapHeight - data->rect_height;
-
   if (data->rect_left != x || data->rect_top != y)
   {
     SetAttrs(o,
@@ -262,16 +258,26 @@
   {
     LONG x1,x2,y1,y2,scalex,scaley;
     BOOL twoparts;
+    int is_real;
 
     scalex = data->ov_ScaleX;
     scaley = data->ov_ScaleY;
 
-    x1 = _mleft(o) + map_adjust_x(data->rect_left) * scalex;
-    x2 = _mleft(o) + map_adjust_x(data->rect_left + data->rect_width) * scalex;
+    /* This makes little sense to me. */
+    x1 = data->rect_left;
+    y1 = data->rect_top;
+    is_real = normalize_map_pos(&x1, &y1);
+    assert(is_real);
+    x1 = _mleft(o) + x1 * scalex;
+    y1 = _mtop(o) + y1 * scaley;
+
+    x2 = data->rect_left + data->rect_width;
+    y2 = data->rect_top + data->rect_height;
+    is_real = normalize_map_pos(&x2, &y2);
+    assert(is_real);
+    x2 = _mleft(o) + x2 * scalex;
+    y2 = _mtop(o) + y2 * scaley - 1;
 
-    y1 = _mtop(o) + data->rect_top * scaley;
-    y2 = y1 + data->rect_height * scaley - 1;
-
     if (x2 < x1)
       twoparts = TRUE;
     else
@@ -510,6 +516,7 @@
       {
        /* Refresh Single */
        LONG x,y,rx1,rx2,ry1,ry2,pix_x,pix_y;
+       int is_real;
 
        x = data->x;
        y = data->y;
@@ -521,11 +528,16 @@
        RectFill(_rp(o), pix_x, pix_y, pix_x + scalex - 1, pix_y + scaley - 1);
 
         /* Check if the view rectangle has been overwritten */
-       rx1 = map_adjust_x(data->rect_left);
-       rx2 = map_adjust_x(data->rect_left + data->rect_width - 1);
-       ry1 = data->rect_top;
-       ry2 = ry1 + data->rect_height - 1;
-
+        rx1 = data->rect_left;
+        ry1 = data->rect_top;
+        is_real = normalize_map_pos(&rx1, &ry1);
+        assert(is_real);
+
+       rx2 = data->rect_left + data->rect_width - 1;
+       ry2 = data->rect_top + data->rect_height - 1;
+       is_real = normalize_map_pos(&rx2, Yry2);
+       assert(is_real);
+       
         if (((x == rx1 || x == rx2) && (y >= ry1 && y <= ry2)) ||
             ((y == ry1 || y == ry2) && (x >= rx1 && x <= rx2))) {
          Overview_DrawRect(o,data);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] removing map_adjust from gui-mui (PR#1155), jdorje <=