summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
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
commit9877b71ee0784dc1484a774a04767a3524288875 (patch)
treeb480e2990c46b0345e9ffd38ef5bd07332a3d7a4 /src/station_cmd.cpp
parent13f06c812def363ef6679e2020187bb3946fdb55 (diff)
downloadopenttd-9877b71ee0784dc1484a774a04767a3524288875.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/station_cmd.cpp')
-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) {