Reduce viewport invalidation area of track reservation changes
This commit is contained in:
@@ -106,7 +106,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
|||||||
if (IsBridgeTile(tile)) {
|
if (IsBridgeTile(tile)) {
|
||||||
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
||||||
} else {
|
} else {
|
||||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
MarkTileGroundDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
|||||||
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
|
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
|
||||||
if (IsTunnel(tile) && !HasTunnelReservation(tile)) {
|
if (IsTunnel(tile) && !HasTunnelReservation(tile)) {
|
||||||
SetTunnelReservation(tile, true);
|
SetTunnelReservation(tile, true);
|
||||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
MarkTileGroundDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (IsBridge(tile)) {
|
if (IsBridge(tile)) {
|
||||||
@@ -200,7 +200,7 @@ void UnreserveRailTrack(TileIndex tile, Track t)
|
|||||||
if (IsBridgeTile(tile)) {
|
if (IsBridgeTile(tile)) {
|
||||||
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
||||||
} else {
|
} else {
|
||||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
MarkTileGroundDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3358,6 +3358,15 @@ void MarkTileDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MarkTileGroundDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||||
|
{
|
||||||
|
int x = TileX(tile) * TILE_SIZE;
|
||||||
|
int y = TileY(tile) * TILE_SIZE;
|
||||||
|
Point top = RemapCoords(x, y, GetTileMaxPixelZ(tile));
|
||||||
|
Point bot = RemapCoords(x + TILE_SIZE, y + TILE_SIZE, GetTilePixelZ(tile));
|
||||||
|
MarkAllViewportsDirty(top.x - TILE_PIXELS * ZOOM_LVL_BASE, top.y - TILE_HEIGHT * ZOOM_LVL_BASE, top.x + TILE_PIXELS * ZOOM_LVL_BASE, bot.y);
|
||||||
|
}
|
||||||
|
|
||||||
void MarkTileLineDirty(const TileIndex from_tile, const TileIndex to_tile)
|
void MarkTileLineDirty(const TileIndex from_tile, const TileIndex to_tile)
|
||||||
{
|
{
|
||||||
assert(from_tile != INVALID_TILE);
|
assert(from_tile != INVALID_TILE);
|
||||||
|
@@ -104,6 +104,8 @@ static inline void MarkTileDirtyByTile(TileIndex tile, const ZoomLevel mark_dirt
|
|||||||
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below, bridge_level_offset, TileHeight(tile));
|
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below, bridge_level_offset, TileHeight(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MarkTileGroundDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below);
|
||||||
|
|
||||||
ViewportMapType ChangeRenderMode(const ViewPort *vp, bool down);
|
ViewportMapType ChangeRenderMode(const ViewPort *vp, bool down);
|
||||||
|
|
||||||
Point GetViewportStationMiddle(const ViewPort *vp, const Station *st);
|
Point GetViewportStationMiddle(const ViewPort *vp, const Station *st);
|
||||||
|
Reference in New Issue
Block a user