2005-07-24 16:12:37 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 17:11:33 +02:00
|
|
|
/** @file waypoint.h Base of waypoints. */
|
2007-04-06 06:10:19 +02:00
|
|
|
|
2005-03-24 18:03:37 +01:00
|
|
|
#ifndef WAYPOINT_H
|
|
|
|
#define WAYPOINT_H
|
|
|
|
|
2008-03-28 17:41:12 +01:00
|
|
|
#include "waypoint_type.h"
|
2006-03-17 08:02:34 +01:00
|
|
|
#include "rail_map.h"
|
2008-01-09 22:27:39 +01:00
|
|
|
#include "command_type.h"
|
2009-07-16 22:29:08 +02:00
|
|
|
#include "station_base.h"
|
2008-04-17 21:10:30 +02:00
|
|
|
#include "town_type.h"
|
2008-05-07 15:18:33 +02:00
|
|
|
#include "viewport_type.h"
|
2009-01-04 16:32:25 +01:00
|
|
|
#include "date_type.h"
|
2009-05-22 17:39:22 +02:00
|
|
|
#include "core/pool_type.hpp"
|
2005-03-24 18:03:37 +01:00
|
|
|
|
2009-05-22 17:13:50 +02:00
|
|
|
typedef Pool<Waypoint, WaypointID, 32, 64000> WaypointPool;
|
|
|
|
extern WaypointPool _waypoint_pool;
|
2007-08-02 14:22:40 +02:00
|
|
|
|
2009-07-18 20:39:17 +02:00
|
|
|
struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, SpecializedStation<Waypoint, true> {
|
2008-02-16 17:40:47 +01:00
|
|
|
uint16 town_cn; ///< The Nth waypoint for this town (consecutive number)
|
2005-03-24 18:03:37 +01:00
|
|
|
|
2009-07-18 20:39:17 +02:00
|
|
|
Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation<Waypoint, true>(tile) { }
|
2007-08-02 14:22:40 +02:00
|
|
|
~Waypoint();
|
2009-07-14 00:33:25 +02:00
|
|
|
|
|
|
|
void UpdateVirtCoord();
|
2009-07-17 22:21:24 +02:00
|
|
|
|
2009-07-17 23:06:06 +02:00
|
|
|
/* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const
|
|
|
|
{
|
|
|
|
return this->delete_ctr == 0 && this->xy == tile;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const;
|
|
|
|
|
2009-07-17 22:21:24 +02:00
|
|
|
void AssignStationSpec(uint index);
|
2009-07-17 22:51:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch a waypoint by tile
|
|
|
|
* @param tile Tile of waypoint
|
|
|
|
* @return Waypoint
|
|
|
|
*/
|
|
|
|
static FORCEINLINE Waypoint *GetByTile(TileIndex tile)
|
|
|
|
{
|
|
|
|
return Waypoint::Get(GetWaypointIndex(tile));
|
|
|
|
}
|
2007-08-02 14:22:40 +02:00
|
|
|
};
|
2006-08-22 17:33:35 +02:00
|
|
|
|
2009-05-22 16:23:36 +02:00
|
|
|
#define FOR_ALL_WAYPOINTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Waypoint, waypoint_index, var, start)
|
|
|
|
#define FOR_ALL_WAYPOINTS(var) FOR_ALL_WAYPOINTS_FROM(var, 0)
|
2005-03-24 18:03:37 +01:00
|
|
|
|
2009-02-09 22:20:05 +01:00
|
|
|
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
|
2008-08-20 03:29:05 +02:00
|
|
|
void ShowWaypointWindow(const Waypoint *wp);
|
2007-07-24 19:01:23 +02:00
|
|
|
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
|
2005-03-24 18:03:37 +01:00
|
|
|
|
|
|
|
#endif /* WAYPOINT_H */
|