mirror of https://github.com/OpenTTD/OpenTTD
(svn r13055) -Codechange: make a class of SmallMapWindow.
parent
526d5de867
commit
ad19bf105a
File diff suppressed because it is too large
Load Diff
|
@ -144,8 +144,6 @@ TileHighlightData _thd;
|
||||||
static TileInfo *_cur_ti;
|
static TileInfo *_cur_ti;
|
||||||
bool _draw_bounding_boxes = false;
|
bool _draw_bounding_boxes = false;
|
||||||
|
|
||||||
extern void SmallMapCenterOnCurrentPos(Window *w);
|
|
||||||
|
|
||||||
static Point MapXYZToViewport(const ViewPort *vp, uint x, uint y, uint z)
|
static Point MapXYZToViewport(const ViewPort *vp, uint x, uint y, uint z)
|
||||||
{
|
{
|
||||||
Point p = RemapCoords(x, y, z);
|
Point p = RemapCoords(x, y, z);
|
||||||
|
@ -2079,27 +2077,6 @@ bool ScrollWindowTo(int x , int y, Window *w, bool instant)
|
||||||
return true;
|
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)
|
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
|
||||||
{
|
{
|
||||||
return ScrollMainWindowTo(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, instant);
|
return ScrollMainWindowTo(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, instant);
|
||||||
|
|
Loading…
Reference in New Issue