# waypoint.cpp

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #include "stdafx.h"
    00013
    00014 #include "order_func.h"
    00015 #include "window_func.h"
    00016 #include "newgrf_station.h"
    00017 #include "waypoint_base.h"
    00018
    00026 void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
    00027 {
    00028   if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
    00029     StationPickerDrawSprite(x, y, STATION_WAYPOINT, railtype, INVALID_ROADTYPE, AXIS_X);
    00030   }
    00031 }
    00032
    00033 void Waypoint::GetTileArea(TileArea *ta, StationType type) const
    00034 {
    00035   switch (type) {
    00036     case STATION_WAYPOINT:
    00037       *ta = this->train_station;
    00038       return;
    00039
    00040     case STATION_BUOY:
    00041       ta->tile = this->xy;
    00042       ta->w    = 1;
    00043       ta->h    = 1;
    00044       break;
    00045
    00046     default: NOT_REACHED();
    00047   }
    00048 }
    00049
    00050 Waypoint::~Waypoint()
    00051 {
    00052   if (CleaningPool()) return;
    00053   DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
    00054   RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
    00055 }