Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#3937) replace "2" with OVERVIEW_TILE_WIDTH
Home

[Freeciv-Dev] Re: (PR#3937) replace "2" with OVERVIEW_TILE_WIDTH

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3937) replace "2" with OVERVIEW_TILE_WIDTH
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Apr 2003 13:27:00 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Raimar Falke wrote:
> On Sat, Apr 05, 2003 at 01:37:20PM -0800, Jason Short wrote:
> 
>>The attached patch introduces two new variables, OVERVIEW_TILE_WIDTH and
>>OVERVIEW_TILE_HEIGHT.  These are used in place of "2" when doing all
>>overview calculations.  This is a minor step toward unifying some of the
>>overview code, as well as a potential feature in its own right.
>>
>>They are variables (rather than constants) because gui-sdl already does
>>some basic recalculation of "optimal" overview tile size.  Eventually
>>this can be extended to something more general - perhaps even making
>>these values user options.
>>
>>The patch is tested under some, but not all, clients.
> 
> 
> Patch missing.

Sigh.


Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.116
diff -u -r1.116 tilespec.c
--- client/tilespec.c   2003/04/04 16:14:50     1.116
+++ client/tilespec.c   2003/04/05 21:33:08
@@ -69,6 +69,9 @@
 int SMALL_TILE_WIDTH;
 int SMALL_TILE_HEIGHT;
 
+int OVERVIEW_TILE_WIDTH = 4;
+int OVERVIEW_TILE_HEIGHT = 1;
+
 bool is_isometric;
 
 char *city_names_font;
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.43
diff -u -r1.43 tilespec.h
--- client/tilespec.h   2003/04/04 16:14:50     1.43
+++ client/tilespec.h   2003/04/05 21:33:08
@@ -243,6 +243,9 @@
 extern int SMALL_TILE_WIDTH;
 extern int SMALL_TILE_HEIGHT;
 
+extern int OVERVIEW_TILE_WIDTH;
+extern int OVERVIEW_TILE_HEIGHT;
+
 extern bool is_isometric;
 
 /* name of font to use to draw city names on main map */
Index: client/gui-gtk/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapctrl.c,v
retrieving revision 1.79
diff -u -r1.79 mapctrl.c
--- client/gui-gtk/mapctrl.c    2003/04/04 18:34:37     1.79
+++ client/gui-gtk/mapctrl.c    2003/04/05 21:33:09
@@ -417,15 +417,16 @@
     return TRUE; /* Double-clicks? Triple-clicks? No thanks! */
 
   if (is_isometric) {
-    xtile = ev->x / 2 - (map.xsize / 2 -
-                        (map_view_x0 +
-                         (map_canvas_store_twidth +
-                          map_canvas_store_theight) / 2));
+    xtile = ev->x / OVERVIEW_TILE_WIDTH - (map.xsize / 2 -
+                                          (map_view_x0 +
+                                           (map_canvas_store_twidth +
+                                            map_canvas_store_theight) / 2));
   } else {
-    xtile = ev->x / 2 - (map.xsize / 2 -
-                        (map_view_x0 + map_canvas_store_twidth / 2));
+    xtile = ev->x / OVERVIEW_TILE_WIDTH - (map.xsize / 2 -
+                                          (map_view_x0
+                                           + map_canvas_store_twidth / 2));
   }
-  ytile = ev->y / 2;
+  ytile = ev->y / OVERVIEW_TILE_HEIGHT;
   
   if (can_client_change_view() && ev->button == 3) {
     center_tile_mapcanvas(xtile, ytile);
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.165
diff -u -r1.165 mapview.c
--- client/gui-gtk/mapview.c    2003/04/04 15:47:46     1.165
+++ client/gui-gtk/mapview.c    2003/04/05 21:33:09
@@ -381,8 +381,8 @@
 **************************************************************************/
 void set_overview_dimensions(int x, int y)
 {
-  overview_canvas_store_width=2*x;
-  overview_canvas_store_height=2*y;
+  overview_canvas_store_width = OVERVIEW_TILE_WIDTH * x;
+  overview_canvas_store_height = OVERVIEW_TILE_HEIGHT * y;
 
   if (overview_canvas_store)
     gdk_pixmap_unref(overview_canvas_store);
@@ -396,7 +396,8 @@
                     0, 0,
                     overview_canvas_store_width, overview_canvas_store_height);
 
-  gtk_widget_set_usize(overview_canvas, 2*x, 2*y);
+  gtk_widget_set_usize(overview_canvas,
+                      OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y);
   update_map_canvas_scrollbars_size();
 }
 
@@ -433,8 +434,9 @@
 {
   whole_map_iterate(x, y) {
     set_overview_tile_foreground_color(x, y);
-    gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE, x * 2,
-                      y * 2, 2, 2);
+    gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
+                      OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y,
+                      OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
   } whole_map_iterate_end;
 
   gdk_gc_set_foreground( fill_bg_gc, colors_standard[COLOR_STD_BLACK] );
