[Freeciv-Dev] (PR#10607) mapview slides when returning to game
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#10607) mapview slides when returning to game |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Mon, 18 Oct 2004 20:28:05 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10607 >
If you start a new game, the mapview won't slide. However if you join a
game in progress it will. This patch fixes it.
The other patch here adds an assertion to catch likely error cases.
This should probably be applied to the development branch.
jason
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.141.2.1
diff -u -r1.141.2.1 climisc.c
--- client/climisc.c 17 Oct 2004 00:46:20 -0000 1.141.2.1
+++ client/climisc.c 19 Oct 2004 03:26:58 -0000
@@ -355,6 +355,7 @@
return;
}
+ can_slide = FALSE;
if ((punit = get_unit_in_focus())) {
center_tile_mapcanvas(punit->tile);
} else if ((pcity = find_palace(game.player_ptr))) {
@@ -371,6 +372,8 @@
assert(punit != NULL);
center_tile_mapcanvas(punit->tile);
} else {
+ struct tile *ctile = native_pos_to_tile(map.xsize / 2, map.ysize / 2);
+
/* Just any known tile will do; search near the middle first. */
/* Iterate outward from the center tile. We have to give a radius that
* is guaranteed to be larger than the map will be. Although this is
@@ -379,13 +382,14 @@
iterate_outward(native_pos_to_tile(map.xsize / 2, map.ysize / 2),
map.xsize + map.ysize, ptile) {
if (tile_get_known(ptile) != TILE_UNKNOWN) {
- center_tile_mapcanvas(ptile);
- return;
+ ctile = ptile;
+ break;
}
} iterate_outward_end;
- center_tile_mapcanvas(native_pos_to_tile(map.xsize / 2, map.ysize / 2));
+ center_tile_mapcanvas(ctile);
}
+ can_slide = TRUE;
}
/**************************************************************************
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.151.2.4
diff -u -r1.151.2.4 mapview_common.c
--- client/mapview_common.c 17 Oct 2004 15:47:51 -0000 1.151.2.4
+++ client/mapview_common.c 19 Oct 2004 03:27:08 -0000
@@ -678,6 +678,10 @@
void center_tile_mapcanvas(struct tile *ptile)
{
int gui_x, gui_y;
+ bool first = TRUE;
+
+ assert(!first || !can_slide);
+ first = FALSE;
map_to_gui_pos(&gui_x, &gui_y, ptile->x, ptile->y);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#10607) mapview slides when returning to game,
Jason Short <=
|
|