summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-28 21:06:38 +0000
committerrubidium <rubidium@openttd.org>2009-07-28 21:06:38 +0000
commite473e69ba4d59df7f9cdd9a5010cf54a66fd5b90 (patch)
treea362d0c8540e1ecb4ba9ab1cc8c382106d972ac0
parentffa0c7d29d484094832a85e2e0cdbc2f9a9f2a18 (diff)
downloadopenttd-e473e69ba4d59df7f9cdd9a5010cf54a66fd5b90.tar.xz
(svn r16976) -Codechange: remove WaypointID and MAX_LENGTH constants in favour of their Station variants
-rw-r--r--src/ai/api/ai_waypoint.cpp2
-rw-r--r--src/order_base.h3
-rw-r--r--src/order_cmd.cpp3
-rw-r--r--src/rail_map.h1
-rw-r--r--src/station_type.h1
-rw-r--r--src/vehicle_gui.h1
-rw-r--r--src/waypoint_base.h1
-rw-r--r--src/waypoint_cmd.cpp6
-rw-r--r--src/waypoint_func.h2
-rw-r--r--src/waypoint_gui.cpp2
-rw-r--r--src/waypoint_type.h16
11 files changed, 9 insertions, 29 deletions
diff --git a/src/ai/api/ai_waypoint.cpp b/src/ai/api/ai_waypoint.cpp
index e2a7c3861..d0286c429 100644
--- a/src/ai/api/ai_waypoint.cpp
+++ b/src/ai/api/ai_waypoint.cpp
@@ -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);
}
diff --git a/src/order_base.h b/src/order_base.h
index 4b1aba9b4..1d3753bec 100644
--- a/src/order_base.h
+++ b/src/order_base.h
@@ -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.
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 3d43c5068..06a9ef5ac 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -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;
diff --git a/src/rail_map.h b/src/rail_map.h
index 332ee46fd..957a2a222 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -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 */
diff --git a/src/station_type.h b/src/station_type.h
index 4af075f20..7a5f1c2f7 100644
--- a/src/station_type.h
+++ b/src/station_type.h
@@ -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;
diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h
index b205db17e..20f01808a 100644
--- a/src/vehicle_gui.h
+++ b/src/vehicle_gui.h
@@ -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);
diff --git a/src/waypoint_base.h b/src/waypoint_base.h
index 952503260..ae7ed5f61 100644
--- a/src/waypoint_base.h
+++ b/src/waypoint_base.h
@@ -5,7 +5,6 @@
#ifndef WAYPOINT_H
#define WAYPOINT_H
-#include "waypoint_type.h"
#include "base_station_base.h"
struct Waypoint : SpecializedStation<Waypoint, true> {
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 30f23ac9e..bb18b9c14 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -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);
}
diff --git a/src/waypoint_func.h b/src/waypoint_func.h
index 0709eee49..f55af4429 100644
--- a/src/waypoint_func.h
+++ b/src/waypoint_func.h
@@ -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);
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index 46478505c..03f6fcc46 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -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
diff --git a/src/waypoint_type.h b/src/waypoint_type.h
deleted file mode 100644
index 404ba7c68..000000000
--- a/src/waypoint_type.h
+++ /dev/null
@@ -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 */