2005-07-24 15:12:37 +01:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 21:21:05 +01:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 16:11:33 +01:00
|
|
|
/** @file waypoint.cpp Handling of waypoints. */
|
2007-04-06 05:10:19 +01:00
|
|
|
|
2005-03-24 17:03:37 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
2009-07-22 11:18:19 +01:00
|
|
|
#include "order_func.h"
|
2007-12-25 11:26:07 +00:00
|
|
|
#include "window_func.h"
|
2008-03-31 07:42:26 +01:00
|
|
|
#include "newgrf_station.h"
|
2009-07-22 11:18:19 +01:00
|
|
|
#include "waypoint_base.h"
|
2005-03-24 17:03:37 +00:00
|
|
|
|
2007-04-06 05:10:19 +01:00
|
|
|
/**
|
|
|
|
* Draw a waypoint
|
|
|
|
* @param x coordinate
|
|
|
|
* @param y coordinate
|
|
|
|
* @param stat_id station id
|
|
|
|
* @param railtype RailType to use for
|
|
|
|
*/
|
2005-10-16 10:13:04 +01:00
|
|
|
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
|
2005-03-24 17:03:37 +00:00
|
|
|
{
|
2006-05-06 21:48:40 +01:00
|
|
|
if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
|
2009-07-18 11:01:31 +01:00
|
|
|
StationPickerDrawSprite(x, y, STATION_WAYPOINT, railtype, INVALID_ROADTYPE, AXIS_X);
|
2005-03-24 17:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-21 12:11:05 +01:00
|
|
|
void Waypoint::GetTileArea(TileArea *ta, StationType type) const
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case STATION_BUOY:
|
|
|
|
case STATION_WAYPOINT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: NOT_REACHED();
|
|
|
|
}
|
|
|
|
|
|
|
|
ta->tile = this->xy;
|
|
|
|
ta->w = 1;
|
|
|
|
ta->h = 1;
|
|
|
|
}
|
|
|
|
|
2007-08-02 13:22:40 +01:00
|
|
|
Waypoint::~Waypoint()
|
|
|
|
{
|
2007-08-05 22:20:55 +01:00
|
|
|
if (CleaningPool()) return;
|
2008-08-21 03:19:31 +01:00
|
|
|
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
|
2007-08-02 13:22:40 +01:00
|
|
|
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
|
|
|
|
|
2009-07-08 09:30:35 +01:00
|
|
|
this->sign.MarkDirty();
|
2007-08-02 13:22:40 +01:00
|
|
|
}
|