MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AfterStationTileSetChange

Method AfterStationTileSetChange

src/station_cmd.cpp:739–776  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

737 * @param type StationType being modified.
738 */
739void Station::AfterStationTileSetChange(bool adding, StationType type)
740{
741 this->UpdateVirtCoord();
742 DirtyCompanyInfrastructureWindows(this->owner);
743
744 if (adding) {
745 this->RecomputeCatchment();
746 MarkCatchmentTilesDirty();
747 InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
748 } else {
749 MarkCatchmentTilesDirty();
750 }
751
752 switch (type) {
753 case StationType::Rail:
754 SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_TRAINS);
755 break;
756 case StationType::Airport:
757 break;
758 case StationType::Truck:
759 case StationType::Bus:
760 SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_ROADVEHS);
761 break;
762 case StationType::Dock:
763 SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_SHIPS);
764 break;
765 default: NOT_REACHED();
766 }
767
768 if (adding) {
769 UpdateStationAcceptance(this, false);
770 InvalidateWindowData(WC_SELECT_STATION, 0, 0);
771 } else {
772 DeleteStationIfEmpty(this);
773 this->RecomputeCatchment();
774 }
775
776}
777
778CommandCost ClearTile_Station(TileIndex tile, DoCommandFlags flags);
779

Callers 7

CmdBuildRailStationFunction · 0.80
CmdBuildRoadStopFunction · 0.80
RemoveRoadStopFunction · 0.80
CmdBuildAirportFunction · 0.80
RemoveAirportFunction · 0.80
CmdBuildDockFunction · 0.80
RemoveDockFunction · 0.80

Calls 9

UpdateVirtCoordMethod · 0.95
RecomputeCatchmentMethod · 0.95
MarkCatchmentTilesDirtyFunction · 0.85
SetWindowWidgetDirtyFunction · 0.85
NOT_REACHEDFunction · 0.85
UpdateStationAcceptanceFunction · 0.85
DeleteStationIfEmptyFunction · 0.85
InvalidateWindowDataFunction · 0.70

Tested by

no test coverage detected