summaryrefslogtreecommitdiff
path: root/src/waypoint_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-31 16:28:28 +0000
committerrubidium <rubidium@openttd.org>2009-07-31 16:28:28 +0000
commita148a991bbc9325bebac7a3871f44f150a9b7b62 (patch)
treeefb7c0a1e22fe013521add2d9ba0852384c74f76 /src/waypoint_cmd.cpp
parent097e79a86de967c416d71d934a325d883d917fd5 (diff)
downloadopenttd-a148a991bbc9325bebac7a3871f44f150a9b7b62.tar.xz
(svn r17002) -Change: also support distant join for waypoints
Diffstat (limited to 'src/waypoint_cmd.cpp')
-rw-r--r--src/waypoint_cmd.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index cdebcf3f8..1b23e6784 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -225,8 +225,11 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
if ((axis == AXIS_X ? width : height) != 1) return CMD_ERROR;
if (count == 0 || count > _settings_game.station.station_spread) return CMD_ERROR;
- /* Temporary */
- if (station_to_join != INVALID_STATION) return CMD_ERROR;
+ bool reuse = (station_to_join != NEW_STATION);
+ if (!reuse) station_to_join = INVALID_STATION;
+ bool distant_join = (station_to_join != INVALID_STATION);
+
+ if (distant_join && (!_settings_game.station.distant_join_stations || !Waypoint::IsValidID(station_to_join))) return CMD_ERROR;
/* Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station) */
StationID est = INVALID_STATION;
@@ -246,7 +249,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
/* Check if there is an already existing, deleted, waypoint close to us that we can reuse. */
TileIndex center_tile = start_tile + (count / 2) * offset;
- if (wp == NULL) wp = FindDeletedWaypointCloseTo(center_tile, STR_SV_STNAME_WAYPOINT);
+ if (wp == NULL && reuse) wp = FindDeletedWaypointCloseTo(center_tile, STR_SV_STNAME_WAYPOINT);
if (wp != NULL) {
/* Reuse an existing station. */