2005-07-24 15:12:37 +01:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 16:11:33 +01:00
|
|
|
/** @file waypoint.h Base of waypoints. */
|
2007-04-06 05:10:19 +01:00
|
|
|
|
2005-03-24 17:03:37 +00:00
|
|
|
#ifndef WAYPOINT_H
|
|
|
|
#define WAYPOINT_H
|
|
|
|
|
2008-03-28 16:41:12 +00:00
|
|
|
#include "waypoint_type.h"
|
2006-03-17 07:02:34 +00:00
|
|
|
#include "rail_map.h"
|
2008-01-09 21:27:39 +00:00
|
|
|
#include "command_type.h"
|
2009-07-16 21:29:08 +01:00
|
|
|
#include "station_base.h"
|
2008-04-17 20:10:30 +01:00
|
|
|
#include "town_type.h"
|
2008-05-07 14:18:33 +01:00
|
|
|
#include "viewport_type.h"
|
2009-01-04 15:32:25 +00:00
|
|
|
#include "date_type.h"
|
2009-05-22 16:39:22 +01:00
|
|
|
#include "core/pool_type.hpp"
|
2005-03-24 17:03:37 +00:00
|
|
|
|
2009-05-22 16:13:50 +01:00
|
|
|
typedef Pool<Waypoint, WaypointID, 32, 64000> WaypointPool;
|
|
|
|
extern WaypointPool _waypoint_pool;
|
2007-08-02 13:22:40 +01:00
|
|
|
|
2009-07-17 22:06:06 +01:00
|
|
|
struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, BaseStation {
|
2008-02-16 16:40:47 +00:00
|
|
|
uint16 town_cn; ///< The Nth waypoint for this town (consecutive number)
|
2005-03-24 17:03:37 +00:00
|
|
|
|
2009-07-17 22:06:06 +01:00
|
|
|
Waypoint(TileIndex tile = INVALID_TILE) : BaseStation(tile) { }
|
2007-08-02 13:22:40 +01:00
|
|
|
~Waypoint();
|
2009-07-13 23:33:25 +01:00
|
|
|
|
|
|
|
void UpdateVirtCoord();
|
2009-07-17 21:21:24 +01:00
|
|
|
|
2009-07-17 22:06:06 +01: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 21:21:24 +01:00
|
|
|
void AssignStationSpec(uint index);
|
2009-07-17 21:51:24 +01: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 13:22:40 +01:00
|
|
|
};
|
2006-08-22 16:33:35 +01:00
|
|
|
|
2009-05-22 15:23:36 +01: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 17:03:37 +00:00
|
|
|
|
2009-02-09 21:20:05 +00:00
|
|
|
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
|
2008-08-20 02:29:05 +01:00
|
|
|
void ShowWaypointWindow(const Waypoint *wp);
|
2007-07-24 18:01:23 +01:00
|
|
|
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
|
2005-03-24 17:03:37 +00:00
|
|
|
|
|
|
|
#endif /* WAYPOINT_H */
|