mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 23:34:37 +01:00
Invalidate viewport when moving without scrolling
This commit is contained in:
@@ -272,6 +272,7 @@ namespace OpenRCT2::Scripting
|
||||
viewport->flags &= ~WF_SCROLLING_TO_LOCATION;
|
||||
w->savedViewPos.x = viewport->viewPos.x;
|
||||
w->savedViewPos.y = viewport->viewPos.y;
|
||||
viewport->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1101,6 +1101,11 @@ std::optional<CoordsXY> screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rct_viewport::Invalidate() const
|
||||
{
|
||||
viewport_invalidate(this, viewPos.x, viewPos.y, viewPos.x + view_width, viewPos.y + view_height);
|
||||
}
|
||||
|
||||
CoordsXY viewport_coord_to_map_coord(const ScreenCoordsXY& coords, int32_t z)
|
||||
{
|
||||
constexpr uint8_t inverseRotationMapping[NumOrthogonalDirections] = { 0, 3, 2, 1 };
|
||||
@@ -1701,7 +1706,7 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc
|
||||
/**
|
||||
* Left, top, right and bottom represent 2D map coordinates at zoom 0.
|
||||
*/
|
||||
void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
void viewport_invalidate(const rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
{
|
||||
// if unknown viewport visibility, use the containing window to discover the status
|
||||
if (viewport->visibility == VisibilityCache::Unknown)
|
||||
|
||||
@@ -161,7 +161,7 @@ bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords);
|
||||
CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords);
|
||||
void sub_68B2B7(paint_session* session, const CoordsXY& mapCoords);
|
||||
|
||||
void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||
void viewport_invalidate(const rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||
|
||||
std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rct_viewport** viewport);
|
||||
std::optional<CoordsXY> screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int16_t z);
|
||||
|
||||
@@ -171,6 +171,8 @@ struct rct_viewport
|
||||
}
|
||||
|
||||
[[nodiscard]] ScreenCoordsXY ScreenToViewportCoord(const ScreenCoordsXY& screenCoord) const;
|
||||
|
||||
void Invalidate() const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user