summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-05 21:06:38 +0000
committerrubidium <rubidium@openttd.org>2009-01-05 21:06:38 +0000
commit9f7cab0e0ec2b1db345a18c78c4d15a2791a9fc2 (patch)
treeb480e2990c46b0345e9ffd38ef5bd07332a3d7a4 /src
parentb201fb1226d681c344a21bd67bb77e221394d98e (diff)
downloadopenttd-9f7cab0e0ec2b1db345a18c78c4d15a2791a9fc2.tar.xz
(svn r14853) -Codechange: rename GetClosestStationFromTile to GetClosestDeletedStation as that's what it does instead of finding non-deleted stations.
Diffstat (limited to 'src')
-rw-r--r--src/station_cmd.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 7abdd0d2d..076000a2a 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -364,7 +364,12 @@ static StringID GenerateStationName(Station *st, TileIndex tile, int flag)
}
#undef M
-static Station *GetClosestStationFromTile(TileIndex tile)
+/**
+ * Find the closest deleted station of the current company
+ * @param tile the tile to search from.
+ * @return the closest station or NULL if too far.
+ */
+static Station *GetClosestDeletedStation(TileIndex tile)
{
uint threshold = 8;
Station *best_station = NULL;
@@ -978,7 +983,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
}
/* See if there is a deleted station close to us. */
- if (st == NULL) st = GetClosestStationFromTile(tile_org);
+ if (st == NULL) st = GetClosestDeletedStation(tile_org);
if (st != NULL) {
/* Reuse an existing station. */
@@ -1457,8 +1462,8 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
}
- /* Find a station close to us */
- if (st == NULL) st = GetClosestStationFromTile(tile);
+ /* Find a deleted station close to us */
+ if (st == NULL) st = GetClosestDeletedStation(tile);
/* give us a road stop in the list, and check if something went wrong */
if (!RoadStop::CanAllocateItem()) return_cmd_error(type ? STR_TOO_MANY_TRUCK_STOPS : STR_TOO_MANY_BUS_STOPS);
@@ -1870,8 +1875,8 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
st = NULL;
}
- /* Find a station close to us */
- if (st == NULL) st = GetClosestStationFromTile(tile);
+ /* Find a deleted station close to us */
+ if (st == NULL) st = GetClosestDeletedStation(tile);
if (st != NULL) {
if (st->owner != _current_company) {
@@ -2165,8 +2170,8 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
}
- /* Find a station close to us */
- if (st == NULL) st = GetClosestStationFromTile(tile);
+ /* Find a deleted station close to us */
+ if (st == NULL) st = GetClosestDeletedStation(tile);
if (st != NULL) {
if (st->owner != _current_company) {