summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-30 22:06:54 +0000
committerrubidium <rubidium@openttd.org>2009-07-30 22:06:54 +0000
commitc2fdb85c0dce9cfa61045ccee16052f0e31d7078 (patch)
tree24853ee952142af808fb2a00b5c4324ccf934c8c /src/station_cmd.cpp
parent45c9a747db37ef134a4681da8d0a6064e8fbf677 (diff)
downloadopenttd-c2fdb85c0dce9cfa61045ccee16052f0e31d7078.tar.xz
(svn r17000) -Change: allow overbuilding/extending waypoints
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 246c8ab23..ff6d21d25 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -638,7 +638,7 @@ static void DeleteStationIfEmpty(BaseStation *st)
UpdateStationSignCoord(st);
}
-static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
+CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
/** Tries to clear the given area.
* @param tile TileIndex to start check
@@ -727,7 +727,7 @@ CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag fla
* @param axis the axis of the newly build rail
* @return true if we are allowed to extend
*/
-static bool CanExpandRailStation(const Station *st, TileArea &new_ta, Axis axis)
+bool CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis)
{
TileArea cur_ta = st->train_station;
@@ -890,6 +890,20 @@ CommandCost FindJoiningStation(StationID existing_station, StationID station_to_
}
/**
+ * Find a nearby waypoint that joins this waypoint.
+ * @param existing_waypoint an existing waypoint we build over
+ * @param waypoint_to_join the waypoint to join to
+ * @param adjacent whether adjacent waypoints are allowed
+ * @param ta the area of the newly build waypoint
+ * @param st 'return' pointer for the found waypoint
+ * @return command cost with the error or 'okay'
+ */
+CommandCost FindJoiningWaypoint(StationID existing_waypoint, StationID waypoint_to_join, bool adjacent, TileArea ta, Waypoint **wp)
+{
+ return FindJoiningBaseStation<Waypoint, STR_MUST_REMOVE_RAILWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp);
+}
+
+/**
* Build rail station
* @param tile_org northern most position of station dragging/placement
* @param flags operation to perform
@@ -3099,7 +3113,7 @@ static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
return road_owner != OWNER_TOWN || CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, ROADTYPE_ROAD, flags);
}
-static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
+CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
{
if (flags & DC_AUTO) {
switch (GetStationType(tile)) {