@@ -460,11 +462,13 @@
     pos += map.xsize;
   
   set_overview_tile_foreground_color(x, y);
-  gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE, x*2, y*2,
-                    2, 2);
+  gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
+                    OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y,
+                    OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
   
-  gdk_draw_rectangle(overview_canvas->window, fill_bg_gc, TRUE, pos*2, y*2,
-                    2, 2);
+  gdk_draw_rectangle(overview_canvas->window, fill_bg_gc, TRUE,
+                    OVERVIEW_TILE_WIDTH * pos, OVERVIEW_TILE_HEIGHT * y,
+                    OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
 }
 
 /**************************************************************************
@@ -482,40 +486,39 @@
 
   if (delta>=0) {
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
-               0, 0, 2*delta, 0,
-               overview_canvas_store_width-2*delta,
+               0, 0, OVERVIEW_TILE_WIDTH * delta, 0,
+               overview_canvas_store_width - OVERVIEW_TILE_WIDTH * delta,
                overview_canvas_store_height );
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
-               overview_canvas_store_width-2*delta, 0,
+               overview_canvas_store_width - OVERVIEW_TILE_WIDTH * delta, 0,
                0, 0,
-               2*delta, overview_canvas_store_height );
+               OVERVIEW_TILE_WIDTH * delta, overview_canvas_store_height);
   } else {
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
-               -2*delta, 0,
+               -OVERVIEW_TILE_WIDTH * delta, 0,
                0, 0,
-               overview_canvas_store_width+2*delta,
+               overview_canvas_store_width + OVERVIEW_TILE_WIDTH *delta,
                overview_canvas_store_height );
 
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
                0, 0,
-               overview_canvas_store_width+2*delta, 0,
-               -2*delta, overview_canvas_store_height );
+               overview_canvas_store_width + OVERVIEW_TILE_WIDTH * delta, 0,
+               -OVERVIEW_TILE_WIDTH * delta, overview_canvas_store_height);
   }
 
   gdk_gc_set_foreground( civ_gc, colors_standard[COLOR_STD_WHITE] );
   
   if (is_isometric) {
-    /* The x's and y's are in overview coordinates.
-       All the extra factor 2's are because one tile in the overview
-       is 2x2 pixels. */
-    int Wx = overview_canvas_store_width/2 - screen_width /* *2/2 */;
-    int Wy = map_view_y0 * 2;
-    int Nx = Wx + 2 * map_canvas_store_twidth;
-    int Ny = Wy - 2 * map_canvas_store_twidth;
-    int Sx = Wx + 2 * map_canvas_store_theight;
-    int Sy = Wy + 2 * map_canvas_store_theight;
-    int Ex = Nx + 2 * map_canvas_store_theight;
-    int Ey = Ny + 2 * map_canvas_store_theight;
+    /* The x's and y's are in overview coordinates. */
+    int Wx = overview_canvas_store_width / 2
+           - OVERVIEW_TILE_WIDTH * screen_width / 2;
+    int Wy = OVERVIEW_TILE_HEIGHT * map_view_y0;
+    int Nx = Wx + OVERVIEW_TILE_WIDTH * map_canvas_store_twidth;
+    int Ny = Wy - OVERVIEW_TILE_HEIGHT * map_canvas_store_twidth;
+    int Sx = Wx + OVERVIEW_TILE_WIDTH * map_canvas_store_theight;
+    int Sy = Wy + OVERVIEW_TILE_HEIGHT * map_canvas_store_theight;
+    int Ex = Nx + OVERVIEW_TILE_WIDTH * map_canvas_store_theight;
+    int Ey = Ny + OVERVIEW_TILE_HEIGHT * map_canvas_store_theight;
     
     freelog(LOG_DEBUG, "wx,wy: %d,%d nx,ny:%d,%x ex,ey:%d,%d, sx,sy:%d,%d",
            Wx, Wy, Nx, Ny, Ex, Ey, Sx, Sy);
@@ -537,9 +540,11 @@
                  Sx, Sy, Wx, Wy);
   } else {
     gdk_draw_rectangle(overview_canvas->window, civ_gc, FALSE,
-                      
(overview_canvas_store_width-2*map_canvas_store_twidth)/2,
-                      2*map_view_y0,
-                      2*map_canvas_store_twidth, 2*map_canvas_store_theight-1);
+                      (overview_canvas_store_width
+                       - OVERVIEW_TILE_WIDTH * map_canvas_store_twidth) / 2,
+                      OVERVIEW_TILE_HEIGHT * map_view_y0,
+                      OVERVIEW_TILE_WIDTH * map_canvas_store_twidth,
+                      OVERVIEW_TILE_HEIGHT * map_canvas_store_theight - 1);
   }
 }
 
