|
|
|
@ -721,6 +721,43 @@ static void DeleteStationIfEmpty(BaseStation *st)
|
|
|
|
|
UpdateStationSignCoord(st);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* After adding/removing tiles to station, update some station-related stuff.
|
|
|
|
|
* @param adding True if adding tiles, false if removing them.
|
|
|
|
|
* @param type StationType being modified.
|
|
|
|
|
*/
|
|
|
|
|
void Station::AfterStationTileSetChange(bool adding, StationType type)
|
|
|
|
|
{
|
|
|
|
|
this->UpdateVirtCoord();
|
|
|
|
|
this->RecomputeIndustriesNear();
|
|
|
|
|
DirtyCompanyInfrastructureWindows(this->owner);
|
|
|
|
|
if (adding) InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case STATION_RAIL:
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_TRAINS);
|
|
|
|
|
break;
|
|
|
|
|
case STATION_AIRPORT:
|
|
|
|
|
break;
|
|
|
|
|
case STATION_TRUCK:
|
|
|
|
|
case STATION_BUS:
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_ROADVEHS);
|
|
|
|
|
break;
|
|
|
|
|
case STATION_DOCK:
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_SHIPS);
|
|
|
|
|
break;
|
|
|
|
|
default: NOT_REACHED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (adding) {
|
|
|
|
|
UpdateStationAcceptance(this, false);
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
DeleteStationIfEmpty(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1494,14 +1531,8 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
st->MarkTilesDirty(false);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
st->AfterStationTileSetChange(true, STATION_RAIL);
|
|
|
|
|
ZoningMarkDirtyStationCoverageArea(st);
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
|
|
|
|
DirtyCompanyInfrastructureWindows(st->owner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cost;
|
|
|
|
@ -1965,7 +1996,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
|
MakeRoadStop(cur_tile, st->owner, st->index, rs_type, rts, ddir);
|
|
|
|
|
}
|
|
|
|
|
Company::Get(st->owner)->infrastructure.station++;
|
|
|
|
|
DirtyCompanyInfrastructureWindows(st->owner);
|
|
|
|
|
|
|
|
|
|
MarkTileDirtyByTile(cur_tile);
|
|
|
|
|
}
|
|
|
|
@ -1973,12 +2003,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (st != NULL) {
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ROADVEHS);
|
|
|
|
|
st->AfterStationTileSetChange(true, type ? STATION_TRUCK: STATION_BUS);
|
|
|
|
|
}
|
|
|
|
|
return cost;
|
|
|
|
|
}
|
|
|
|
@ -2074,7 +2099,6 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
DoClearSquare(tile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ROADVEHS);
|
|
|
|
|
delete cur_stop;
|
|
|
|
|
|
|
|
|
|
/* Make sure no vehicle is going to the old roadstop */
|
|
|
|
@ -2088,9 +2112,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
|
|
|
|
|
st->rect.AfterRemoveTile(st, tile);
|
|
|
|
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
st->AfterStationTileSetChange(false, is_truck ? STATION_TRUCK: STATION_BUS);
|
|
|
|
|
|
|
|
|
|
/* Update the tile area of the truck/bus stop */
|
|
|
|
|
if (is_truck) {
|
|
|
|
@ -2492,15 +2514,10 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|
|
|
|
UpdateStationSignCoord(st);
|
|
|
|
|
} else {
|
|
|
|
|
Company::Get(st->owner)->infrastructure.airport++;
|
|
|
|
|
DirtyCompanyInfrastructureWindows(st->owner);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
st->AfterStationTileSetChange(true, STATION_AIRPORT);
|
|
|
|
|
ZoningMarkDirtyStationCoverageArea(st);
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
|
|
InvalidateWindowData(WC_STATION_VIEW, st->index, -1);
|
|
|
|
|
|
|
|
|
|
if (_settings_game.economy.station_noise_level) {
|
|
|
|
@ -2567,11 +2584,9 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Company::Get(st->owner)->infrastructure.airport--;
|
|
|
|
|
DirtyCompanyInfrastructureWindows(st->owner);
|
|
|
|
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
st->AfterStationTileSetChange(false, STATION_AIRPORT);
|
|
|
|
|
|
|
|
|
|
DeleteNewGRFInspectWindow(GSF_AIRPORTS, st->index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2723,17 +2738,11 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|
|
|
|
Company::Get(st->owner)->infrastructure.water++;
|
|
|
|
|
}
|
|
|
|
|
Company::Get(st->owner)->infrastructure.station += 2;
|
|
|
|
|
DirtyCompanyInfrastructureWindows(st->owner);
|
|
|
|
|
|
|
|
|
|
MakeDock(slope_tile, st->owner, st->index, direction, wc);
|
|
|
|
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
st->AfterStationTileSetChange(true, STATION_DOCK);
|
|
|
|
|
ZoningMarkDirtyStationCoverageArea(st);
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
|
|
|
|
@ -2797,12 +2806,8 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Company::Get(st->owner)->infrastructure.station -= 2;
|
|
|
|
|
DirtyCompanyInfrastructureWindows(st->owner);
|
|
|
|
|
|
|
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
st->AfterStationTileSetChange(false, STATION_DOCK);
|
|
|
|
|
|
|
|
|
|
/* All ships that were going to our station, can't go to it anymore.
|
|
|
|
|
* Just clear the order, then automatically the next appropriate order
|
|
|
|
|