Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10548) mapview sliding at the wrong time
Home

[Freeciv-Dev] (PR#10548) mapview sliding at the wrong time

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10548) mapview sliding at the wrong time
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Oct 2004 19:17:17 -0700
Reply-to: rt@xxxxxxxxxxx

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

Mapview sliding is always done, even when it shouldn't be.

This patch introduces a quick-and-dirty solution.  A global variable can
be toggled to disable sliding.  A better long-term solution is to have a
new "slide" parameter to certain functions (center_tile_mapcanvas,
set_mapview_origin, advance_unit_focus, set_unit_focus).  However this
is a more intrusive change.

The places where sliding shouldn't be done:

- When scrolling (using the scrollbars).

- When centering on a unit at the beginning of the game.

There may be other times as well.

jason


? newtiles
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.197
diff -u -r1.197 civclient.c
--- client/civclient.c  29 Sep 2004 02:24:19 -0000      1.197
+++ client/civclient.c  9 Oct 2004 18:01:27 -0000
@@ -457,7 +457,9 @@
       update_research(game.player_ptr);
       role_unit_precalcs();
       boot_help_texts();       /* reboot */
+      can_slide = FALSE;
       update_unit_focus();
+      can_slide = TRUE;
     }
     else if (client_state == CLIENT_PRE_GAME_STATE) {
       popdown_all_city_dialogs();
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.154
diff -u -r1.154 mapview_common.c
--- client/mapview_common.c     9 Oct 2004 16:00:34 -0000       1.154
+++ client/mapview_common.c     9 Oct 2004 18:01:28 -0000
@@ -37,6 +37,7 @@
 
 struct mapview_canvas mapview_canvas;
 struct overview overview;
+bool can_slide = TRUE;
 
 /* Arbitrary estimated maximums for width and height of a city description
  * text.  Eventually this may be determined dynamically. */
@@ -498,7 +499,7 @@
     return;
   }
 
-  if (smooth_center_slide_msec > 0) {
+  if (can_slide && smooth_center_slide_msec > 0) {
     int start_x = mapview_canvas.gui_x0, start_y = mapview_canvas.gui_y0;
     int diff_x, diff_y;
     double timing_sec = (double)smooth_center_slide_msec / 1000.0, mytime;
@@ -657,7 +658,9 @@
 {
   int gui_x0 = scroll_x, gui_y0 = scroll_y;
 
+  can_slide = FALSE;
   set_mapview_origin(gui_x0, gui_y0);
+  can_slide = TRUE;
 }
 
 /**************************************************************************
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.79
diff -u -r1.79 mapview_common.h
--- client/mapview_common.h     1 Oct 2004 17:53:01 -0000       1.79
+++ client/mapview_common.h     9 Oct 2004 18:01:28 -0000
@@ -44,6 +44,10 @@
 extern struct mapview_canvas mapview_canvas;
 extern struct overview overview;
 
+/* HACK: Callers can set this to FALSE to disable sliding.  It should be
+ * reenabled afterwards. */
+extern bool can_slide;
+
 #define BORDER_WIDTH 2
 #define GOTO_WIDTH 2
 


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10548) mapview sliding at the wrong time, Jason Short <=