610 } |
610 } |
611 /* station remains but it probably lost some parts - station sign should stay in the station boundaries */ |
611 /* station remains but it probably lost some parts - station sign should stay in the station boundaries */ |
612 UpdateStationSignCoord(st); |
612 UpdateStationSignCoord(st); |
613 } |
613 } |
614 |
614 |
615 static int32 ClearTile_Station(TileIndex tile, byte flags); |
615 static CommandCost ClearTile_Station(TileIndex tile, byte flags); |
616 |
616 |
617 // Tries to clear the given area. Returns the cost in case of success. |
617 // Tries to clear the given area. Returns the cost in case of success. |
618 // Or an error code if it failed. |
618 // Or an error code if it failed. |
619 int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID* station, bool check_clear = true) |
619 CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID* station, bool check_clear = true) |
620 { |
620 { |
621 int32 cost = 0; |
621 CommandCost cost = 0; |
622 int allowed_z = -1; |
622 int allowed_z = -1; |
623 |
623 |
624 BEGIN_TILE_LOOP(tile_cur, w, h, tile) { |
624 BEGIN_TILE_LOOP(tile_cur, w, h, tile) { |
625 if (MayHaveBridgeAbove(tile_cur) && IsBridgeAbove(tile_cur)) { |
625 if (MayHaveBridgeAbove(tile_cur) && IsBridgeAbove(tile_cur)) { |
626 return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
626 return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
627 } |
627 } |
628 |
628 |
629 if (!EnsureNoVehicle(tile_cur)) return CMD_ERROR; |
629 if (!EnsureNoVehicleOnGround(tile_cur)) return CMD_ERROR; |
630 |
630 |
631 uint z; |
631 uint z; |
632 Slope tileh = GetTileSlope(tile_cur, &z); |
632 Slope tileh = GetTileSlope(tile_cur, &z); |
633 |
633 |
634 /* Prohibit building if |
634 /* Prohibit building if |
678 } else if (*station != st) { |
678 } else if (*station != st) { |
679 return_cmd_error(STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING); |
679 return_cmd_error(STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING); |
680 } |
680 } |
681 } |
681 } |
682 } else if (check_clear) { |
682 } else if (check_clear) { |
683 int32 ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
683 CommandCost ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
684 if (CmdFailed(ret)) return ret; |
684 if (CmdFailed(ret)) return ret; |
685 cost += ret; |
685 cost += ret; |
686 } |
686 } |
687 } END_TILE_LOOP(tile_cur, w, h, tile) |
687 } END_TILE_LOOP(tile_cur, w, h, tile) |
688 |
688 |
799 * @param p2 various bitstuffed elements |
799 * @param p2 various bitstuffed elements |
800 * - p2 = (bit 0- 3) - railtype (p2 & 0xF) |
800 * - p2 = (bit 0- 3) - railtype (p2 & 0xF) |
801 * - p2 = (bit 8-15) - custom station class |
801 * - p2 = (bit 8-15) - custom station class |
802 * - p2 = (bit 16-23) - custom station id |
802 * - p2 = (bit 16-23) - custom station id |
803 */ |
803 */ |
804 int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint32 p2) |
804 CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint32 p2) |
805 { |
805 { |
806 int w_org, h_org; |
806 int w_org, h_org; |
807 int32 ret; |
807 CommandCost ret; |
808 |
808 |
809 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
809 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
810 |
810 |
811 /* Does the authority allow this? */ |
811 /* Does the authority allow this? */ |
812 if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile_org)) return CMD_ERROR; |
812 if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile_org)) return CMD_ERROR; |
836 StationID est = INVALID_STATION; |
836 StationID est = INVALID_STATION; |
837 // If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug |
837 // If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug |
838 // for detail info, see: https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 |
838 // for detail info, see: https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 |
839 ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _patches.nonuniform_stations ? &est : NULL); |
839 ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _patches.nonuniform_stations ? &est : NULL); |
840 if (CmdFailed(ret)) return ret; |
840 if (CmdFailed(ret)) return ret; |
841 int32 cost = ret + (numtracks * _eco->GetPrice(CEconomy::TRAIN_STATION_TRACK) + _eco->GetPrice(CEconomy::TRAIN_STATION_LENGTH)) * plat_len; |
841 CommandCost cost = ret + (numtracks * _eco->GetPrice(CEconomy::TRAIN_STATION_TRACK) + _eco->GetPrice(CEconomy::TRAIN_STATION_LENGTH)) * plat_len; |
842 |
842 |
843 Station *st = NULL; |
843 Station *st = NULL; |
844 bool check_surrounding = true; |
844 bool check_surrounding = true; |
845 |
845 |
846 if (_patches.adjacent_stations) { |
846 if (_patches.adjacent_stations) { |
1052 * @param tile tile of station piece to remove |
1052 * @param tile tile of station piece to remove |
1053 * @param flags operation to perform |
1053 * @param flags operation to perform |
1054 * @param p1 start_tile |
1054 * @param p1 start_tile |
1055 * @param p2 unused |
1055 * @param p2 unused |
1056 */ |
1056 */ |
1057 int32 CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1057 CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1058 { |
1058 { |
1059 TileIndex start = p1 == 0 ? tile : p1; |
1059 TileIndex start = p1 == 0 ? tile : p1; |
1060 |
1060 |
1061 /* Count of the number of tiles removed */ |
1061 /* Count of the number of tiles removed */ |
1062 int quantity = 0; |
1062 int quantity = 0; |
1123 |
1123 |
1124 return _eco->GetPrice(CEconomy::REMOVE_RAIL_STATION) * quantity; |
1124 return _eco->GetPrice(CEconomy::REMOVE_RAIL_STATION) * quantity; |
1125 } |
1125 } |
1126 |
1126 |
1127 |
1127 |
1128 static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags) |
1128 static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags) |
1129 { |
1129 { |
1130 /* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */ |
1130 /* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */ |
1131 if (_current_player == OWNER_WATER && _patches.nonuniform_stations) |
1131 if (_current_player == OWNER_WATER && _patches.nonuniform_stations) |
1132 return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION); |
1132 return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION); |
1133 |
1133 |
1140 int w = st->trainst_w; |
1140 int w = st->trainst_w; |
1141 int h = st->trainst_h; |
1141 int h = st->trainst_h; |
1142 |
1142 |
1143 assert(w != 0 && h != 0); |
1143 assert(w != 0 && h != 0); |
1144 |
1144 |
1145 int32 cost = 0; |
1145 CommandCost cost = 0; |
1146 /* clear all areas of the station */ |
1146 /* clear all areas of the station */ |
1147 do { |
1147 do { |
1148 int w_bak = w; |
1148 int w_bak = w; |
1149 do { |
1149 do { |
1150 // for nonuniform stations, only remove tiles that are actually train station tiles |
1150 // for nonuniform stations, only remove tiles that are actually train station tiles |
1189 * @param totype The railtype we want to convert to |
1189 * @param totype The railtype we want to convert to |
1190 * @param exec Switches between test and execute mode |
1190 * @param exec Switches between test and execute mode |
1191 * @return The cost and state of the operation |
1191 * @return The cost and state of the operation |
1192 * @retval CMD_ERROR An error occured during the operation. |
1192 * @retval CMD_ERROR An error occured during the operation. |
1193 */ |
1193 */ |
1194 int32 DoConvertStationRail(TileIndex tile, RailType totype, bool exec) |
1194 CommandCost DoConvertStationRail(TileIndex tile, RailType totype, bool exec) |
1195 { |
1195 { |
1196 const Station* st = GetStationByTile(tile); |
1196 const Station* st = GetStationByTile(tile); |
1197 |
1197 |
1198 if (!CheckOwnership(st->owner) || !EnsureNoVehicle(tile)) return CMD_ERROR; |
1198 if (!CheckOwnership(st->owner) || !EnsureNoVehicle(tile)) return CMD_ERROR; |
1199 |
1199 |
1241 * @param p2 bit 0: 0 for Bus stops, 1 for truck stops |
1241 * @param p2 bit 0: 0 for Bus stops, 1 for truck stops |
1242 * bit 1: 0 for normal, 1 for drive-through |
1242 * bit 1: 0 for normal, 1 for drive-through |
1243 * bit 2..4: the roadtypes |
1243 * bit 2..4: the roadtypes |
1244 * bit 5: allow stations directly adjacent to other stations. |
1244 * bit 5: allow stations directly adjacent to other stations. |
1245 */ |
1245 */ |
1246 int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1246 CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1247 { |
1247 { |
1248 bool type = HASBIT(p2, 0); |
1248 bool type = HASBIT(p2, 0); |
1249 bool is_drive_through = HASBIT(p2, 1); |
1249 bool is_drive_through = HASBIT(p2, 1); |
1250 bool build_over_road = is_drive_through && IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL; |
1250 bool build_over_road = is_drive_through && IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL; |
1251 bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN); |
1251 bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN); |
1265 |
1265 |
1266 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1266 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1267 |
1267 |
1268 if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile)) return CMD_ERROR; |
1268 if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile)) return CMD_ERROR; |
1269 |
1269 |
1270 int32 cost = 0; |
1270 CommandCost cost = 0; |
1271 |
1271 |
1272 /* Not allowed to build over this road */ |
1272 /* Not allowed to build over this road */ |
1273 if (build_over_road) { |
1273 if (build_over_road) { |
1274 if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD); |
1274 if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD); |
1275 if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) return CMD_ERROR; |
1275 if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) return CMD_ERROR; |
1423 * @param tile tile to remove the stop from |
1423 * @param tile tile to remove the stop from |
1424 * @param flags operation to perform |
1424 * @param flags operation to perform |
1425 * @param p1 not used |
1425 * @param p1 not used |
1426 * @param p2 bit 0: 0 for Bus stops, 1 for truck stops |
1426 * @param p2 bit 0: 0 for Bus stops, 1 for truck stops |
1427 */ |
1427 */ |
1428 int32 CmdRemoveRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1428 CommandCost CmdRemoveRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1429 { |
1429 { |
1430 /* Make sure the specified tile is a road stop of the correct type */ |
1430 /* Make sure the specified tile is a road stop of the correct type */ |
1431 if (!IsTileType(tile, MP_STATION) || !IsRoadStop(tile) || (uint32)GetRoadStopType(tile) != p2) return CMD_ERROR; |
1431 if (!IsTileType(tile, MP_STATION) || !IsRoadStop(tile) || (uint32)GetRoadStopType(tile) != p2) return CMD_ERROR; |
1432 Station *st = GetStationByTile(tile); |
1432 Station *st = GetStationByTile(tile); |
1433 /* Save the stop info before it is removed */ |
1433 /* Save the stop info before it is removed */ |
1436 RoadBits road_bits = IsDriveThroughStopTile(tile) ? |
1436 RoadBits road_bits = IsDriveThroughStopTile(tile) ? |
1437 ((GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y) : |
1437 ((GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y) : |
1438 DiagDirToRoadBits(GetRoadStopDir(tile)); |
1438 DiagDirToRoadBits(GetRoadStopDir(tile)); |
1439 bool is_towns_road = is_drive_through && GetStopBuiltOnTownRoad(tile); |
1439 bool is_towns_road = is_drive_through && GetStopBuiltOnTownRoad(tile); |
1440 |
1440 |
1441 int32 ret = RemoveRoadStop(st, flags, tile); |
1441 CommandCost ret = RemoveRoadStop(st, flags, tile); |
1442 |
1442 |
1443 /* If the stop was a drive-through stop replace the road */ |
1443 /* If the stop was a drive-through stop replace the road */ |
1444 if ((flags & DC_EXEC) && !CmdFailed(ret) && is_drive_through) { |
1444 if ((flags & DC_EXEC) && CmdSucceeded(ret) && is_drive_through) { |
1445 /* Rebuild the drive throuhg road stop. As a road stop can only be |
1445 /* Rebuild the drive throuhg road stop. As a road stop can only be |
1446 * removed by the owner of the roadstop, _current_player is the |
1446 * removed by the owner of the roadstop, _current_player is the |
1447 * owner of the road stop. */ |
1447 * owner of the road stop. */ |
1448 MakeRoadNormal(tile, road_bits, rts, is_towns_road ? ClosestTownFromTile(tile, (uint)-1)->index : 0, |
1448 MakeRoadNormal(tile, road_bits, rts, is_towns_road ? ClosestTownFromTile(tile, (uint)-1)->index : 0, |
1449 is_towns_road ? OWNER_TOWN : _current_player, _current_player, _current_player); |
1449 is_towns_road ? OWNER_TOWN : _current_player, _current_player, _current_player); |
1548 * @param tile tile where airport will be built |
1548 * @param tile tile where airport will be built |
1549 * @param flags operation to perform |
1549 * @param flags operation to perform |
1550 * @param p1 airport type, @see airport.h |
1550 * @param p1 airport type, @see airport.h |
1551 * @param p2 (bit 0) - allow airports directly adjacent to other airports. |
1551 * @param p2 (bit 0) - allow airports directly adjacent to other airports. |
1552 */ |
1552 */ |
1553 int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1553 CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1554 { |
1554 { |
1555 bool airport_upgrade = true; |
1555 bool airport_upgrade = true; |
1556 |
1556 |
1557 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1557 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1558 |
1558 |
1580 |
1580 |
1581 const AirportFTAClass *afc = GetAirport(p1); |
1581 const AirportFTAClass *afc = GetAirport(p1); |
1582 int w = afc->size_x; |
1582 int w = afc->size_x; |
1583 int h = afc->size_y; |
1583 int h = afc->size_y; |
1584 |
1584 |
1585 int32 ret = CheckFlatLandBelow(tile, w, h, flags, 0, NULL); |
1585 CommandCost ret = CheckFlatLandBelow(tile, w, h, flags, 0, NULL); |
1586 if (CmdFailed(ret)) return ret; |
1586 if (CmdFailed(ret)) return ret; |
1587 int32 cost = ret; |
1587 CommandCost cost = ret; |
1588 |
1588 |
1589 Station *st = NULL; |
1589 Station *st = NULL; |
1590 |
1590 |
1591 if (!_patches.adjacent_stations || !HASBIT(p2, 0)) { |
1591 if (!_patches.adjacent_stations || !HASBIT(p2, 0)) { |
1592 st = GetStationAround(tile, w, h, INVALID_STATION); |
1592 st = GetStationAround(tile, w, h, INVALID_STATION); |
1674 } |
1674 } |
1675 |
1675 |
1676 return cost; |
1676 return cost; |
1677 } |
1677 } |
1678 |
1678 |
1679 static int32 RemoveAirport(Station *st, uint32 flags) |
1679 static CommandCost RemoveAirport(Station *st, uint32 flags) |
1680 { |
1680 { |
1681 if (_current_player != OWNER_WATER && !CheckOwnership(st->owner)) |
1681 if (_current_player != OWNER_WATER && !CheckOwnership(st->owner)) |
1682 return CMD_ERROR; |
1682 return CMD_ERROR; |
1683 |
1683 |
1684 TileIndex tile = st->airport_tile; |
1684 TileIndex tile = st->airport_tile; |
1685 |
1685 |
1686 const AirportFTAClass *afc = st->Airport(); |
1686 const AirportFTAClass *afc = st->Airport(); |
1687 int w = afc->size_x; |
1687 int w = afc->size_x; |
1688 int h = afc->size_y; |
1688 int h = afc->size_y; |
1689 |
1689 |
1690 int32 cost = w * h * _eco->GetPrice(CEconomy::REMOVE_AIRPORT); |
1690 CommandCost cost = w * h * _eco->GetPrice(CEconomy::REMOVE_AIRPORT); |
1691 |
1691 |
1692 Vehicle *v; |
1692 Vehicle *v; |
1693 FOR_ALL_VEHICLES(v) { |
1693 FOR_ALL_VEHICLES(v) { |
1694 if (!(v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) continue; |
1694 if (!(v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) continue; |
1695 |
1695 |
1728 * @param tile tile where to place the bouy |
1728 * @param tile tile where to place the bouy |
1729 * @param flags operation to perform |
1729 * @param flags operation to perform |
1730 * @param p1 unused |
1730 * @param p1 unused |
1731 * @param p2 unused |
1731 * @param p2 unused |
1732 */ |
1732 */ |
1733 int32 CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1733 CommandCost CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1734 { |
1734 { |
1735 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1735 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1736 |
1736 |
1737 if (!IsClearWaterTile(tile) || tile == 0) return_cmd_error(STR_304B_SITE_UNSUITABLE); |
1737 if (!IsClearWaterTile(tile) || tile == 0) return_cmd_error(STR_304B_SITE_UNSUITABLE); |
1738 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
1738 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
1837 * @param tile tile where dock will be built |
1837 * @param tile tile where dock will be built |
1838 * @param flags operation to perform |
1838 * @param flags operation to perform |
1839 * @param p1 (bit 0) - allow docks directly adjacent to other docks. |
1839 * @param p1 (bit 0) - allow docks directly adjacent to other docks. |
1840 * @param p2 unused |
1840 * @param p2 unused |
1841 */ |
1841 */ |
1842 int32 CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1842 CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1843 { |
1843 { |
1844 int32 cost; |
1844 CommandCost cost; |
1845 |
1845 |
1846 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1846 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
1847 |
1847 |
1848 DiagDirection direction; |
1848 DiagDirection direction; |
1849 switch (GetTileSlope(tile, NULL)) { |
1849 switch (GetTileSlope(tile, NULL)) { |
1936 st_auto_delete.Release(); |
1936 st_auto_delete.Release(); |
1937 } |
1937 } |
1938 return _eco->GetPrice(CEconomy::BUILD_DOCK); |
1938 return _eco->GetPrice(CEconomy::BUILD_DOCK); |
1939 } |
1939 } |
1940 |
1940 |
1941 static int32 RemoveDock(Station *st, uint32 flags) |
1941 static CommandCost RemoveDock(Station *st, uint32 flags) |
1942 { |
1942 { |
1943 if (!CheckOwnership(st->owner)) return CMD_ERROR; |
1943 if (!CheckOwnership(st->owner)) return CMD_ERROR; |
1944 |
1944 |
1945 TileIndex tile1 = st->dock_tile; |
1945 TileIndex tile1 = st->dock_tile; |
1946 TileIndex tile2 = tile1 + TileOffsByDiagDir(GetDockDirection(tile1)); |
1946 TileIndex tile2 = tile1 + TileOffsByDiagDir(GetDockDirection(tile1)); |
2492 * @param tile unused |
2492 * @param tile unused |
2493 * @param flags operation to perform |
2493 * @param flags operation to perform |
2494 * @param p1 station ID that is to be renamed |
2494 * @param p1 station ID that is to be renamed |
2495 * @param p2 unused |
2495 * @param p2 unused |
2496 */ |
2496 */ |
2497 int32 CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
2497 CommandCost CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
2498 { |
2498 { |
2499 if (!IsValidStationID(p1) || _cmd_text[0] == '\0') return CMD_ERROR; |
2499 if (!IsValidStationID(p1) || _cmd_text[0] == '\0') return CMD_ERROR; |
2500 Station *st = GetStation(p1); |
2500 Station *st = GetStation(p1); |
2501 |
2501 |
2502 if (!CheckOwnership(st->owner)) return CMD_ERROR; |
2502 if (!CheckOwnership(st->owner)) return CMD_ERROR; |
2746 bool edge_road; |
2746 bool edge_road; |
2747 return CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, &edge_road, ROADTYPE_ROAD) && |
2747 return CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, &edge_road, ROADTYPE_ROAD) && |
2748 CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_TRAM), OWNER_TOWN, &edge_road, ROADTYPE_TRAM); |
2748 CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_TRAM), OWNER_TOWN, &edge_road, ROADTYPE_TRAM); |
2749 } |
2749 } |
2750 |
2750 |
2751 static int32 ClearTile_Station(TileIndex tile, byte flags) |
2751 static CommandCost ClearTile_Station(TileIndex tile, byte flags) |
2752 { |
2752 { |
2753 if (flags & DC_AUTO) { |
2753 if (flags & DC_AUTO) { |
2754 switch (GetStationType(tile)) { |
2754 switch (GetStationType(tile)) { |
2755 case STATION_RAIL: return_cmd_error(STR_300B_MUST_DEMOLISH_RAILROAD); |
2755 case STATION_RAIL: return_cmd_error(STR_300B_MUST_DEMOLISH_RAILROAD); |
2756 case STATION_AIRPORT: return_cmd_error(STR_300E_MUST_DEMOLISH_AIRPORT_FIRST); |
2756 case STATION_AIRPORT: return_cmd_error(STR_300E_MUST_DEMOLISH_AIRPORT_FIRST); |