Fix #9020: Update station coverage highlight when adding/removing tiles

This commit is contained in:
Tyler Trahan
2022-02-22 14:00:37 -07:00
committed by Michael Lutz
parent c73f578e8c
commit fbbc80f79e
3 changed files with 13 additions and 3 deletions

View File

@@ -744,9 +744,16 @@ static void DeleteStationIfEmpty(BaseStation *st)
void Station::AfterStationTileSetChange(bool adding, StationType type)
{
this->UpdateVirtCoord();
this->RecomputeCatchment();
DirtyCompanyInfrastructureWindows(this->owner);
if (adding) InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
if (adding) {
this->RecomputeCatchment();
MarkCatchmentTilesDirty();
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
} else {
MarkCatchmentTilesDirty();
this->RecomputeCatchment();
}
switch (type) {
case STATION_RAIL:
@@ -1628,6 +1635,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
if (st->train_station.tile == INVALID_TILE) {
st->facilities &= ~FACIL_TRAIN;
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
MarkCatchmentTilesDirty();
st->UpdateVirtCoord();
DeleteStationIfEmpty(st);
}
@@ -1662,6 +1670,7 @@ CommandCost CmdRemoveFromRailStation(DoCommandFlag flags, TileIndex start, TileI
if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
st->MarkTilesDirty(false);
MarkCatchmentTilesDirty();
st->RecomputeCatchment();
}