Changeset - r10590:fc4be0b206f9
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2009-01-05 21:06:38
rubidium@openttd.org
(svn r14853) -Codechange: rename GetClosestStationFromTile to GetClosestDeletedStation as that's what it does instead of finding non-deleted stations.
1 file changed with 13 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -364,7 +364,12 @@ static StringID GenerateStationName(Stat
 
}
 
#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(Tile
 
	}
 

	
 
	/* 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 t
 
		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 ti
 
		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,
 
		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) {
0 comments (0 inline, 0 general)