Viewport: Replace viewport mark dirty if zoom level below with flags param
Fix missing flags for tracerestrict and effect vehicles
This commit is contained in:
@@ -29,7 +29,7 @@ void DeleteAnimatedTile(TileIndex tile)
|
||||
if (to_remove != _animated_tiles.end()) {
|
||||
/* The order of the remaining elements must stay the same, otherwise the animation loop may miss a tile. */
|
||||
_animated_tiles.erase(to_remove);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void DeleteAnimatedTile(TileIndex tile)
|
||||
*/
|
||||
void AddAnimatedTile(TileIndex tile)
|
||||
{
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
include(_animated_tiles, tile);
|
||||
}
|
||||
|
||||
|
@@ -196,7 +196,7 @@ static void UpdateFences(TileIndex tile)
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if (dirty) MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
if (dirty) MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ static void TileLoop_Clear(TileIndex tile)
|
||||
return;
|
||||
}
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
void GenerateClearTile()
|
||||
|
@@ -580,7 +580,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
}
|
||||
SetAnimationFrame(tile, m);
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -598,7 +598,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
}
|
||||
SetAnimationFrame(tile, m);
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -612,7 +612,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
}
|
||||
SetAnimationFrame(tile, m);
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -625,7 +625,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
DeleteAnimatedTile(tile);
|
||||
} else {
|
||||
SetAnimationFrame(tile, m + 1);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -651,7 +651,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
}
|
||||
|
||||
SetAnimationFrame(tile, m);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -664,7 +664,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
|
||||
gfx = (gfx < 155) ? gfx + 1 : 148;
|
||||
SetIndustryGfx(tile, gfx);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -683,7 +683,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
} else {
|
||||
SetAnimationFrame(tile, m);
|
||||
SetIndustryGfx(tile, gfx);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -709,7 +709,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
byte m = (GetAnimationFrame(tile) + 1) | 0x40;
|
||||
if (m > 0xC2) m = 0xC0;
|
||||
SetAnimationFrame(tile, m);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
} else if (state >= 0x200 && state < 0x3A0) {
|
||||
int i = (state < 0x220 || state >= 0x380) ? 7 : 3;
|
||||
if (state & i) return;
|
||||
@@ -717,7 +717,7 @@ void AnimateTile_Industry(TileIndex tile)
|
||||
byte m = (GetAnimationFrame(tile) & 0xBF) - 1;
|
||||
if (m < 0x80) m = 0x82;
|
||||
SetAnimationFrame(tile, m);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -747,7 +747,7 @@ static void MakeIndustryTileBigger(TileIndex tile)
|
||||
StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE);
|
||||
if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile);
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
|
||||
if (!IsIndustryCompleted(tile)) return;
|
||||
|
||||
@@ -841,7 +841,7 @@ static void TileLoop_Industry(TileIndex tile)
|
||||
ResetIndustryConstructionStage(tile);
|
||||
SetIndustryCompleted(tile);
|
||||
SetIndustryGfx(tile, newgfx);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -852,7 +852,7 @@ static void TileLoop_Industry(TileIndex tile)
|
||||
if (newgfx != INDUSTRYTILE_NOANIM) {
|
||||
ResetIndustryConstructionStage(tile);
|
||||
SetIndustryGfx(tile, newgfx);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1055,7 +1055,7 @@ static void PlantFarmField(TileIndex tile, IndustryID industry)
|
||||
if (IsSuitableForFarmField(cur_tile, true)) {
|
||||
MakeField(cur_tile, field_type, industry);
|
||||
SetClearCounter(cur_tile, counter);
|
||||
MarkTileDirtyByTile(cur_tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(cur_tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -88,18 +88,18 @@ void LinkGraphOverlay::MarkStationViewportLinksDirty(const Station *st)
|
||||
Viewport *vp = this->window->viewport;
|
||||
const Point pt = RemapCoords2(TileX(st->xy) * TILE_SIZE, TileY(st->xy) * TILE_SIZE);
|
||||
const int padding = ScaleByZoom(3 * this->scale, vp->zoom);
|
||||
MarkViewportDirty(vp, pt.x - padding, pt.y - padding, pt.x + padding, pt.y - padding);
|
||||
MarkViewportDirty(vp, pt.x - padding, pt.y - padding, pt.x + padding, pt.y - padding, VMDF_NONE);
|
||||
|
||||
const int block_radius = ScaleByZoom(10, vp->zoom);
|
||||
for (LinkList::iterator i(this->cached_links.begin()); i != this->cached_links.end(); ++i) {
|
||||
if (i->from_id == st->index) {
|
||||
const Station *stb = Station::GetIfValid(i->to_id);
|
||||
if (stb == nullptr) continue;
|
||||
MarkViewportLineDirty(vp, pt, RemapCoords2(TileX(stb->xy) * TILE_SIZE, TileY(stb->xy) * TILE_SIZE), block_radius);
|
||||
MarkViewportLineDirty(vp, pt, RemapCoords2(TileX(stb->xy) * TILE_SIZE, TileY(stb->xy) * TILE_SIZE), block_radius, VMDF_NONE);
|
||||
} else if (i->to_id == st->index) {
|
||||
const Station *sta = Station::GetIfValid(i->from_id);
|
||||
if (sta == nullptr) continue;
|
||||
MarkViewportLineDirty(vp, RemapCoords2(TileX(sta->xy) * TILE_SIZE, TileY(sta->xy) * TILE_SIZE), pt, block_radius);
|
||||
MarkViewportLineDirty(vp, RemapCoords2(TileX(sta->xy) * TILE_SIZE, TileY(sta->xy) * TILE_SIZE), pt, block_radius, VMDF_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -99,7 +99,7 @@ struct AnimationBase {
|
||||
}
|
||||
|
||||
SetAnimationFrame(tile, frame);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -750,7 +750,7 @@ bool NewHouseTileLoop(TileIndex tile)
|
||||
}
|
||||
|
||||
SetHouseProcessingTime(tile, hs->processing_time);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -790,7 +790,7 @@ static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_rando
|
||||
case HOUSE_TRIGGER_TILE_LOOP_TOP:
|
||||
if (!first) {
|
||||
/* The top tile is marked dirty by the usual TileLoop */
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
break;
|
||||
}
|
||||
/* Random value of first tile already set. */
|
||||
|
@@ -332,7 +332,7 @@ static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, I
|
||||
random_bits &= ~object.reseed[VSG_SCOPE_SELF];
|
||||
random_bits |= new_random_bits & object.reseed[VSG_SCOPE_SELF];
|
||||
SetIndustryRandomBits(tile, random_bits);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
|
||||
reseed_industry |= object.reseed[VSG_SCOPE_PARENT];
|
||||
}
|
||||
|
@@ -1029,7 +1029,7 @@ void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigg
|
||||
random_bits |= Random() & reseed;
|
||||
SetStationTileRandomBits(tile, random_bits);
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -122,7 +122,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
|
||||
DirtyCompanyInfrastructureWindows(owner);
|
||||
}
|
||||
MakeObject(t, owner, o->index, wc, Random());
|
||||
MarkTileDirtyByTile(t, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(t, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
Object::IncTypeCount(type);
|
||||
@@ -138,7 +138,7 @@ static void IncreaseAnimationStage(TileIndex tile)
|
||||
TileArea ta = Object::GetByTile(tile)->location;
|
||||
TILE_AREA_LOOP(t, ta) {
|
||||
SetAnimationFrame(t, GetAnimationFrame(t) + 1);
|
||||
MarkTileDirtyByTile(t, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(t, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -287,14 +287,14 @@ static void NPFMarkTile(TileIndex tile)
|
||||
/* DEBUG: mark visited tiles by mowing the grass under them ;-) */
|
||||
if (!IsRailDepot(tile)) {
|
||||
SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_ROAD:
|
||||
if (!IsRoadDepot(tile)) {
|
||||
SetRoadside(tile, ROADSIDE_BARREN);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -110,7 +110,7 @@ private:
|
||||
do {
|
||||
if (HasStationReservation(tile)) return false;
|
||||
SetRailStationReservation(tile, true);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
tile = TILE_ADD(tile, diff);
|
||||
} while (IsCompatibleTrainStationTile(tile, start) && tile != m_origin_tile);
|
||||
|
||||
|
24
src/pbs.cpp
24
src/pbs.cpp
@@ -65,7 +65,7 @@ void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool
|
||||
|
||||
do {
|
||||
SetRailStationReservation(tile, b);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
tile = TILE_ADD(tile, diff);
|
||||
} while (IsCompatibleTrainStationTile(tile, start));
|
||||
}
|
||||
@@ -105,9 +105,9 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
/* show the reserved rail if needed */
|
||||
if (IsBridgeTile(tile)) {
|
||||
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeDirty(tile, VMDF_NOT_MAP_MODE);
|
||||
} else {
|
||||
MarkTileGroundDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileGroundDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
||||
if (IsRailDepot(tile)) {
|
||||
if (!HasDepotReservation(tile)) {
|
||||
SetDepotReservation(tile, true);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP); // some GRFs change their appearance when tile is reserved
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE); // some GRFs change their appearance when tile is reserved
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
||||
if (HasStationRail(tile) && !HasStationReservation(tile)) {
|
||||
SetRailStationReservation(tile, true);
|
||||
if (trigger_stations && IsRailStation(tile)) TriggerStationRandomisation(nullptr, tile, SRT_PATH_RESERVATION);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP); // some GRFs need redraw after reserving track
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE); // some GRFs need redraw after reserving track
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -156,12 +156,12 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
||||
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
|
||||
if (IsTunnel(tile) && !HasTunnelReservation(tile)) {
|
||||
SetTunnelReservation(tile, true);
|
||||
MarkTileGroundDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileGroundDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return true;
|
||||
}
|
||||
if (IsBridge(tile)) {
|
||||
if (TryReserveRailBridgeHead(tile, t)) {
|
||||
MarkBridgeOrTunnelDirtyOnReservationChange(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeOrTunnelDirtyOnReservationChange(tile, VMDF_NOT_MAP_MODE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -200,9 +200,9 @@ void UnreserveRailTrack(TileIndex tile, Track t)
|
||||
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
if (IsBridgeTile(tile)) {
|
||||
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeDirty(tile, VMDF_NOT_MAP_MODE);
|
||||
} else {
|
||||
MarkTileGroundDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileGroundDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ void UnreserveRailTrack(TileIndex tile, Track t)
|
||||
case MP_RAILWAY:
|
||||
if (IsRailDepot(tile)) {
|
||||
SetDepotReservation(tile, false);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
break;
|
||||
}
|
||||
if (IsPlainRail(tile)) UnreserveTrack(tile, t);
|
||||
@@ -226,7 +226,7 @@ void UnreserveRailTrack(TileIndex tile, Track t)
|
||||
case MP_STATION:
|
||||
if (HasStationRail(tile)) {
|
||||
SetRailStationReservation(tile, false);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -238,7 +238,7 @@ void UnreserveRailTrack(TileIndex tile, Track t)
|
||||
UnreserveRailBridgeHeadTrack(tile, t);
|
||||
}
|
||||
if (IsTunnelBridgeSignalSimulationExit(tile) && IsTunnelBridgePBS(tile) && IsTrackAcrossTunnelBridge(tile, t)) SetTunnelBridgeExitSignalState(tile, SIGNAL_STATE_RED);
|
||||
MarkBridgeOrTunnelDirtyOnReservationChange(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeOrTunnelDirtyOnReservationChange(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -1023,7 +1023,7 @@ bool FloodHalftile(TileIndex t)
|
||||
if (IsSteepSlope(tileh) || IsSlopeWithThreeCornersRaised(tileh)) {
|
||||
flooded = true;
|
||||
SetRailGroundType(t, RAIL_GROUND_WATER);
|
||||
MarkTileDirtyByTile(t, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(t, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1583,7 +1583,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
uint mask = GetPresentSignals(tile) & SignalOnTrack(track);
|
||||
SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetRailReservationTrackBits(tile), track) && EnsureNoVehicleOnGround(tile).Succeeded() ? UINT_MAX : 0) & mask));
|
||||
}
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
AddTrackToSignalBuffer(tile, track, _current_company);
|
||||
YapfNotifyTrackLayoutChange(tile, track);
|
||||
if (v != nullptr) {
|
||||
@@ -1989,7 +1989,7 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||
TryPathReserve(v, false);
|
||||
}
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
return CommandCost(EXPENSES_CONSTRUCTION, cost);
|
||||
@@ -2214,7 +2214,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
SetRailType(tile, totype);
|
||||
if (IsPlainRailTile(tile)) SetSecondaryRailType(tile, totype);
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
/* update power of train on this tile */
|
||||
FindVehicleOnPos(tile, VEH_TRAIN, &affected_trains, &UpdateTrainPowerProc);
|
||||
}
|
||||
@@ -2300,10 +2300,10 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
yapf_notify_track_change(endtile, GetTunnelBridgeTrackBits(endtile));
|
||||
|
||||
if (IsBridge(tile)) {
|
||||
MarkBridgeDirty(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeDirty(tile, VMDF_NOT_MAP_MODE);
|
||||
} else {
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(endtile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
MarkTileDirtyByTile(endtile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
AddRailTunnelBridgeInfrastructure(tile, endtile);
|
||||
@@ -2559,7 +2559,7 @@ static void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track trac
|
||||
void MarkSingleSignalDirty(TileIndex tile, Trackdir td)
|
||||
{
|
||||
if (_signal_sprite_oversized || td >= TRACKDIR_END) {
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2590,7 +2590,7 @@ void MarkSingleSignalDirty(TileIndex tile, Trackdir td)
|
||||
pt.y - SIGNAL_DIRTY_TOP,
|
||||
pt.x + SIGNAL_DIRTY_RIGHT,
|
||||
pt.y + SIGNAL_DIRTY_BOTTOM,
|
||||
ZOOM_LVL_DRAW_MAP
|
||||
VMDF_NOT_MAP_MODE
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3461,7 +3461,7 @@ static void TileLoop_Track(TileIndex tile)
|
||||
set_ground:
|
||||
if (old_ground != new_ground) {
|
||||
SetRailGroundType(tile, new_ground);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2121,7 +2121,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||
TileY(tile) * TILE_SIZE + 7,
|
||||
0,
|
||||
EV_BULLDOZER);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2146,7 +2146,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||
cur_rs = ROADSIDE_BARREN;
|
||||
}
|
||||
SetRoadside(tile, cur_rs);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
} else if (IncreaseRoadWorksCounter(tile)) {
|
||||
TerminateRoadWorks(tile);
|
||||
@@ -2161,7 +2161,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||
|
||||
/* If new_rb is 0, there are now no road pieces left and the tile is no longer a road tile */
|
||||
if (new_rb == 0) {
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2175,7 +2175,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||
}
|
||||
}
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -522,7 +522,7 @@ static void UpdateSignalsAroundSegment(SigInfo info)
|
||||
SignalState new_state = (info.flags & SF_TRAIN) ? SIGNAL_STATE_RED : SIGNAL_STATE_GREEN;
|
||||
if (old_state != new_state) {
|
||||
SetTunnelBridgeExitSignalState(tile, new_state);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@@ -241,7 +241,7 @@ void Station::MarkTilesDirty(bool cargo_change) const
|
||||
for (h = 0; h < train_station.h; h++) {
|
||||
for (w = 0; w < train_station.w; w++) {
|
||||
if (this->TileBelongsToRailStation(tile)) {
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
tile += TileDiffXY(1, 0);
|
||||
}
|
||||
|
@@ -312,7 +312,7 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
MarkTileDirtyByTile(*it);
|
||||
TileIndexToHeightMap::const_iterator new_height = ts.tile_to_new_height.find(tile);
|
||||
if (new_height == ts.tile_to_new_height.end()) continue;
|
||||
MarkTileDirtyByTile(*it, ZOOM_LVL_END, 0, new_height->second);
|
||||
MarkTileDirtyByTile(*it, VMDF_NONE, 0, new_height->second);
|
||||
}
|
||||
|
||||
/* change the height */
|
||||
|
@@ -480,7 +480,7 @@ void AnimateTile_Town(TileIndex tile)
|
||||
DeleteAnimatedTile(tile);
|
||||
}
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -602,7 +602,7 @@ static void MakeSingleHouseBigger(TileIndex tile)
|
||||
ChangePopulation(Town::GetByTile(tile), HouseSpec::Get(GetHouseType(tile))->population);
|
||||
ResetHouseAge(tile);
|
||||
}
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1064,7 +1064,7 @@ void TraceRestrictCreateProgramMapping(TraceRestrictRefId ref, TraceRestrictProg
|
||||
TileIndex tile = GetTraceRestrictRefIdTileIndex(ref);
|
||||
Track track = GetTraceRestrictRefIdTrack(ref);
|
||||
TraceRestrictSetIsSignalRestrictedBit(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
YapfNotifyTrackLayoutChange(tile, track);
|
||||
}
|
||||
|
||||
@@ -1089,7 +1089,7 @@ bool TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
|
||||
TileIndex tile = GetTraceRestrictRefIdTileIndex(ref);
|
||||
Track track = GetTraceRestrictRefIdTrack(ref);
|
||||
TraceRestrictSetIsSignalRestrictedBit(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
YapfNotifyTrackLayoutChange(tile, track);
|
||||
|
||||
if (remove_other_mapping) {
|
||||
|
@@ -1998,7 +1998,7 @@ static void UpdateLevelCrossingTile(TileIndex tile, bool sound, bool is_forced,
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_0E_LEVEL_CROSSING, tile);
|
||||
}
|
||||
SetCrossingBarred(tile, new_state);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2225,11 +2225,11 @@ void ReverseTrainDirection(Train *v)
|
||||
TrackdirBits reserved = ft.m_new_td_bits & TrackBitsToTrackdirBits(GetReservedTrackbits(ft.m_new_tile));
|
||||
if (reserved == TRACKDIR_BIT_NONE) {
|
||||
UnreserveAcrossRailTunnelBridge(next_tile);
|
||||
MarkTileDirtyByTile(next_tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(next_tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
} else {
|
||||
UnreserveAcrossRailTunnelBridge(next_tile);
|
||||
MarkTileDirtyByTile(next_tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(next_tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2691,7 +2691,7 @@ static bool CheckTrainStayInDepot(Train *v)
|
||||
}
|
||||
|
||||
SetDepotReservation(v->tile, true);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile, ZOOM_LVL_DRAW_MAP);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile, VMDF_NOT_MAP_MODE);
|
||||
|
||||
VehicleServiceInDepot(v);
|
||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||
@@ -2802,17 +2802,17 @@ static void ClearPathReservation(const Train *v, TileIndex tile, Trackdir track_
|
||||
TileIndex end = GetOtherTunnelBridgeEnd(tile);
|
||||
UnreserveAcrossRailTunnelBridge(end);
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
MarkTileDirtyByTile(end, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(end, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
MarkBridgeOrTunnelDirtyOnReservationChange(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeOrTunnelDirtyOnReservationChange(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
} else {
|
||||
UnreserveRailTrack(tile, TrackdirToTrack(track_dir));
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
} else if (IsRailStationTile(tile)) {
|
||||
@@ -3408,7 +3408,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay)
|
||||
/* If we are in a depot, tentatively reserve the depot. */
|
||||
if (v->track == TRACK_BIT_DEPOT && v->tile == origin.tile) {
|
||||
SetDepotReservation(v->tile, true);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile, ZOOM_LVL_DRAW_MAP);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
DiagDirection exitdir = TrackdirToExitdir(origin.trackdir);
|
||||
@@ -3916,7 +3916,7 @@ static bool CheckTrainStayInWormHolePathReserve(Train *t, TileIndex tile)
|
||||
} else {
|
||||
SetTunnelReservation(tile, true);
|
||||
}
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
bool ok = TryPathReserve(t);
|
||||
@@ -4375,7 +4375,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
||||
v->y_pos = gp.y;
|
||||
UpdateSignalsOnSegment(old_tile, INVALID_DIAGDIR, v->owner);
|
||||
UnreserveBridgeTunnelTile(old_tile);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(old_tile, ZOOM_LVL_DRAW_MAP);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(old_tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
if (distance == 0) v->tunnel_bridge_signal_num++;
|
||||
@@ -4623,11 +4623,11 @@ static void SetSignalledBridgeTunnelGreenIfClear(TileIndex tile, TileIndex end)
|
||||
if (IsTunnelBridgeSignalSimulationEntrance(t)) {
|
||||
if (IsBridge(t)) {
|
||||
SetAllBridgeEntranceSimulatedSignalsGreen(t);
|
||||
MarkBridgeDirty(t, ZOOM_LVL_DRAW_MAP);
|
||||
MarkBridgeDirty(t, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
if (IsTunnelBridgeSignalSimulationEntrance(t) && GetTunnelBridgeEntranceSignalState(t) == SIGNAL_STATE_RED) {
|
||||
SetTunnelBridgeEntranceSignalState(t, SIGNAL_STATE_GREEN);
|
||||
MarkTileDirtyByTile(t, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(t, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -446,7 +446,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
AddTreeCount(tile, 1);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
if (c != nullptr) c->tree_limit -= 1 << 16;
|
||||
}
|
||||
/* 2x as expensive to add more trees to an existing tile */
|
||||
@@ -523,7 +523,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
|
||||
/* Plant full grown trees in scenario editor */
|
||||
PlantTreesOnTile(tile, treetype, 0, _game_mode == GM_EDITOR ? 3 : 0);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
if (c != nullptr) c->tree_limit -= 1 << 16;
|
||||
|
||||
/* When planting rainforest-trees, set tropiczone to rainforest in editor. */
|
||||
@@ -677,7 +677,7 @@ static void TileLoopTreesDesert(TileIndex tile)
|
||||
case TROPICZONE_DESERT:
|
||||
if (GetTreeGround(tile) != TREE_GROUND_SNOW_DESERT) {
|
||||
SetTreeGroundDensity(tile, TREE_GROUND_SNOW_DESERT, 3);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -726,7 +726,7 @@ static void TileLoopTreesAlps(TileIndex tile)
|
||||
return;
|
||||
}
|
||||
}
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
static bool CanPlantExtraTrees(TileIndex tile)
|
||||
@@ -756,7 +756,7 @@ static void TileLoop_Trees(TileIndex tile)
|
||||
uint density = GetTreeDensity(tile);
|
||||
if (density < 3) {
|
||||
SetTreeGroundDensity(tile, TREE_GROUND_GRASS, density + 1);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
if (GetTreeCounter(tile) < 15) {
|
||||
@@ -856,7 +856,7 @@ static void TileLoop_Trees(TileIndex tile)
|
||||
break;
|
||||
}
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
void OnTick_Trees()
|
||||
|
@@ -13,10 +13,6 @@
|
||||
#include "map_func.h"
|
||||
#include "tile_map.h"
|
||||
|
||||
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
|
||||
void MarkBridgeDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
|
||||
void MarkBridgeOrTunnelDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
|
||||
void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
|
||||
uint GetTunnelBridgeSignalSimulationSignalCount(TileIndex begin, TileIndex end);
|
||||
|
||||
/**
|
||||
|
@@ -80,35 +80,35 @@ extern CommandCost IsRoadStopBridgeAboveOK(TileIndex tile, bool drive_through, D
|
||||
* @param direction Direction from \a begin to \a end.
|
||||
* @param bridge_height Bridge height level.
|
||||
*/
|
||||
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
TileIndexDiff delta = TileOffsByDiagDir(direction);
|
||||
for (TileIndex t = begin; t != end; t += delta) {
|
||||
MarkTileDirtyByTile(t, mark_dirty_if_zoomlevel_is_below, bridge_height - TileHeight(t));
|
||||
MarkTileDirtyByTile(t, flags, bridge_height - TileHeight(t));
|
||||
}
|
||||
MarkTileDirtyByTile(end, mark_dirty_if_zoomlevel_is_below);
|
||||
MarkTileDirtyByTile(end, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark bridge tiles dirty.
|
||||
* @param tile Bridge head.
|
||||
*/
|
||||
void MarkBridgeDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||
void MarkBridgeDirty(TileIndex tile, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
MarkBridgeDirty(tile, GetOtherTunnelBridgeEnd(tile), GetTunnelBridgeDirection(tile), GetBridgeHeight(tile), mark_dirty_if_zoomlevel_is_below);
|
||||
MarkBridgeDirty(tile, GetOtherTunnelBridgeEnd(tile), GetTunnelBridgeDirection(tile), GetBridgeHeight(tile), flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark bridge or tunnel tiles dirty.
|
||||
* @param tile Bridge head or tunnel entrance.
|
||||
*/
|
||||
void MarkBridgeOrTunnelDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||
void MarkBridgeOrTunnelDirty(TileIndex tile, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
if (IsBridge(tile)) {
|
||||
MarkBridgeDirty(tile, mark_dirty_if_zoomlevel_is_below);
|
||||
MarkBridgeDirty(tile, flags);
|
||||
} else {
|
||||
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below);
|
||||
MarkTileDirtyByTile(GetOtherTunnelBridgeEnd(tile), mark_dirty_if_zoomlevel_is_below);
|
||||
MarkTileDirtyByTile(tile, flags);
|
||||
MarkTileDirtyByTile(GetOtherTunnelBridgeEnd(tile), flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,14 +116,14 @@ void MarkBridgeOrTunnelDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zooml
|
||||
* Mark bridge or tunnel tiles dirty on tunnel/bridge head reservation change
|
||||
* @param tile Bridge head or tunnel entrance.
|
||||
*/
|
||||
void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||
void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
if (IsTunnelBridgeWithSignalSimulation(tile)) {
|
||||
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below);
|
||||
MarkTileDirtyByTile(tile, flags);
|
||||
} else if (IsBridge(tile)) {
|
||||
MarkBridgeDirty(tile, mark_dirty_if_zoomlevel_is_below);
|
||||
MarkBridgeDirty(tile, flags);
|
||||
} else {
|
||||
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below);
|
||||
MarkTileDirtyByTile(tile, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1287,7 +1287,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
|
||||
if (height < minz) SetRoadside(c, ROADSIDE_PAVED);
|
||||
}
|
||||
ClearBridgeMiddle(c);
|
||||
MarkTileDirtyByTile(c, ZOOM_LVL_DRAW_MAP, height - TileHeight(c));
|
||||
MarkTileDirtyByTile(c, VMDF_NOT_MAP_MODE, height - TileHeight(c));
|
||||
}
|
||||
|
||||
if (rail) {
|
||||
|
@@ -2176,7 +2176,7 @@ void VehicleEnterDepot(Vehicle *v)
|
||||
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||
/* Clear path reservation */
|
||||
SetDepotReservation(t->tile, false);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile, ZOOM_LVL_DRAW_MAP);
|
||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile, VMDF_NOT_MAP_MODE);
|
||||
|
||||
UpdateSignalsOnSegment(t->tile, INVALID_DIAGDIR, t->owner);
|
||||
t->wait_counter = 0;
|
||||
@@ -2332,7 +2332,7 @@ void Vehicle::UpdateViewport(bool dirty)
|
||||
min(old_coord.top, this->coord.top),
|
||||
max(old_coord.right, this->coord.right),
|
||||
max(old_coord.bottom, this->coord.bottom),
|
||||
this->type != VEH_EFFECT ? ZOOM_LVL_END : ZOOM_LVL_DRAW_MAP
|
||||
this->type != VEH_EFFECT ? VMDF_NONE : VMDF_NOT_MAP_MODE
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2352,7 +2352,7 @@ void Vehicle::UpdatePositionAndViewport()
|
||||
*/
|
||||
void Vehicle::MarkAllViewportsDirty() const
|
||||
{
|
||||
::MarkAllViewportsDirty(this->coord.left, this->coord.top, this->coord.right, this->coord.bottom);
|
||||
::MarkAllViewportsDirty(this->coord.left, this->coord.top, this->coord.right, this->coord.bottom, this->type != VEH_EFFECT ? VMDF_NONE : VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
|
||||
VehicleOrderID Vehicle::GetFirstWaitingLocation(bool require_wait_timetabled) const
|
||||
|
@@ -1836,7 +1836,7 @@ void ViewportSign::MarkDirty(ZoomLevel maxzoom) const
|
||||
for (Viewport *vp : _viewport_window_cache) {
|
||||
if (vp->zoom <= maxzoom) {
|
||||
Rect &zl = zoomlevels[vp->zoom];
|
||||
MarkViewportDirty(vp, zl.left, zl.top, zl.right, zl.bottom);
|
||||
MarkViewportDirty(vp, zl.left, zl.top, zl.right, zl.bottom, VMDF_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3404,7 +3404,7 @@ void UpdateActiveScrollingViewport(Window *w)
|
||||
* @param bottom Bottom edge of area to repaint
|
||||
* @ingroup dirty
|
||||
*/
|
||||
void MarkViewportDirty(Viewport * const vp, int left, int top, int right, int bottom)
|
||||
void MarkViewportDirty(Viewport * const vp, int left, int top, int right, int bottom, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
/* Rounding wrt. zoom-out level */
|
||||
right += (1 << vp->zoom) - 1;
|
||||
@@ -3449,14 +3449,14 @@ void MarkViewportDirty(Viewport * const vp, int left, int top, int right, int bo
|
||||
* @param top Top edge of area to repaint. (viewport coordinates, that is wrt. #ZOOM_LVL_NORMAL)
|
||||
* @param right Right edge of area to repaint. (viewport coordinates, that is wrt. #ZOOM_LVL_NORMAL)
|
||||
* @param bottom Bottom edge of area to repaint. (viewport coordinates, that is wrt. #ZOOM_LVL_NORMAL)
|
||||
* @param mark_dirty_if_zoomlevel_is_below To tell if an update is relevant or not (for example, animations in map mode are not)
|
||||
* @param flags To tell if an update is relevant or not (for example, animations in map mode are not)
|
||||
* @ingroup dirty
|
||||
*/
|
||||
void MarkAllViewportsDirty(int left, int top, int right, int bottom, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||
void MarkAllViewportsDirty(int left, int top, int right, int bottom, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
for (Viewport * const vp : _viewport_window_cache) {
|
||||
if (vp->zoom >= mark_dirty_if_zoomlevel_is_below) continue;
|
||||
MarkViewportDirty(vp, left, top, right, bottom);
|
||||
if (flags & VMDF_NOT_MAP_MODE && vp->zoom >= ZOOM_LVL_DRAW_MAP) continue;
|
||||
MarkViewportDirty(vp, left, top, right, bottom, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3474,7 +3474,7 @@ static void MarkRouteStepDirty(const TileIndex tile, uint order_nr)
|
||||
for (Viewport * const vp : _viewport_window_cache) {
|
||||
const int half_width = ScaleByZoom((_vp_route_step_width / 2) + 1, vp->zoom);
|
||||
const int height = ScaleByZoom(_vp_route_step_height_top + char_height * order_nr + _vp_route_step_height_bottom, vp->zoom);
|
||||
MarkViewportDirty(vp, pt.x - half_width, pt.y - height, pt.x + half_width, pt.y);
|
||||
MarkViewportDirty(vp, pt.x - half_width, pt.y - height, pt.x + half_width, pt.y, VMDF_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3503,7 +3503,7 @@ void MarkAllViewportMapsDirty(int left, int top, int right, int bottom)
|
||||
Viewport *vp = w->viewport;
|
||||
if (vp != nullptr && vp->zoom >= ZOOM_LVL_DRAW_MAP) {
|
||||
assert(vp->width != 0);
|
||||
MarkViewportDirty(vp, left, top, right, bottom);
|
||||
MarkViewportDirty(vp, left, top, right, bottom, VMDF_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3541,12 +3541,12 @@ void ConstrainAllViewportsZoom()
|
||||
/**
|
||||
* Mark a tile given by its index dirty for repaint.
|
||||
* @param tile The tile to mark dirty.
|
||||
* @param mark_dirty_if_zoomlevel_is_below To tell if an update is relevant or not (for example, animations in map mode are not).
|
||||
* @param flags To tell if an update is relevant or not (for example, animations in map mode are not).
|
||||
* @param bridge_level_offset Height of bridge on tile to also mark dirty. (Height level relative to north corner.)
|
||||
* @param tile_height_override Height of the tile (#TileHeight).
|
||||
* @ingroup dirty
|
||||
*/
|
||||
void MarkTileDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below, int bridge_level_offset, int tile_height_override)
|
||||
void MarkTileDirtyByTile(TileIndex tile, ViewportMarkDirtyFlags flags, int bridge_level_offset, int tile_height_override)
|
||||
{
|
||||
Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, tile_height_override * TILE_HEIGHT);
|
||||
MarkAllViewportsDirty(
|
||||
@@ -3554,20 +3554,20 @@ void MarkTileDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel
|
||||
pt.y - 122 * ZOOM_LVL_BASE - ZOOM_LVL_BASE * TILE_HEIGHT * bridge_level_offset,
|
||||
pt.x - 31 * ZOOM_LVL_BASE + 67 * ZOOM_LVL_BASE,
|
||||
pt.y - 122 * ZOOM_LVL_BASE + 154 * ZOOM_LVL_BASE,
|
||||
mark_dirty_if_zoomlevel_is_below
|
||||
flags
|
||||
);
|
||||
}
|
||||
|
||||
void MarkTileGroundDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
|
||||
void MarkTileGroundDirtyByTile(TileIndex tile, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
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);
|
||||
MarkAllViewportsDirty(top.x - TILE_PIXELS * ZOOM_LVL_BASE, top.y - TILE_HEIGHT * ZOOM_LVL_BASE, top.x + TILE_PIXELS * ZOOM_LVL_BASE, bot.y, flags);
|
||||
}
|
||||
|
||||
void MarkViewportLineDirty(Viewport * const vp, const Point from_pt, const Point to_pt, const int block_radius)
|
||||
void MarkViewportLineDirty(Viewport * const vp, const Point from_pt, const Point to_pt, const int block_radius, ViewportMarkDirtyFlags flags)
|
||||
{
|
||||
int x1 = from_pt.x / block_radius;
|
||||
int y1 = from_pt.y / block_radius;
|
||||
@@ -3586,7 +3586,8 @@ void MarkViewportLineDirty(Viewport * const vp, const Point from_pt, const Point
|
||||
(x1 - 2) * block_radius,
|
||||
(y1 - 2) * block_radius,
|
||||
(x1 + 2) * block_radius,
|
||||
(y1 + 2) * block_radius
|
||||
(y1 + 2) * block_radius,
|
||||
flags
|
||||
);
|
||||
if (x1 == x2 && y1 == y2) break;
|
||||
const int e2 = 2 * err;
|
||||
@@ -3628,7 +3629,7 @@ void MarkTileLineDirty(const TileIndex from_tile, const TileIndex to_tile)
|
||||
(y1 - 1) * block_radius,
|
||||
(x1 + 1) * block_radius,
|
||||
(y1 + 1) * block_radius,
|
||||
ZOOM_LVL_END
|
||||
VMDF_NONE
|
||||
);
|
||||
if (x1 == x2 && y1 == y2) break;
|
||||
const int e2 = 2 * err;
|
||||
@@ -4200,8 +4201,8 @@ void SetRedErrorSquare(TileIndex tile)
|
||||
_thd.redsq = tile;
|
||||
|
||||
if (tile != old) {
|
||||
if (tile != INVALID_TILE) MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
if (old != INVALID_TILE) MarkTileDirtyByTile(old, ZOOM_LVL_DRAW_MAP);
|
||||
if (tile != INVALID_TILE) MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
if (old != INVALID_TILE) MarkTileDirtyByTile(old, VMDF_NOT_MAP_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,12 +33,12 @@ Point GetTileBelowCursor();
|
||||
void UpdateViewportPosition(Window *w);
|
||||
void UpdateViewportSizeZoom(Viewport *vp);
|
||||
|
||||
void MarkViewportDirty(Viewport * const vp, int left, int top, int right, int bottom);
|
||||
void MarkAllViewportsDirty(int left, int top, int right, int bottom, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
|
||||
void MarkViewportDirty(Viewport * const vp, int left, int top, int right, int bottom, ViewportMarkDirtyFlags flags);
|
||||
void MarkAllViewportsDirty(int left, int top, int right, int bottom, ViewportMarkDirtyFlags flags = VMDF_NONE);
|
||||
void MarkAllViewportMapsDirty(int left, int top, int right, int bottom);
|
||||
void MarkAllViewportOverlayStationLinksDirty(const Station *st);
|
||||
void MarkAllRouteStepsDirty(const Vehicle *veh);
|
||||
void MarkViewportLineDirty(Viewport * const vp, const Point from_pt, const Point to_pt, const int block_radius);
|
||||
void MarkViewportLineDirty(Viewport * const vp, const Point from_pt, const Point to_pt, const int block_radius, ViewportMarkDirtyFlags flags);
|
||||
void MarkTileLineDirty(const TileIndex from_tile, const TileIndex to_tile);
|
||||
void MarkAllRoutePathsDirty(const Vehicle *veh);
|
||||
void CheckMarkDirtyFocusedRoutePaths(const Vehicle *veh);
|
||||
@@ -96,21 +96,21 @@ void ClearAllCachedNames();
|
||||
|
||||
extern Point _tile_fract_coords;
|
||||
|
||||
void MarkTileDirtyByTile(const TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below, int bridge_level_offset, int tile_height_override);
|
||||
void MarkTileDirtyByTile(const TileIndex tile, ViewportMarkDirtyFlags flags, int bridge_level_offset, int tile_height_override);
|
||||
|
||||
/**
|
||||
* Mark a tile given by its index dirty for repaint.
|
||||
* @param tile The tile to mark dirty.
|
||||
* @param mark_dirty_if_zoomlevel_is_below To tell if an update is relevant or not (for example, animations in map mode are not).
|
||||
* @param flags To tell if an update is relevant or not (for example, animations in map mode are not).
|
||||
* @param bridge_level_offset Height of bridge on tile to also mark dirty. (Height level relative to north corner.)
|
||||
* @ingroup dirty
|
||||
*/
|
||||
static inline void MarkTileDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END, int bridge_level_offset = 0)
|
||||
static inline void MarkTileDirtyByTile(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE, int bridge_level_offset = 0)
|
||||
{
|
||||
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below, bridge_level_offset, TileHeight(tile));
|
||||
MarkTileDirtyByTile(tile, flags, bridge_level_offset, TileHeight(tile));
|
||||
}
|
||||
|
||||
void MarkTileGroundDirtyByTile(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below);
|
||||
void MarkTileGroundDirtyByTile(TileIndex tile, ViewportMarkDirtyFlags flags);
|
||||
|
||||
ViewportMapType ChangeRenderMode(const Viewport *vp, bool down);
|
||||
|
||||
@@ -130,4 +130,9 @@ struct Town;
|
||||
void SetViewportCatchmentStation(const Station *st, bool sel);
|
||||
void SetViewportCatchmentTown(const Town *t, bool sel);
|
||||
|
||||
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height, ViewportMarkDirtyFlags flags = VMDF_NONE);
|
||||
void MarkBridgeDirty(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE);
|
||||
void MarkBridgeOrTunnelDirty(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE);
|
||||
void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE);
|
||||
|
||||
#endif /* VIEWPORT_FUNC_H */
|
||||
|
@@ -215,4 +215,10 @@ enum FoundationPart {
|
||||
FOUNDATION_PART_END
|
||||
};
|
||||
|
||||
enum ViewportMarkDirtyFlags : byte {
|
||||
VMDF_NONE = 0,
|
||||
VMDF_NOT_MAP_MODE = 0x1,
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(ViewportMarkDirtyFlags)
|
||||
|
||||
#endif /* VIEWPORT_TYPE_H */
|
||||
|
@@ -1220,7 +1220,7 @@ static void DoDryUp(TileIndex tile)
|
||||
|
||||
case MP_TREES:
|
||||
SetTreeGroundDensity(tile, TREE_GROUND_GRASS, 3);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
break;
|
||||
|
||||
case MP_WATER:
|
||||
|
@@ -287,7 +287,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
|
||||
MakeRailWaypoint(tile, wp->owner, wp->index, axis, layout_ptr[i], GetRailType(tile));
|
||||
SetCustomStationSpecIndex(tile, map_spec_index);
|
||||
SetRailStationReservation(tile, reserved);
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||
|
||||
DeallocateSpecFromStation(wp, old_specindex);
|
||||
YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis));
|
||||
|
Reference in New Issue
Block a user