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

Method UpdateVirtCoord

src/station_cmd.cpp:432–446  ·  view source on GitHub ↗

* Update the virtual coords needed to draw the station sign. */

Source from the content-addressed store, hash-verified

430 * Update the virtual coords needed to draw the station sign.
431 */
432void Station::UpdateVirtCoord()
433{
434 Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
435
436 pt.y -= 32 * ZOOM_BASE;
437 if (this->facilities.Test(StationFacility::Airport) && this->airport.type == AT_OILRIG) pt.y -= 16 * ZOOM_BASE;
438
439 if (this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeStation(this->index));
440
441 this->sign.UpdatePosition(pt.x, pt.y, GetString(STR_VIEWPORT_STATION, this->index, this->facilities), GetString(STR_STATION_NAME, this->index, this->facilities));
442
443 _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeStation(this->index));
444
445 SetWindowDirty(WC_STATION_VIEW, this->index);
446}
447
448/**
449 * Move the station main coordinate somewhere else.

Callers 7

RemoveRoadWaypointStopFunction · 0.45
CmdRenameStationFunction · 0.45
CmdMoveStationNameFunction · 0.45
BuildOilRigFunction · 0.45

Calls 10

RemapCoords2Function · 0.85
TileXFunction · 0.85
TileYFunction · 0.85
MakeStationFunction · 0.85
SetWindowDirtyFunction · 0.85
TestMethod · 0.80
GetStringFunction · 0.70
RemoveMethod · 0.45
UpdatePositionMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected