diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-gtk/mapview.c freeciv/client/gui-gtk/mapview.c --- FreecivCVS/client/gui-gtk/mapview.c Sun Mar 12 23:32:58 2000 +++ freeciv/client/gui-gtk/mapview.c Mon Mar 13 13:30:57 2000 @@ -44,6 +44,23 @@ #include "mapview.h" +/* +The bottom row of the map was sometimes hidden. + +As of now the top left corner is always aligned with the tiles. This is what +causes the problem in the first place. The ideal solution would be to align the +window with the bottom left tiles if you tried to center the window on a tile +closer than (screen_tiles_height/2 -1) to the south pole. + +But, for now, I just grepped for occurences where the ysize (or the values +derived from it) were used, and those places that had relevance to drawing the +map, and I added 1 (using the EXTRA_BOTTOM_ROW constant). + +-Thue +*/ +#define EXTRA_BOTTOM_ROW 1 + + extern int seconds_to_turndone; /* adjusted depending on tile size: */ @@ -633,8 +650,9 @@ new_map_view_x0=map_adjust_x(x-map_canvas_store_twidth/2); new_map_view_y0=map_adjust_y(y-map_canvas_store_theight/2); - if(new_map_view_y0>map.ysize-map_canvas_store_theight) - new_map_view_y0=map_adjust_y(map.ysize-map_canvas_store_theight); + if(new_map_view_y0>map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight) + new_map_view_y0= + map_adjust_y(map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight); map_view_x0=new_map_view_x0; map_view_y0=new_map_view_y0; @@ -907,7 +925,7 @@ { map_hadj=gtk_adjustment_new(-1, 0, map.xsize, 1, map_canvas_store_twidth, map_canvas_store_twidth); - map_vadj=gtk_adjustment_new(-1, 0, map.ysize, 1, + map_vadj=gtk_adjustment_new(-1, 0, map.ysize+EXTRA_BOTTOM_ROW, 1, map_canvas_store_theight, map_canvas_store_theight); gtk_range_set_adjustment(GTK_RANGE(map_horizontal_scrollbar), GTK_ADJUSTMENT(map_hadj)); @@ -1382,8 +1400,10 @@ else { map_view_y0=percent; map_view_y0=(map_view_y0<0) ? 0 : map_view_y0; - map_view_y0=(map_view_y0>map.ysize-map_canvas_store_theight) ? - map.ysize-map_canvas_store_theight : map_view_y0; + map_view_y0= + (map_view_y0>map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight) ? + map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight : + map_view_y0; } if(last_map_view_x0!=map_view_x0 || last_map_view_y0!=map_view_y0) { diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-xaw/mapview.c freeciv/client/gui-xaw/mapview.c --- FreecivCVS/client/gui-xaw/mapview.c Sat Jan 22 22:13:13 2000 +++ freeciv/client/gui-xaw/mapview.c Mon Mar 13 13:20:35 2000 @@ -46,6 +46,22 @@ #include "mapview.h" +/* +The bottom row of the map was sometimes hidden. + +As of now the top left corner is always aligned with the tiles. This is what +causes the problem in the first place. The ideal solution would be to align the +window with the bottom left tiles if you tried to center the window on a tile +closer than (screen_tiles_height/2 -1) to the south pole. + +But, for now, I just grepped for occurences where the ysize (or the values +derived from it) were used, and those places that had relevance to drawing the +map, and I added 1 (using the EXTRA_BOTTOM_ROW constant). + +-Thue +*/ +#define EXTRA_BOTTOM_ROW 1 + extern Display *display; extern GC civ_gc, font_gc; @@ -600,8 +616,9 @@ new_map_view_x0=map_adjust_x(x-map_canvas_store_twidth/2); new_map_view_y0=map_adjust_y(y-map_canvas_store_theight/2); - if(new_map_view_y0>map.ysize-map_canvas_store_theight) - new_map_view_y0=map_adjust_y(map.ysize-map_canvas_store_theight); + if(new_map_view_y0>map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight) + new_map_view_y0= + map_adjust_y(map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight); map_view_x0=new_map_view_x0; map_view_y0=new_map_view_y0; @@ -871,8 +888,8 @@ { float shown_h=(float)map_canvas_store_twidth/(float)map.xsize; float top_h=(float)map_view_x0/(float)map.xsize; - float shown_v=(float)map_canvas_store_theight/(float)map.ysize; - float top_v=(float)map_view_y0/(float)map.ysize; + float shown_v=(float)map_canvas_store_theight/(float)map.ysize+EXTRA_BOTTOM_ROW; + float top_v=(float)map_view_y0/(float)map.ysize+EXTRA_BOTTOM_ROW; XawScrollbarSetThumb(map_horizontal_scrollbar, top_h, shown_h); XawScrollbarSetThumb(map_vertical_scrollbar, top_v, shown_v); @@ -1287,10 +1304,12 @@ if(w==map_horizontal_scrollbar) map_view_x0=percent*map.xsize; else { - map_view_y0=percent*map.ysize; + map_view_y0=percent*map.ysize+EXTRA_BOTTOM_ROW; map_view_y0=(map_view_y0<0) ? 0 : map_view_y0; - map_view_y0=(map_view_y0>map.ysize-map_canvas_store_theight) ? - map.ysize-map_canvas_store_theight : map_view_y0; + map_view_y0= + (map_view_y0>map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight) ? + map.ysize+EXTRA_BOTTOM_ROW-map_canvas_store_theight : + map_view_y0; } update_map_canvas(0, 0, map_canvas_store_twidth, map_canvas_store_theight, 1); @@ -1319,7 +1338,7 @@ map_view_x0--; } else { - if(position>0 && map_view_y00 && map_view_y00) map_view_y0--;