Add: allow making heightmap screenshot via console
[openttd-github.git] / src / waypoint.cpp
blobf602eee6d0590b71a8bf134ae20a59a76383cba7
1 /*
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/>.
6 */
8 /** @file waypoint.cpp Handling of waypoints. */
10 #include "stdafx.h"
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"
20 /**
21 * Draw a waypoint
22 * @param x coordinate
23 * @param y coordinate
24 * @param stat_id station id
25 * @param railtype RailType to use for
27 void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
29 if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
30 StationPickerDrawSprite(x, y, STATION_WAYPOINT, railtype, INVALID_ROADTYPE, AXIS_X);
34 void Waypoint::GetTileArea(TileArea *ta, StationType type) const
36 switch (type) {
37 case STATION_WAYPOINT:
38 *ta = this->train_station;
39 return;
41 case STATION_BUOY:
42 ta->tile = this->xy;
43 ta->w = 1;
44 ta->h = 1;
45 break;
47 default: NOT_REACHED();
51 Waypoint::~Waypoint()
53 if (CleaningPool()) return;
54 DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
55 RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
56 if (this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));