2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file waypoint.cpp Handling of waypoints. */
12 #include "order_func.h"
13 #include "window_func.h"
14 #include "newgrf_station.h"
15 #include "waypoint_base.h"
16 #include "viewport_kdtree.h"
18 #include "safeguards.h"
24 * @param station_class Station class.
25 * @param station_type Station type within class.
26 * @param railtype RailType to use for
28 void DrawWaypointSprite(int x
, int y
, StationClassID station_class
, uint16_t station_type
, RailType railtype
)
30 if (!DrawStationTile(x
, y
, railtype
, AXIS_X
, station_class
, station_type
)) {
31 StationPickerDrawSprite(x
, y
, STATION_WAYPOINT
, railtype
, INVALID_ROADTYPE
, AXIS_X
);
35 void Waypoint::GetTileArea(TileArea
*ta
, StationType type
) const
38 case STATION_WAYPOINT
:
39 *ta
= this->train_station
;
42 case STATION_ROADWAYPOINT
:
43 *ta
= this->road_waypoint_area
;
52 default: NOT_REACHED();
58 if (CleaningPool()) return;
59 CloseWindowById(WC_WAYPOINT_VIEW
, this->index
);
60 RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT
, this->index
);
61 if (this->sign
.kdtree_valid
) _viewport_sign_kdtree
.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index
));