Index: client/gui-gtk-2.0/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapctrl.c,v
retrieving revision 1.19
diff -u -r1.19 mapctrl.c
--- client/gui-gtk-2.0/mapctrl.c        2003/04/04 18:34:37     1.19
+++ client/gui-gtk-2.0/mapctrl.c        2003/04/05 21:33:10
@@ -409,15 +409,16 @@
     return TRUE; /* Double-clicks? Triple-clicks? No thanks! */
 
   if (is_isometric) {
-    xtile = ev->x / 2 - (map.xsize / 2 -
-                        (map_view_x0 +
-                         (map_canvas_store_twidth +
-                          map_canvas_store_theight) / 2));
+    xtile = ev->x / OVERVIEW_TILE_WIDTH
+           - (map.xsize / 2 - (map_view_x0
+                               + (map_canvas_store_twidth +
+                                  map_canvas_store_theight) / 2));
   } else {
-    xtile = ev->x / 2 - (map.xsize / 2 -
-                        (map_view_x0 + map_canvas_store_twidth / 2));
+    xtile = ev->x / OVERVIEW_TILE_WIDTH - (map.xsize / 2 -
+                                          (map_view_x0
+                                           + map_canvas_store_twidth / 2));
   }
-  ytile = ev->y / 2;
+  ytile = ev->y / OVERVIEW_TILE_HEIGHT;
 
   if (can_client_change_view() && (ev->button == 3)) {
     center_tile_mapcanvas(xtile, ytile);
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.52
diff -u -r1.52 mapview.c
--- client/gui-gtk-2.0/mapview.c        2003/03/18 02:08:22     1.52
+++ client/gui-gtk-2.0/mapview.c        2003/04/05 21:33:10
@@ -389,8 +389,8 @@
 **************************************************************************/
 void set_overview_dimensions(int x, int y)
 {
-  overview_canvas_store_width=2*x;
-  overview_canvas_store_height=2*y;
+  overview_canvas_store_width = OVERVIEW_TILE_WIDTH * x;
+  overview_canvas_store_height = OVERVIEW_TILE_HEIGHT * y;
 
   if (overview_canvas_store)
     gdk_pixmap_unref(overview_canvas_store);
@@ -404,7 +404,8 @@
                     0, 0,
                     overview_canvas_store_width, overview_canvas_store_height);
 
-  gtk_widget_set_usize(overview_canvas, 2*x, 2*y);
+  gtk_widget_set_usize(overview_canvas,
+                      OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y);
   update_map_canvas_scrollbars_size();
 }
 
@@ -442,8 +443,9 @@
 {
   whole_map_iterate(x, y) {
     set_overview_tile_foreground_color(x, y);
-    gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE, x * 2,
-                      y * 2, 2, 2);
+    gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
+                      OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y,
+                      OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
   } whole_map_iterate_end;
 
   gdk_gc_set_foreground(fill_bg_gc, colors_standard[COLOR_STD_BLACK]);
@@ -469,11 +471,13 @@
     pos += map.xsize;
   
   set_overview_tile_foreground_color(x, y);
-  gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE, x*2, y*2,
-                    2, 2);
+  gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
+                    OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y,
+                    OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
   
-  gdk_draw_rectangle(overview_canvas->window, fill_bg_gc, TRUE, pos*2, y*2,
-                    2, 2);
+  gdk_draw_rectangle(overview_canvas->window, fill_bg_gc, TRUE,
+                    OVERVIEW_TILE_WIDTH * pos, OVERVIEW_TILE_HEIGHT * y,
+                    OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
 }
 
 /**************************************************************************
@@ -491,40 +495,39 @@
 
   if (delta>=0) {
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
-               0, 0, 2*delta, 0,
-               overview_canvas_store_width-2*delta,
+               0, 0, OVERVIEW_TILE_WIDTH * delta, 0,
+               overview_canvas_store_width - OVERVIEW_TILE_WIDTH * delta,
                overview_canvas_store_height );
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
-               overview_canvas_store_width-2*delta, 0,
+               overview_canvas_store_width - OVERVIEW_TILE_WIDTH * delta, 0,
                0, 0,
-               2*delta, overview_canvas_store_height );
+               OVERVIEW_TILE_WIDTH * delta, overview_canvas_store_height);
   } else {
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
-               -2*delta, 0,
+               -OVERVIEW_TILE_WIDTH * delta, 0,
                0, 0,
-               overview_canvas_store_width+2*delta,
+               overview_canvas_store_width + OVERVIEW_TILE_WIDTH *delta,
                overview_canvas_store_height );
 
     gdk_draw_pixmap( overview_canvas->window, civ_gc, overview_canvas_store,
                0, 0,
-               overview_canvas_store_width+2*delta, 0,
-               -2*delta, overview_canvas_store_height );
+               overview_canvas_store_width + OVERVIEW_TILE_WIDTH * delta, 0,
+               -OVERVIEW_TILE_WIDTH * delta, overview_canvas_store_height);
   }
 
   gdk_gc_set_foreground( civ_gc, colors_standard[COLOR_STD_WHITE] );
   
   if (is_isometric) {
-    /* The x's and y's are in overview coordinates.
-       All the extra factor 2's are because one tile in the overview
-       is 2x2 pixels. */
-    int Wx = overview_canvas_store_width/2 - screen_width /* *2/2 */;
-    int Wy = map_view_y0 * 2;
-    int Nx = Wx + 2 * map_canvas_store_twidth;
-    int Ny = Wy - 2 * map_canvas_store_twidth;
-    int Sx = Wx + 2 * map_canvas_store_theight;
-    int Sy = Wy + 2 * map_canvas_store_theight;
-    int Ex = Nx + 2 * map_canvas_store_theight;
-    int Ey = Ny + 2 * map_canvas_store_theight;
+    /* The x's and y's are in overview coordinates. */
+    int Wx = overview_canvas_store_width / 2
+           - OVERVIEW_TILE_WIDTH * screen_width / 2;
+    int Wy = OVERVIEW_TILE_HEIGHT * map_view_y0;
+    int Nx = Wx + OVERVIEW_TILE_WIDTH * map_canvas_store_twidth;
+    int Ny = Wy - OVERVIEW_TILE_HEIGHT * map_canvas_store_twidth;
+    int Sx = Wx + OVERVIEW_TILE_WIDTH * map_canvas_store_theight;
+    int Sy = Wy + OVERVIEW_TILE_HEIGHT * map_canvas_store_theight;
+    int Ex = Nx + OVERVIEW_TILE_WIDTH * map_canvas_store_theight;
+    int Ey = Ny + OVERVIEW_TILE_HEIGHT * map_canvas_store_theight;
     
     freelog(LOG_DEBUG, "wx,wy: %d,%d nx,ny:%d,%x ex,ey:%d,%d, sx,sy:%d,%d",
            Wx, Wy, Nx, Ny, Ex, Ey, Sx, Sy);
@@ -546,9 +549,11 @@
                  Sx, Sy, Wx, Wy);
   } else {
     gdk_draw_rectangle(overview_canvas->window, civ_gc, FALSE,
-                      
(overview_canvas_store_width-2*map_canvas_store_twidth)/2,
-                      2*map_view_y0,
-                      2*map_canvas_store_twidth, 2*map_canvas_store_theight-1);
+                      (overview_canvas_store_width
+                       - OVERVIEW_TILE_WIDTH * map_canvas_store_twidth) / 2,
+                      OVERVIEW_TILE_HEIGHT * map_view_y0,
+                      OVERVIEW_TILE_WIDTH * map_canvas_store_twidth,
+                      OVERVIEW_TILE_HEIGHT * map_canvas_store_theight - 1);
   }
 }
 
Index: client/gui-mui/overviewclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/overviewclass.c,v
retrieving revision 1.19
diff -u -r1.19 overviewclass.c
--- client/gui-mui/overviewclass.c      2003/04/04 15:47:47     1.19
+++ client/gui-mui/overviewclass.c      2003/04/05 21:33:11
@@ -428,8 +428,8 @@
   if (!DoSuperMethodA(cl, o, msg))
     return FALSE;
 
-  data->ov_ScaleX = 2;
-  data->ov_ScaleY = 2;
+  data->ov_ScaleX = OVERVIEW_TILE_WIDTH;
+  data->ov_ScaleY = OVERVIEW_TILE_HEIGHT;
 
   data->ov_BufferWidth = ((data->ov_MapWidth * data->ov_ScaleX + 15) / 16) * 
16;
   data->ov_BufferHeight = data->ov_MapHeight * data->ov_ScaleY;
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.41
diff -u -r1.41 mapview.c
--- client/gui-sdl/mapview.c    2003/04/03 04:13:49     1.41
+++ client/gui-sdl/mapview.c    2003/04/05 21:33:12
@@ -84,8 +84,6 @@
 #define map_view_x0 mapview_canvas.map_x0
 #define map_view_y0 mapview_canvas.map_y0
 
-static Uint8 Mini_map_cell_w, Mini_map_cell_h;
-
 static Uint32 Amask;
 
 static SDL_Surface *pFogSurface;
@@ -1030,18 +1028,9 @@
 
   freelog(LOG_DEBUG,
     "MAPVIEW: 'set_overview_dimensions' call with x = %d  y = %d", w, h);
-
-  if (map.xsize > 160) {
-    Mini_map_cell_w = 1;
-  } else {
-    Mini_map_cell_w = 160 / w;
-  }
 
-  if (map.ysize > 100) {
-    Mini_map_cell_h = 1;
-  } else {
-    Mini_map_cell_h = 100 / h;
-  }
+  OVERVIEW_TILE_WIDTH = MAX(1, 160 / w);
+  OVERVIEW_TILE_HEIGHT = MAX(1, 100 / h);
 
   enable(ID_TOGGLE_UNITS_WINDOW_BUTTON);
 
@@ -1070,9 +1059,9 @@
 void overview_update_tile(int x, int y)
 {
   struct GUI *pMMap = get_minimap_window_widget();
-  SDL_Rect cell_size = {x * Mini_map_cell_w + FRAME_WH,
-                        y * Mini_map_cell_h + FRAME_WH,
-                        Mini_map_cell_w, Mini_map_cell_h};
+  SDL_Rect cell_size = {OVERVIEW_TILE_WIDTH * x + FRAME_WH,
+                       OVERVIEW_TILE_HEIGHT * y + FRAME_WH,
+                       OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT};
   SDL_Color color = *(get_game_colorRGB(overview_tile_color(x, y)));
 
   freelog(LOG_DEBUG, "MAPVIEW: overview_update_tile (x = %d y = %d )", x, y);
@@ -1089,7 +1078,8 @@
 {
 
   SDL_Rect map_area = {FRAME_WH, FRAME_WH, 160, 100}; 
-  SDL_Rect cell_size = {FRAME_WH, FRAME_WH, Mini_map_cell_w, Mini_map_cell_h };
+  SDL_Rect cell_size = {FRAME_WH, FRAME_WH,
+                       OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT};
 
   SDL_Color std_color;
   Uint16 col = 0, row = 0;
@@ -1106,11 +1096,11 @@
            SDL_MapRGBA(pMMap->theme->format, std_color.r,std_color.g,
                                        std_color.b,std_color.unused));
 
-    cell_size.x += Mini_map_cell_w;
+    cell_size.x += OVERVIEW_TILE_WIDTH;
     col++;
 
     if (col == map.xsize) {
-      cell_size.y += Mini_map_cell_h;
+      cell_size.y += OVERVIEW_TILE_HEIGHT;
       cell_size.x = FRAME_WH;
       row++;
       if (row == map.ysize) {
@@ -1227,15 +1217,15 @@
     }
 #endif
     
-    Wx = map_view_x0 * Mini_map_cell_w + FRAME_WH;
-    Wy = map_view_y0 * Mini_map_cell_h + FRAME_WH;
+    Wx = OVERVIEW_TILE_WIDTH * map_view_x0 + FRAME_WH;
+    Wy = OVERVIEW_TILE_HEIGHT * map_view_y0 + FRAME_WH;
 
-    Nx = Wx + Mini_map_cell_w * map_w + FRAME_WH;
-    Ny = Wy - Mini_map_cell_h * map_w + FRAME_WH;
-    Sx = Wx + Mini_map_cell_w * map_h + FRAME_WH;
-    Sy = Wy + Mini_map_cell_h * map_h + FRAME_WH;
-    Ex = Nx + Mini_map_cell_w * map_h + FRAME_WH;
-    Ey = Ny + Mini_map_cell_h * map_h + FRAME_WH;
+    Nx = Wx + OVERVIEW_TILE_WIDTH * map_w + FRAME_WH;
+    Ny = Wy - OVERVIEW_TILE_HEIGHT * map_w + FRAME_WH;
+    Sx = Wx + OVERVIEW_TILE_WIDTH * map_h + FRAME_WH;
+    Sy = Wy + OVERVIEW_TILE_HEIGHT * map_h + FRAME_WH;
+    Ex = Nx + OVERVIEW_TILE_WIDTH * map_h + FRAME_WH;
+    Ey = Ny + OVERVIEW_TILE_HEIGHT * map_h + FRAME_WH;
 
     color = SDL_MapRGBA(pMMap->theme->format, 255, 255, 255, 255);
 
Index: client/gui-win32/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapctrl.c,v
retrieving revision 1.22
diff -u -r1.22 mapctrl.c
--- client/gui-win32/mapctrl.c  2003/04/04 18:34:37     1.22
+++ client/gui-win32/mapctrl.c  2003/04/05 21:33:12
@@ -357,12 +357,15 @@
 {
  int xtile, ytile;        
  if (is_isometric) {
-   xtile=x/2-(map.xsize/2-(map_view_x+(map_view_width+map_view_height)/2));
+   xtile = x / OVERVIEW_TILE_WIDTH
+          - (map.xsize / 2 - (map_view_x + (map_view_width
+                                            + map_view_height) / 2));
  } else {
-   xtile=x/2-(map.xsize/2-(map_view_x+map_view_width/2));
+   xtile = x / OVERVIEW_TILE_WIDTH
+          - (map.xsize / 2 - (map_view_x + map_view_width / 2));
  }
 
- ytile=y/2; 
+ ytile = y / OVERVIEW_TILE_HEIGHT;
 
  if (!can_client_change_view()) {
    return;
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.65
diff -u -r1.65 mapview.c
--- client/gui-win32/mapview.c  2003/04/04 15:47:48     1.65
+++ client/gui-win32/mapview.c  2003/04/05 21:33:13
@@ -442,7 +442,7 @@
 {
   HDC hdc;
   HBITMAP newbit;
-  set_overview_win_dim(2*x,2*y);
+  set_overview_win_dim(OVERVIEW_TILE_WIDTH * x,OVERVIEW_TILE_HEIGHT * y);
   hdc=GetDC(root_window);
   newbit=CreateCompatibleBitmap(hdc,
                                overview_win_width,
@@ -473,16 +473,17 @@
     pos += map.xsize;
   
  
-  rc.left=x*2;
-  rc.right=rc.left+2;
-  rc.top=y*2;
-  rc.bottom=rc.top+2;
+  rc.left = OVERVIEW_TILE_WIDTH * x;
+  rc.right = rc.left + OVERVIEW_TILE_WIDTH;
+  rc.top = OVERVIEW_TILE_HEIGHT * y;
+  rc.bottom = rc.top + OVERVIEW_TILE_HEIGHT;
   FillRect(overviewstoredc,&rc,brush_std[overview_tile_color(x, y)]);
+
   hdc=GetDC(root_window);
-  rc.left=pos*2+overview_win_x;
-  rc.top=y*2+overview_win_y;
-  rc.right=rc.left+2;
-  rc.bottom=rc.top+2;
+  rc.left = OVERVIEW_TILE_WIDTH * pos + overview_win_x;
+  rc.top = OVERVIEW_TILE_HEIGHT * y + overview_win_y;
+  rc.right = rc.left + OVERVIEW_TILE_WIDTH;
+  rc.bottom = rc.top + OVERVIEW_TILE_HEIGHT;
   FillRect(hdc,&rc,brush_std[overview_tile_color(x,y)]);
   ReleaseDC(root_window,hdc);
 }
@@ -886,20 +887,20 @@
   RECT rc;
 
   whole_map_iterate(x, y) {
-    rc.left = x * 2;
-    rc.right = rc.left + 2;
-    rc.top = y * 2;
-    rc.bottom = rc.top + 2;
+    rc.left = OVERVIEW_TILE_WIDTH * x;
+    rc.right = rc.left + OVERVIEW_TILE_WIDTH;
+    rc.top = OVERVIEW_TILE_HEIGHT * y;
+    rc.bottom = rc.top + OVERVIEEW_TILE_HEIGHT;
     FillRect(overviewstoredc, &rc, brush_std[overview_tile_color(x, y)]);
-    pos = x + map.xsize / 2 - (map_view_x + map_win_width / 2);
 
+    pos = x + map.xsize / 2 - (map_view_x + map_win_width / 2);
     pos %= map.xsize;
     if (pos < 0)
       pos += map.xsize;
-    rc.left = overview_win_x + pos * 2;
-    rc.right = rc.left + 2;
-    rc.top = overview_win_y + y * 2;
-    rc.bottom = rc.top + 2;
+    rc.left = overview_win_x + OVERVIEW_TILE_WIDTH * pos;
+    rc.right = rc.left + OVERVIEW_TILE_WIDTH;
+    rc.top = overview_win_y + OVERVIEW_TILE_HEIGHT * y;
+    rc.bottom = rc.top + OVERVIEW_TILE_HEIGHT;
     FillRect(hdc, &rc, brush_std[overview_tile_color(x, y)]);
   } whole_map_iterate_end;
 
@@ -920,32 +921,37 @@
   if (!hdc)
     hdc=GetDC(root_window);
   
-  if (delta>=0)
-    {
-      BitBlt(hdc,overview_win_x+2*delta,overview_win_y,
-            overview_win_width-2*delta,overview_win_height,
-            overviewstoredc,0,0,SRCCOPY);
-      BitBlt(hdc,overview_win_x,overview_win_y,2*delta,overview_win_height,
-            overviewstoredc,overview_win_width-2*delta,0,SRCCOPY);
-    }
-  else
-    {
-      BitBlt(hdc,overview_win_x,overview_win_y,overview_win_width+2*delta,
-            overview_win_height,overviewstoredc,-2*delta,0,SRCCOPY);
-      BitBlt(hdc,overview_win_x+overview_win_width+2*delta,overview_win_y,
-            -2*delta,overview_win_height,overviewstoredc,
-            0,0,SRCCOPY);
-    }
+  if (delta>=0) {
+    BitBlt(hdc,
+          overview_win_x + OVERVIEW_TILE_WIDTH * delta, overview_win_y,
+          overview_win_width - OVERVIEW_TILE_WIDTH * delta,
+          overview_win_height,
+          overviewstoredc, 0, 0, SRCCOPY);
+    BitBlt(hdc, overview_win_x, overview_win_y,
+          OVERVIEW_TILE_WIDTH * delta, overview_win_height,
+          overviewstoredc,
+          overview_win_width - OVERVIEW_TILE_WIDTH * delta, 0, SRCCOPY);
+  } else {
+    BitBlt(hdc, overview_win_x, overview_win_y,
+          overview_win_width + OVERVIEW_TILE_WIDTH * delta,
+          overview_win_height,
+          overviewstoredc, -OVERVIEW_TILE_WIDTH * delta, 0, SRCCOPY);
+    BitBlt(hdc,
+          overview_win_x + overview_win_width + OVERVIEW_TILE_WIDTH * delta,
+          overview_win_y,
+          -OVERVIEW_TILE_WIDTH * delta, overview_win_height,
+          overviewstoredc, 0, 0, SRCCOPY);
+  }
   oldpen=SelectObject(hdc,pen_std[COLOR_STD_WHITE]);
   if (is_isometric) {
-    int Wx = overview_win_width/2 - screen_width /* *2/2 */;
-    int Wy = map_view_y * 2;
-    int Nx = Wx + 2 * map_view_width;
-    int Ny = Wy - 2 * map_view_width;
-    int Sx = Wx + 2 * map_view_height;
-    int Sy = Wy + 2 * map_view_height;
-    int Ex = Nx + 2 * map_view_height;
-    int Ey = Ny + 2 * map_view_height;
+    int Wx = overview_win_width / 2 - OVERVIEW_TILE_WIDTH * screen_width / 2;
+    int Wy = OVERVIEW_TILE_HEIGHT * map_view_y;
+    int Nx = Wx + OVERVIEW_TILE_WIDTH * map_view_width;
+    int Ny = Wy - OVERVIEW_TILE_HEIGHT * map_view_width;
+    int Sx = Wx + OVERVIEW_TILE_WIDTH * map_view_height;
+    int Sy = Wy + OVERVIEW_TILE_HEIGHT * map_view_height;
+    int Ex = Nx + OVERVIEW_TILE_WIDTH * map_view_height;
+    int Ey = Ny + OVERVIEW_TILE_HEIGHT * map_view_height;
     
     freelog(LOG_DEBUG, "wx,wy: %d,%d nx,ny:%d,%x ex,ey:%d,%d, sx,sy:%d,%d",
             Wx, Wy, Nx, Ny, Ex, Ey, Sx, Sy);
@@ -956,10 +962,11 @@
     LineTo(hdc,Wx+overview_win_x,Wy+overview_win_y);
   } else {
     mydrawrect(hdc,
-              (overview_win_width-2*map_view_width)/2+overview_win_x,
-              2*map_view_y+overview_win_y,
-              2*map_view_width,
-              2*map_view_height);
+              (overview_win_width
+               - OVERVIEW_TILE_WIDTH * map_view_width) / 2 + overview_win_x,
+              OVERVIEW_TILE_HEIGHT * map_view_y + overview_win_y,
+              OVERVIEW_TILE_WIDTH * map_view_width,
+              OVERVIEW_TILE_HEIGHT * map_view_height);
   }
   SelectObject(hdc,oldpen);
   if (!hdcp)
Index: client/gui-xaw/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapctrl.c,v
retrieving revision 1.67
diff -u -r1.67 mapctrl.c
--- client/gui-xaw/mapctrl.c    2003/04/04 18:34:37     1.67
+++ client/gui-xaw/mapctrl.c    2003/04/05 21:33:13
@@ -365,8 +365,10 @@
   int xtile, ytile;
   XButtonEvent *ev=&event->xbutton;
 
-  xtile=ev->x/2-(map.xsize/2-(map_view_x0+map_canvas_store_twidth/2));
-  ytile=ev->y/2;
+  xtile = ev->x / OVERVIEW_TILE_WIDTH - (map.xsize / 2
+                                        - (map_view_x0
+                                           + map_canvas_store_twidth / 2));
+  ytile=ev->y / OVERVIEW_TILE_HEIGHT;
 
   if (!can_client_change_view()) {
     return;
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.131
diff -u -r1.131 mapview.c
--- client/gui-xaw/mapview.c    2003/03/18 02:08:22     1.131
+++ client/gui-xaw/mapview.c    2003/04/05 21:33:14
@@ -126,7 +126,10 @@
 {
   Dimension h, w;
 
-  XtVaSetValues(overview_canvas, XtNwidth, 2*x, XtNheight, 2*y, NULL);
+  XtVaSetValues(overview_canvas,
+               XtNwidth, OVERVIEW_TILE_WIDTH * x,
+               XtNheight, OVERVIEW_TILE_HEIGHT * y,
+               NULL);
 
   XtVaGetValues(left_column_form, XtNheight, &h, NULL);
   XtVaSetValues(map_form, XtNheight, h, NULL);
@@ -135,8 +138,8 @@
   XtVaSetValues(menu_form, XtNwidth, w, NULL);
   XtVaSetValues(bottom_form, XtNwidth, w, NULL);
 
-  overview_canvas_store_width=2*x;
-  overview_canvas_store_height=2*y;
+  overview_canvas_store_width = OVERVIEW_TILE_WIDTH * x;
+  overview_canvas_store_height = OVERVIEW_TILE_HEIGHT * y;
 
   if(overview_canvas_store)
     XFreePixmap(display, overview_canvas_store);
@@ -396,8 +399,9 @@
 {
   whole_map_iterate(x, y) {
     set_overview_tile_foreground_color(x, y);
-    XFillRectangle(display, overview_canvas_store, fill_bg_gc, x * 2,
-                  y * 2, 2, 2);
+    XFillRectangle(display, overview_canvas_store, fill_bg_gc,
+                  OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y,
+                  OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
   } whole_map_iterate_end;
 
   XSetForeground(display, fill_bg_gc, 0);
@@ -416,11 +420,13 @@
     pos += map.xsize;
   
   set_overview_tile_foreground_color(x, y);
-  XFillRectangle(display, overview_canvas_store, fill_bg_gc, x*2, y*2, 
-                 2, 2);
+  XFillRectangle(display, overview_canvas_store, fill_bg_gc,
+                OVERVIEW_TILE_WIDTH * x, OVERVIEW_TILE_HEIGHT * y,
+                OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
   
   XFillRectangle(display, XtWindow(overview_canvas), fill_bg_gc, 
-                 pos*2, y*2, 2, 2);
+                OVERVIEW_TILE_WIDTH * pos, OVERVIEW_TILE_HEIGHT * y,
+                OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
 }
 
 /**************************************************************************
@@ -433,36 +439,38 @@
   if(delta>=0) {
     XCopyArea(display, overview_canvas_store, XtWindow(overview_canvas), 
              civ_gc, 0, 0, 
-             overview_canvas_store_width-2*delta,
+             overview_canvas_store_width - OVERVIEW_TILE_WIDTH * delta,
              overview_canvas_store_height, 
-             2*delta, 0);
+             OVERVIEW_TILE_WIDTH * delta, 0);
     XCopyArea(display, overview_canvas_store, XtWindow(overview_canvas), 
              civ_gc, 
-             overview_canvas_store_width-2*delta, 0,
-             2*delta, overview_canvas_store_height, 
+             overview_canvas_store_width - OVERVIEW_TILE_WIDTH * delta, 0,
+             OVERVIEW_TILE_WIDTH * delta, overview_canvas_store_height,
              0, 0);
   }
   else {
     XCopyArea(display, overview_canvas_store, XtWindow(overview_canvas), 
              civ_gc, 
-             -2*delta, 0, 
-             overview_canvas_store_width+2*delta,
+             -OVERVIEW_TILE_WIDTH * delta, 0, 
+             overview_canvas_store_width + OVERVIEW_TILE_WIDTH * delta,
              overview_canvas_store_height, 
              0, 0);
 
     XCopyArea(display, overview_canvas_store, XtWindow(overview_canvas), 
              civ_gc, 
              0, 0,
-             -2*delta, overview_canvas_store_height, 
-             overview_canvas_store_width+2*delta, 0);
+             -OVERVIEW_TILE_WIDTH * delta, overview_canvas_store_height, 
+             overview_canvas_store_width + OVERVIEW_TILE_WIDTH * delta, 0);
   }
 
   XSetForeground(display, civ_gc, colors_standard[COLOR_STD_WHITE]);
   
   XDrawRectangle(display, XtWindow(overview_canvas), civ_gc, 
-                (overview_canvas_store_width-2*map_canvas_store_twidth)/2,
-                2*map_view_y0,
-                2*map_canvas_store_twidth, 2*map_canvas_store_theight-1);
+                (overview_canvas_store_width 
+                 - OVERVIEW_TILE_WIDTH * map_canvas_store_twidth) / 2,
+                OVERVIEW_TILE_HEIGHT * map_view_y0,
+                OVERVIEW_TILE_WIDTH * map_canvas_store_twidth,
+                OVERVIEW_TILE_HEIGHT * map_canvas_store_theight - 1);
 }
 
 

[Prev in Thread] Current Thread [Next in Thread]