diff --git a/src/viewport.cpp b/src/viewport.cpp --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -177,7 +177,7 @@ struct ViewportDrawer { Point foundation_offset[FOUNDATION_PART_END]; ///< Pixel offset for ground sprites on the foundations. }; -static void MarkViewportDirty(const ViewPort *vp, int left, int top, int right, int bottom); +static void MarkViewportDirty(const Viewport *vp, int left, int top, int right, int bottom); static ViewportDrawer _vd; @@ -188,7 +188,7 @@ bool _draw_dirty_blocks = false; uint _dirty_block_colour = 0; static VpSpriteSorter _vp_sprite_sorter = nullptr; -static Point MapXYZToViewport(const ViewPort *vp, int x, int y, int z) +static Point MapXYZToViewport(const Viewport *vp, int x, int y, int z) { Point p = RemapCoords(x, y, z); p.x -= vp->virtual_width / 2; @@ -331,7 +331,7 @@ static void DoSetViewportPosition(const static void SetViewportPosition(Window *w, int x, int y) { - ViewPort *vp = w->viewport; + Viewport *vp = w->viewport; int old_left = vp->virtual_left; int old_top = vp->virtual_top; int i; @@ -390,9 +390,9 @@ static void SetViewportPosition(Window * * @return Pointer to the viewport if the xy position is in the viewport of the window, * otherwise \c nullptr is returned. */ -ViewPort *IsPtInWindowViewport(const Window *w, int x, int y) +Viewport *IsPtInWindowViewport(const Window *w, int x, int y) { - ViewPort *vp = w->viewport; + Viewport *vp = w->viewport; if (vp != nullptr && IsInsideMM(x, vp->left, vp->left + vp->width) && @@ -414,7 +414,7 @@ ViewPort *IsPtInWindowViewport(const Win * @param clamp_to_map Clamp the coordinate outside of the map to the closest, non-void tile within the map * @return Tile coordinate or (-1, -1) if given x or y is not within viewport frame */ -Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y, bool clamp_to_map) +Point TranslateXYToTileCoord(const Viewport *vp, int x, int y, bool clamp_to_map) { if (!IsInsideBS(x, vp->left, vp->width) || !IsInsideBS(y, vp->top, vp->height)) { Point pt = { -1, -1 }; @@ -432,7 +432,7 @@ Point TranslateXYToTileCoord(const ViewP static Point GetTileFromScreenXY(int x, int y, int zoom_x, int zoom_y) { Window *w; - ViewPort *vp; + Viewport *vp; Point pt; if ( (w = FindWindowFromPt(x, y)) != nullptr && @@ -452,7 +452,7 @@ Point GetTileBelowCursor() Point GetTileZoomCenterWindow(bool in, Window * w) { int x, y; - ViewPort *vp = w->viewport; + Viewport *vp = w->viewport; if (in) { x = ((_cursor.pos.x - vp->left) >> 1) + (vp->width >> 2); @@ -473,7 +473,7 @@ Point GetTileZoomCenterWindow(bool in, W * @param widget_zoom_in widget index for window with zoom-in button * @param widget_zoom_out widget index for window with zoom-out button */ -void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out) +void HandleZoomMessage(Window *w, const Viewport *vp, byte widget_zoom_in, byte widget_zoom_out) { w->SetWidgetDisabledState(widget_zoom_in, vp->zoom <= _settings_client.gui.zoom_min); w->SetWidgetDirty(widget_zoom_in); @@ -1480,7 +1480,7 @@ void ViewportSign::MarkDirty(ZoomLevel m Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { - ViewPort *vp = w->viewport; + Viewport *vp = w->viewport; if (vp != nullptr && vp->zoom <= maxzoom) { assert(vp->width != 0); Rect &zl = zoomlevels[vp->zoom]; @@ -1651,7 +1651,7 @@ static void ViewportDrawStrings(ZoomLeve } } -void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom) +void ViewportDoDraw(const Viewport *vp, int left, int top, int right, int bottom) { DrawPixelInfo *old_dpi = _cur_dpi; _cur_dpi = &_vd.dpi; @@ -1726,7 +1726,7 @@ void ViewportDoDraw(const ViewPort *vp, * Make sure we don't draw a too big area at a time. * If we do, the sprite memory will overflow. */ -static void ViewportDrawChk(const ViewPort *vp, int left, int top, int right, int bottom) +static void ViewportDrawChk(const Viewport *vp, int left, int top, int right, int bottom) { if ((int64)ScaleByZoom(bottom - top, vp->zoom) * (int64)ScaleByZoom(right - left, vp->zoom) > (int64)(180000 * ZOOM_LVL_BASE * ZOOM_LVL_BASE)) { if ((bottom - top) > (right - left)) { @@ -1748,7 +1748,7 @@ static void ViewportDrawChk(const ViewPo } } -static inline void ViewportDraw(const ViewPort *vp, int left, int top, int right, int bottom) +static inline void ViewportDraw(const Viewport *vp, int left, int top, int right, int bottom) { if (right <= vp->left || bottom <= vp->top) return; @@ -1793,7 +1793,7 @@ void Window::DrawViewport() const * @param[in,out] scroll_x Viewport X scroll. * @param[in,out] scroll_y Viewport Y scroll. */ -static inline void ClampViewportToMap(const ViewPort *vp, int *scroll_x, int *scroll_y) +static inline void ClampViewportToMap(const Viewport *vp, int *scroll_x, int *scroll_y) { /* Centre of the viewport is hot spot. */ Point pt = { @@ -1819,7 +1819,7 @@ static inline void ClampViewportToMap(co */ void UpdateViewportPosition(Window *w) { - const ViewPort *vp = w->viewport; + const Viewport *vp = w->viewport; if (w->viewport->follow_vehicle != INVALID_VEHICLE) { const Vehicle *veh = Vehicle::Get(w->viewport->follow_vehicle); @@ -1866,7 +1866,7 @@ void UpdateViewportPosition(Window *w) * @param bottom Bottom edge of area to repaint * @ingroup dirty */ -static void MarkViewportDirty(const ViewPort *vp, int left, int top, int right, int bottom) +static void MarkViewportDirty(const Viewport *vp, int left, int top, int right, int bottom) { /* Rounding wrt. zoom-out level */ right += (1 << vp->zoom) - 1; @@ -1906,7 +1906,7 @@ void MarkAllViewportsDirty(int left, int { Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { - ViewPort *vp = w->viewport; + Viewport *vp = w->viewport; if (vp != nullptr) { assert(vp->width != 0); MarkViewportDirty(vp, left, top, right, bottom); @@ -2077,7 +2077,7 @@ void SetSelectionRed(bool b) * @param sign the sign to check * @return true if the sign was hit */ -static bool CheckClickOnViewportSign(const ViewPort *vp, int x, int y, const ViewportSign *sign) +static bool CheckClickOnViewportSign(const Viewport *vp, int x, int y, const ViewportSign *sign) { bool small = (vp->zoom >= ZOOM_LVL_OUT_16X); int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, vp->zoom); @@ -2095,7 +2095,7 @@ static bool CheckClickOnViewportSign(con * @param y Y position of click * @return true if the sign was hit */ -static bool CheckClickOnViewportSign(const ViewPort *vp, int x, int y) +static bool CheckClickOnViewportSign(const Viewport *vp, int x, int y) { if (_game_mode == GM_MENU) return false; @@ -2267,7 +2267,7 @@ void RebuildViewportKdtree() } -static bool CheckClickOnLandscape(const ViewPort *vp, int x, int y) +static bool CheckClickOnLandscape(const Viewport *vp, int x, int y) { Point pt = TranslateXYToTileCoord(vp, x, y); @@ -2296,7 +2296,7 @@ static void PlaceObject() } -bool HandleViewportClicked(const ViewPort *vp, int x, int y) +bool HandleViewportClicked(const Viewport *vp, int x, int y) { const Vehicle *v = CheckClickOnVehicle(vp, x, y); @@ -3355,7 +3355,7 @@ void ResetObjectToPlace() SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0); } -Point GetViewportStationMiddle(const ViewPort *vp, const Station *st) +Point GetViewportStationMiddle(const Viewport *vp, const Station *st) { int x = TileX(st->xy) * TILE_SIZE; int y = TileY(st->xy) * TILE_SIZE;