(svn r16976) -Codechange: remove WaypointID and MAX_LENGTH constants in favour of their Station variants

This commit is contained in:
rubidium 2009-07-28 21:06:38 +00:00
parent ffa0c7d29d
commit e473e69ba4
11 changed files with 9 additions and 29 deletions

View File

@ -41,7 +41,7 @@
{
EnforcePrecondition(false, IsValidWaypoint(waypoint_id));
EnforcePrecondition(false, !::StrEmpty(name));
EnforcePreconditionCustomError(false, ::strlen(name) < MAX_LENGTH_WAYPOINT_NAME_BYTES, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
EnforcePreconditionCustomError(false, ::strlen(name) < MAX_LENGTH_STATION_NAME_BYTES, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
return AIObject::DoCommand(0, waypoint_id, 0, CMD_RENAME_WAYPOINT, name);
}

View File

@ -12,7 +12,6 @@
#include "depot_type.h"
#include "station_type.h"
#include "vehicle_type.h"
#include "waypoint_type.h"
typedef Pool<Order, OrderID, 256, 64000> OrderPool;
typedef Pool<OrderList, OrderListID, 128, 64000> OrderListPool;
@ -92,7 +91,7 @@ public:
* Makes this order a Go To Waypoint order.
* @param destination the waypoint to go to.
*/
void MakeGoToWaypoint(WaypointID destination);
void MakeGoToWaypoint(StationID destination);
/**
* Makes this order a Loading order.

View File

@ -32,7 +32,6 @@
* be any of them
*/
assert_compile(sizeof(DestinationID) >= sizeof(DepotID));
assert_compile(sizeof(DestinationID) >= sizeof(WaypointID));
assert_compile(sizeof(DestinationID) >= sizeof(StationID));
TileIndex _backup_orders_tile;
@ -68,7 +67,7 @@ void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderN
this->SetRefit(cargo, subtype);
}
void Order::MakeGoToWaypoint(WaypointID destination)
void Order::MakeGoToWaypoint(StationID destination)
{
this->type = OT_GOTO_WAYPOINT;
this->flags = 0;

View File

@ -11,7 +11,6 @@
#include "track_func.h"
#include "tile_map.h"
#include "signal_type.h"
#include "waypoint_type.h"
/** Different types of Rail-related tiles */

View File

@ -15,6 +15,7 @@ struct BaseStation;
struct Station;
struct RoadStop;
struct StationSpec;
struct Waypoint;
static const StationID NEW_STATION = 0xFFFE;
static const StationID INVALID_STATION = 0xFFFF;

View File

@ -10,7 +10,6 @@
#include "order_type.h"
#include "station_type.h"
#include "engine_type.h"
#include "waypoint_type.h"
#include "tile_type.h"
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);

View File

@ -5,7 +5,6 @@
#ifndef WAYPOINT_H
#define WAYPOINT_H
#include "waypoint_type.h"
#include "base_station_base.h"
struct Waypoint : SpecializedStation<Waypoint, true> {

View File

@ -44,7 +44,7 @@ void MakeDefaultWaypointName(Waypoint *wp)
{
uint32 used = 0; // bitmap of used waypoint numbers, sliding window with 'next' as base
uint32 next = 0; // first waypoint number in the bitmap
WaypointID idx = 0; // index where we will stop
StationID idx = 0; // index where we will stop
wp->town = ClosestTownFromTile(wp->xy, UINT_MAX);
@ -58,7 +58,7 @@ void MakeDefaultWaypointName(Waypoint *wp)
* If it wasn't using 'used' and 'idx', it would just search for increasing 'next',
* but this way it is faster */
WaypointID cid = 0; // current index, goes to Waypoint::GetPoolSize()-1, then wraps to 0
StationID cid = 0; // current index, goes to Waypoint::GetPoolSize()-1, then wraps to 0
do {
Waypoint *lwp = Waypoint::GetIfValid(cid);
@ -386,7 +386,7 @@ CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
bool reset = StrEmpty(text);
if (!reset) {
if (strlen(text) >= MAX_LENGTH_WAYPOINT_NAME_BYTES) return CMD_ERROR;
if (strlen(text) >= MAX_LENGTH_STATION_NAME_BYTES) return CMD_ERROR;
if (!IsUniqueWaypointName(text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
}

View File

@ -7,7 +7,7 @@
#include "rail_type.h"
#include "command_type.h"
#include "waypoint_type.h"
#include "station_type.h"
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags);

View File

@ -82,7 +82,7 @@ public:
case WAYPVW_RENAME: // rename
SetDParam(0, this->wp->index);
ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_WAYPOINT_NAME_BYTES, MAX_LENGTH_WAYPOINT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_STATION_NAME_BYTES, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
break;
case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders

View File

@ -1,16 +0,0 @@
/* $Id$ */
/** @file waypoint_type.h Types related to waypoints. */
#ifndef WAYPOINT_TYPE_H
#define WAYPOINT_TYPE_H
typedef uint16 WaypointID;
struct Waypoint;
enum {
MAX_LENGTH_WAYPOINT_NAME_BYTES = 31, ///< The maximum length of a waypoint name in bytes including '\0'
MAX_LENGTH_WAYPOINT_NAME_PIXELS = 180, ///< The maximum length of a waypoint name in pixels
};
#endif /* WAYPOINT_TYPE_H */