changeset 9982 | d7eab194eaaf |
parent 9949 | 392998225bdd |
child 10055 | b3bf982d7879 |
9981:56b0a90e9e89 | 9982:d7eab194eaaf |
---|---|
2066 |
2066 |
2067 /* scrolls the viewport in a window to a given location */ |
2067 /* scrolls the viewport in a window to a given location */ |
2068 bool ScrollWindowTo(int x , int y, Window *w, bool instant) |
2068 bool ScrollWindowTo(int x , int y, Window *w, bool instant) |
2069 { |
2069 { |
2070 /* The slope cannot be acquired outside of the map, so make sure we are always within the map. */ |
2070 /* The slope cannot be acquired outside of the map, so make sure we are always within the map. */ |
2071 Point pt = MapXYZToViewport(w->viewport, x, y, GetSlopeZ(Clamp(x, 0, MapSizeX()), Clamp(y, 0, MapSizeY()))); |
2071 Point pt = MapXYZToViewport(w->viewport, x, y, GetSlopeZ(Clamp(x, 0, MapSizeX() * TILE_SIZE), Clamp(y, 0, MapSizeY() * TILE_SIZE))); |
2072 w->viewport->follow_vehicle = INVALID_VEHICLE; |
2072 w->viewport->follow_vehicle = INVALID_VEHICLE; |
2073 |
2073 |
2074 if (w->viewport->dest_scrollpos_x == pt.x && w->viewport->dest_scrollpos_y == pt.y) |
2074 if (w->viewport->dest_scrollpos_x == pt.x && w->viewport->dest_scrollpos_y == pt.y) |
2075 return false; |
2075 return false; |
2076 |
2076 |