Mercurial > hg > openttd
comparison src/station_cmd.cpp @ 6720:8fa32d4cf5ab draft
(svn r9952) -Fix r9951: it was not possible to build a drive-through station over a road/tram
author | glx <glx@openttd.org> |
---|---|
date | Sun, 27 May 2007 01:59:07 +0000 |
parents | e745bb9e9727 |
children | 84f67d7e1b86 |
comparison
equal
deleted
inserted
replaced
6719:e745bb9e9727 | 6720:8fa32d4cf5ab |
---|---|
613 | 613 |
614 static int32 ClearTile_Station(TileIndex tile, byte flags); | 614 static int32 ClearTile_Station(TileIndex tile, byte flags); |
615 | 615 |
616 // Tries to clear the given area. Returns the cost in case of success. | 616 // Tries to clear the given area. Returns the cost in case of success. |
617 // Or an error code if it failed. | 617 // Or an error code if it failed. |
618 int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID* station) | 618 int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID* station, bool check_clear = true) |
619 { | 619 { |
620 int32 cost = 0; | 620 int32 cost = 0; |
621 int allowed_z = -1; | 621 int allowed_z = -1; |
622 | 622 |
623 BEGIN_TILE_LOOP(tile_cur, w, h, tile) { | 623 BEGIN_TILE_LOOP(tile_cur, w, h, tile) { |
676 *station = st; | 676 *station = st; |
677 } else if (*station != st) { | 677 } else if (*station != st) { |
678 return_cmd_error(STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING); | 678 return_cmd_error(STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING); |
679 } | 679 } |
680 } | 680 } |
681 } else { | 681 } else if (check_clear) { |
682 int32 ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); | 682 int32 ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
683 if (CmdFailed(ret)) return ret; | 683 if (CmdFailed(ret)) return ret; |
684 cost += ret; | 684 cost += ret; |
685 } | 685 } |
686 } END_TILE_LOOP(tile_cur, w, h, tile) | 686 } END_TILE_LOOP(tile_cur, w, h, tile) |
1278 if (HASBIT(cur_rts, ROADTYPE_TRAM) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_TRAM))) return CMD_ERROR; | 1278 if (HASBIT(cur_rts, ROADTYPE_TRAM) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_TRAM))) return CMD_ERROR; |
1279 | 1279 |
1280 /* Do not remove roadtypes! */ | 1280 /* Do not remove roadtypes! */ |
1281 rts |= cur_rts; | 1281 rts |= cur_rts; |
1282 } | 1282 } |
1283 cost = CheckFlatLandBelow(tile, 1, 1, flags, is_drive_through ? 5 << p1 : 1 << p1, NULL); | 1283 cost = CheckFlatLandBelow(tile, 1, 1, flags, is_drive_through ? 5 << p1 : 1 << p1, NULL, !build_over_road); |
1284 if (CmdFailed(cost)) return cost; | 1284 if (CmdFailed(cost)) return cost; |
1285 | 1285 |
1286 Station *st = NULL; | 1286 Station *st = NULL; |
1287 | 1287 |
1288 if (!_patches.adjacent_stations || !HASBIT(p2, 5)) { | 1288 if (!_patches.adjacent_stations || !HASBIT(p2, 5)) { |