mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r21486) -Codechange: use TILE_AREA_LOOP for station expansion checks as well
This commit is contained in:
parent
1123d4790f
commit
b5b8a7b5ed
|
@ -84,8 +84,12 @@ bool IsHangar(TileIndex t)
|
||||||
template <class T>
|
template <class T>
|
||||||
CommandCost GetStationAround(TileArea ta, StationID closest_station, T **st)
|
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 */
|
/* 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)) {
|
if (IsTileType(tile_cur, MP_STATION)) {
|
||||||
StationID t = GetStationIndex(tile_cur);
|
StationID t = GetStationIndex(tile_cur);
|
||||||
|
|
||||||
|
@ -940,7 +944,7 @@ CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis a
|
||||||
} else {
|
} else {
|
||||||
/* do not allow modifying non-uniform stations,
|
/* do not allow modifying non-uniform stations,
|
||||||
* the uniform-stations code wouldn't handle it well */
|
* 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
|
if (!st->TileBelongsToRailStation(t)) { // there may be adjoined station
|
||||||
return_cmd_error(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED);
|
return_cmd_error(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue