Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#7446) center_on_something fails
Home

[Freeciv-Dev] Re: (PR#7446) center_on_something fails

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7446) center_on_something fails
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Apr 2004 15:14:28 -0700
Reply-to: rt@xxxxxxxxxxx

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

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7446 >
> 
>>[jdorje - Fri Feb 20 01:47:34 2004]:
>>
>>When you first start a game, the focus unit is put in the top-left of 
>>the mapview (not the center as it should be).
> 
> 
> I can't reproduce this except in the gtk2 client.
> 
> I think the problem is that init_mapcanvas_and_overview is being called
> too much.  I think the mapview is being setup before the call to
> init_mapcanvas_and_overview.
> 
> But I can't compile the gtk2 client to test it.
> 
> The solution is simple.  Just remove init_mapcanvas_and_overview.  It
> doesn't do anything useful.  All it does is set some global (e.g.,
> already 0) values to 0, and create a stub mapview canvas (but this
> mapview canvas should never be used without being properly set up; that
> would be an error).

And a patch.

This isn't guaranteed not to break any of the clients.  However it 
should fix the gtk2 client.  The gtk2 client never had any 
init_mapcanvas code, just a little bit of unnecessary init_overview 
code.  I've only tested it with the gtk client.

jason

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.99
diff -u -r1.99 mapview_common.c
--- client/mapview_common.c     12 Apr 2004 17:15:06 -0000      1.99
+++ client/mapview_common.c     12 Apr 2004 22:12:45 -0000
@@ -2173,23 +2173,3 @@
 
   return redrawn;
 }
-
-/**************************************************************************
-  Sets up the mapview_canvas and overview struts.
-**************************************************************************/
-void init_mapcanvas_and_overview(void)
-{
-  mapview_canvas.tile_width = 0;
-  mapview_canvas.tile_height = 0;
-  mapview_canvas.width = 0;
-  mapview_canvas.height = 0;
-  mapview_canvas.store = canvas_create(1, 1);
-  mapview_canvas.single_tile
-    = canvas_create(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
-
-  overview.map_x0 = 0;
-  overview.map_y0 = 0;
-  overview.width = 0;
-  overview.height = 0;
-  overview.store = NULL;
-}
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.54
diff -u -r1.54 mapview_common.h
--- client/mapview_common.h     12 Apr 2004 17:15:06 -0000      1.54
+++ client/mapview_common.h     12 Apr 2004 22:12:45 -0000
@@ -224,6 +224,5 @@
 void set_overview_dimensions(int width, int height);
 
 bool map_canvas_resized(int width, int height);
-void init_mapcanvas_and_overview(void);
 
 #endif /* FC__MAPVIEW_COMMON_H */
Index: client/gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.147
diff -u -r1.147 gui_main.c
--- client/gui-gtk/gui_main.c   8 Mar 2004 02:24:35 -0000       1.147
+++ client/gui-gtk/gui_main.c   12 Apr 2004 22:12:45 -0000
@@ -942,9 +942,6 @@
 
   timer_id = gtk_timeout_add(TIMER_INTERVAL, timer_callback, NULL);
 
-  init_mapcanvas_and_overview();
-
-
   set_client_state(CLIENT_PRE_GAME_STATE);
 
   gtk_main();
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.70
diff -u -r1.70 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       3 Apr 2004 01:57:22 -0000       1.70
+++ client/gui-gtk-2.0/gui_main.c       12 Apr 2004 22:12:45 -0000
@@ -1186,8 +1186,6 @@
 
   timer_id = gtk_timeout_add(TIMER_INTERVAL, timer_callback, NULL);
 
-  init_mapcanvas_and_overview();
-
   set_client_state(CLIENT_PRE_GAME_STATE);
 
   gtk_main();
Index: client/gui-win32/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/gui_main.c,v
retrieving revision 1.25
diff -u -r1.25 gui_main.c
--- client/gui-win32/gui_main.c 17 Mar 2004 09:10:57 -0000      1.25
+++ client/gui-win32/gui_main.c 12 Apr 2004 22:12:45 -0000
@@ -450,7 +450,6 @@
                               FALSE,FALSE,10);
   
   fcwin_set_box(root_window,main_win_box);
-  init_mapcanvas_and_overview();
 
   /* Need to set these so the version number shows up properly */
   overview_win_width = 160;
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.90
diff -u -r1.90 gui_main.c
--- client/gui-xaw/gui_main.c   8 Mar 2004 07:20:50 -0000       1.90
+++ client/gui-xaw/gui_main.c   12 Apr 2004 22:12:45 -0000
@@ -440,8 +440,6 @@
   x_interval_id = XtAppAddTimeOut(app_context, TIMER_INTERVAL,
                                  timer_callback, NULL);
 
-  init_mapcanvas_and_overview();
-
   for(i=0; i<num_units_below; i++)
     unit_below_pixmap[i]=XCreatePixmap(display, XtWindow(overview_canvas), 
                                       UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT, 

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