mirror of https://github.com/OpenTTD/OpenTTD
Fix #9020: Update station coverage highlight when adding/removing tiles
parent
29607d27fa
commit
b076369469
|
@ -741,9 +741,16 @@ static void DeleteStationIfEmpty(BaseStation *st)
|
||||||
void Station::AfterStationTileSetChange(bool adding, StationType type)
|
void Station::AfterStationTileSetChange(bool adding, StationType type)
|
||||||
{
|
{
|
||||||
this->UpdateVirtCoord();
|
this->UpdateVirtCoord();
|
||||||
this->RecomputeCatchment();
|
|
||||||
DirtyCompanyInfrastructureWindows(this->owner);
|
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) {
|
switch (type) {
|
||||||
case STATION_RAIL:
|
case STATION_RAIL:
|
||||||
|
@ -1639,6 +1646,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
|
||||||
if (st->train_station.tile == INVALID_TILE) {
|
if (st->train_station.tile == INVALID_TILE) {
|
||||||
st->facilities &= ~FACIL_TRAIN;
|
st->facilities &= ~FACIL_TRAIN;
|
||||||
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
||||||
|
MarkCatchmentTilesDirty();
|
||||||
st->UpdateVirtCoord();
|
st->UpdateVirtCoord();
|
||||||
DeleteStationIfEmpty(st);
|
DeleteStationIfEmpty(st);
|
||||||
}
|
}
|
||||||
|
@ -1675,6 +1683,7 @@ CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint3
|
||||||
|
|
||||||
if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
||||||
st->MarkTilesDirty(false);
|
st->MarkTilesDirty(false);
|
||||||
|
MarkCatchmentTilesDirty();
|
||||||
st->RecomputeCatchment();
|
st->RecomputeCatchment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3496,7 +3496,7 @@ CommandCost CmdScrollViewport(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MarkCatchmentTilesDirty()
|
void MarkCatchmentTilesDirty()
|
||||||
{
|
{
|
||||||
if (_viewport_highlight_town != nullptr) {
|
if (_viewport_highlight_town != nullptr) {
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
|
|
|
@ -98,5 +98,6 @@ struct Town;
|
||||||
|
|
||||||
void SetViewportCatchmentStation(const Station *st, bool sel);
|
void SetViewportCatchmentStation(const Station *st, bool sel);
|
||||||
void SetViewportCatchmentTown(const Town *t, bool sel);
|
void SetViewportCatchmentTown(const Town *t, bool sel);
|
||||||
|
void MarkCatchmentTilesDirty();
|
||||||
|
|
||||||
#endif /* VIEWPORT_FUNC_H */
|
#endif /* VIEWPORT_FUNC_H */
|
||||||
|
|
Loading…
Reference in New Issue