1
0
Fork 0

(svn r13055) -Codechange: make a class of SmallMapWindow.

release/0.7
glx 2008-05-11 19:47:10 +00:00
parent 526d5de867
commit ad19bf105a
2 changed files with 481 additions and 498 deletions

File diff suppressed because it is too large Load Diff

View File

@ -144,8 +144,6 @@ TileHighlightData _thd;
static TileInfo *_cur_ti;
bool _draw_bounding_boxes = false;
extern void SmallMapCenterOnCurrentPos(Window *w);
static Point MapXYZToViewport(const ViewPort *vp, uint x, uint y, uint z)
{
Point p = RemapCoords(x, y, z);
@ -2079,27 +2077,6 @@ bool ScrollWindowTo(int x , int y, Window *w, bool instant)
return true;
}
bool ScrollMainWindowTo(int x, int y, bool instant)
{
Window *w;
bool res = ScrollWindowTo(x, y, FindWindowById(WC_MAIN_WINDOW, 0), instant);
/* If a user scrolls to a tile (via what way what so ever) and already is on
* that tile (e.g.: pressed twice), move the smallmap to that location,
* so you directly see where you are on the smallmap. */
if (res) return res;
w = FindWindowById(WC_SMALLMAP, 0);
if (w == NULL) return res;
SmallMapCenterOnCurrentPos(w);
return res;
}
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
{
return ScrollMainWindowTo(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, instant);