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

Method GetCenterTile

src/waypoint_gui.cpp:44–66  ·  view source on GitHub ↗

* Get the center tile of the waypoint. * @return The center tile if the waypoint exists, otherwise the tile with the waypoint name. */

Source from the content-addressed store, hash-verified

42 * @return The center tile if the waypoint exists, otherwise the tile with the waypoint name.
43 */
44 TileIndex GetCenterTile() const
45 {
46 if (!this->wp->IsInUse()) return this->wp->xy;
47
48 StationType type;
49 switch (this->vt) {
50 case VEH_TRAIN:
51 type = StationType::RailWaypoint;
52 break;
53
54 case VEH_ROAD:
55 type = StationType::RoadWaypoint;
56 break;
57
58 case VEH_SHIP:
59 type = StationType::Buoy;
60 break;
61
62 default:
63 NOT_REACHED();
64 }
65 return this->wp->GetTileArea(type).GetCenterTile();
66 }
67
68public:
69 /**

Callers 8

WaypointWindowMethod · 0.95
OnClickMethod · 0.95
OnInvalidateDataMethod · 0.95
OnResizeMethod · 0.95
IndustryViewWindowMethod · 0.45
OnClickMethod · 0.45
OnResizeMethod · 0.45
DrawIndustryNamesMethod · 0.45

Calls 3

NOT_REACHEDFunction · 0.85
IsInUseMethod · 0.80
GetTileAreaMethod · 0.45

Tested by

no test coverage detected