Make it possible to stop road vehicles from slowing down in curves so "diagonal"...
[openttd-joker.git] / src / waypoint.cpp
blob3e5f02f3c7d0a5dba106eb3bfe2862e4c7c30b63
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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 */
10 /** @file waypoint.cpp Handling of waypoints. */
12 #include "stdafx.h"
14 #include "order_func.h"
15 #include "window_func.h"
16 #include "newgrf_station.h"
17 #include "waypoint_base.h"
18 #include "tracerestrict.h"
20 #include "safeguards.h"
22 /**
23 * Draw a waypoint
24 * @param x coordinate
25 * @param y coordinate
26 * @param stat_id station id
27 * @param railtype RailType to use for
29 void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
31 if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
32 StationPickerDrawSprite(x, y, STATION_WAYPOINT, railtype, INVALID_ROADTYPE, AXIS_X);
36 void Waypoint::GetTileArea(TileArea *ta, StationType type) const
38 switch (type) {
39 case STATION_WAYPOINT:
40 *ta = this->train_station;
41 return;
43 case STATION_BUOY:
44 ta->tile = this->xy;
45 ta->w = 1;
46 ta->h = 1;
47 break;
49 default: NOT_REACHED();
53 Waypoint::~Waypoint()
55 if (CleaningPool()) return;
56 DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
57 RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
58 TraceRestrictRemoveDestinationID(TROCAF_WAYPOINT, this->index);