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

Function UpdateStationSignCoord

src/station_cmd.cpp:659–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659static void UpdateStationSignCoord(BaseStation *st)
660{
661 const StationRect *r = &st->rect;
662
663 if (r->IsEmpty()) return; // no tiles belong to this station
664
665 /* clamp sign coord to be inside the station rect */
666 TileIndex new_xy = TileXY(ClampU(TileX(st->xy), r->left, r->right), ClampU(TileY(st->xy), r->top, r->bottom));
667 st->MoveSign(new_xy);
668
669 if (!Station::IsExpected(st)) return;
670 Station *full_station = Station::From(st);
671 for (const GoodsEntry &ge : full_station->goods) {
672 LinkGraphID lg = ge.link_graph;
673 if (!LinkGraph::IsValidID(lg)) continue;
674 (*LinkGraph::Get(lg))[ge.node].UpdateLocation(st->xy);
675 }
676}
677
678/**
679 * Common part of building various station parts and possibly attaching them to an existing one.

Callers 3

DeleteStationIfEmptyFunction · 0.85
RemoveRoadWaypointStopFunction · 0.85

Calls 7

TileXYFunction · 0.85
ClampUFunction · 0.85
TileXFunction · 0.85
TileYFunction · 0.85
UpdateLocationMethod · 0.80
IsEmptyMethod · 0.45
MoveSignMethod · 0.45

Tested by

no test coverage detected