summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-12 18:23:38 +0000
committerrubidium <rubidium@openttd.org>2010-12-12 18:23:38 +0000
commitb5b8a7b5edf8694b6b00759e52830913b2c3f709 (patch)
tree904af9da045b6c50bc338668879465dfab00b447
parent1123d4790fc2098951b68faa77a72d6b13a39203 (diff)
downloadopenttd-b5b8a7b5edf8694b6b00759e52830913b2c3f709.tar.xz
(svn r21486) -Codechange: use TILE_AREA_LOOP for station expansion checks as well
-rw-r--r--src/station_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index bea52f977..fc6faffe8 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -84,8 +84,12 @@ bool IsHangar(TileIndex t)
template <class T>
CommandCost GetStationAround(TileArea ta, StationID closest_station, T **st)
{
+ ta.tile -= TileDiffXY(1, 1);
+ ta.w += 2;
+ ta.h += 2;
+
/* check around to see if there's any stations there */
- TILE_LOOP(tile_cur, ta.w + 2, ta.h + 2, ta.tile - TileDiffXY(1, 1)) {
+ TILE_AREA_LOOP(tile_cur, ta) {
if (IsTileType(tile_cur, MP_STATION)) {
StationID t = GetStationIndex(tile_cur);
@@ -940,7 +944,7 @@ CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis a
} else {
/* do not allow modifying non-uniform stations,
* the uniform-stations code wouldn't handle it well */
- TILE_LOOP(t, cur_ta.w, cur_ta.h, cur_ta.tile) {
+ TILE_AREA_LOOP(t, cur_ta) {
if (!st->TileBelongsToRailStation(t)) { // there may be adjoined station
return_cmd_error(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED);
}