39 #include "table/strings.h"
50 FOR_ALL_ROADVEHICLES(rv)
return true;
144 if (ret.
Failed())
return ret;
189 if (ret.
Failed())
return ret;
197 if (ret.
Failed())
return ret;
204 if (ret.
Failed())
return ret;
213 if (ret.
Failed())
return ret;
227 cost.
AddCost(len * _price[PR_CLEAR_ROAD]);
259 cost.
AddCost(_price[PR_CLEAR_ROAD] * 2);
433 RoadBits type_bits = existing | *pieces;
446 type_bits = existing | *pieces;
495 p2 = (town != NULL) ? town->
index : (TownID)INVALID_TOWN;
507 RoadBits pieces = Extract<RoadBits, 0, 4>(p1);
512 RoadType rt = Extract<RoadType, 4, 2>(p1);
519 bool need_to_clear =
false;
535 if ((existing & pieces) == pieces) {
543 if (ret.
Failed())
return ret;
555 if (ret.
Failed())
return ret;
582 default: NOT_REACHED();
605 if (pieces &
ROAD_X)
goto do_clear;
610 if (pieces &
ROAD_Y)
goto do_clear;
614 default:
goto do_clear;
618 if (ret.
Failed())
return ret;
650 if (pieces & ~curbits)
goto do_clear;
664 if (ret.
Failed())
return ret;
670 need_to_clear =
true;
677 if (ret.
Failed())
return ret;
681 if (other_bits != pieces) {
692 if (!need_to_clear) {
716 if (ret.
Failed())
return ret;
726 cost.
AddCost(num_pieces * _price[PR_BUILD_ROAD]);
827 RoadType rt = Extract<RoadType, 3, 2>(p2);
830 Axis axis = Extract<Axis, 2, 1>(p2);
838 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
854 bool had_bridge =
false;
855 bool had_tunnel =
false;
856 bool had_success =
false;
857 bool is_ai =
HasBit(p2, 6);
864 if (!is_ai && start_tile != end_tile) {
881 if (is_ai)
return last_error;
904 if (tile == end_tile)
break;
909 return had_success ? cost : last_error;
932 RoadType rt = Extract<RoadType, 3, 2>(p2);
935 Axis axis = Extract<Axis, 2, 1>(p2);
941 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
943 start_tile = end_tile;
951 bool had_success =
false;
969 RemoveRoad(tile, flags, bits, rt,
true,
false);
975 if (last_error.
GetErrorMessage() != STR_ERROR_OWNED_BY) last_error = ret;
979 if (tile == end_tile)
break;
984 return had_success ? cost : last_error;
1003 RoadType rt = Extract<RoadType, 2, 2>(p1);
1016 if (cost.
Failed())
return cost;
1034 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1042 if (ret.
Failed())
return ret;
1046 if (ret.
Failed())
return ret;
1056 delete Depot::GetByTile(tile);
1057 DoClearSquare(tile);
1075 if (tmp_ret.
Failed())
return tmp_ret;
1095 if (tmp_ret.
Failed())
return tmp_ret;
1100 if (flags & DC_EXEC) {
1108 if (flags & DC_AUTO) {
1111 return RemoveRoadDepot(tile, flags);
1153 const byte _road_sloped_sprites[14] = {
1198 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1199 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1243 if (ti->
tileh !=
SLOPE_FLAT) image = _road_sloped_sprites[ti->
tileh - 1] + SPR_ROAD_SLOPE_START;
1246 if (image == 0) image = _road_tile_sprites_1[road !=
ROAD_NONE ? road : tram];
1257 default: image -= 19;
break;
1268 image = _road_sloped_sprites[ti->
tileh - 1] + SPR_TRAMWAY_SLOPED_OFFSET;
1270 image = _road_tile_sprites_1[tram] - SPR_ROAD_Y;
1272 image += (road ==
ROAD_NONE) ? SPR_TRAMWAY_TRAM : SPR_TRAMWAY_OVERLAY;
1301 if (height < minz)
return;
1308 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1309 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10);
1327 if (rti->UsesOverlay()) {
1339 default: road -= 19;
break;
1365 default: image += 4;
break;
1433 TownID tid = (TownID)INVALID_TOWN;
1436 if (town != NULL) tid = town->
index;
1443 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y)
1468 static const Roadside _town_road_types[][2] = {
1476 static const Roadside _town_road_types_2[][2] = {
1485 static void TileLoop_Road(
TileIndex tile)
1507 HouseZonesBits grp = HZB_TOWN_EDGE;
1537 if (cur_rs == new_rs[0])
return;
1540 if (cur_rs == new_rs[1]) {
1560 if (old_rb != new_rb) {
1569 static bool ClickTile_Road(
TileIndex tile)
1578 static const TrackBits _road_trackbits[16] = {
1610 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
1649 static const StringID _road_tile_strings[] = {
1650 STR_LAI_ROAD_DESCRIPTION_ROAD,
1651 STR_LAI_ROAD_DESCRIPTION_ROAD,
1652 STR_LAI_ROAD_DESCRIPTION_ROAD,
1653 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
1654 STR_LAI_ROAD_DESCRIPTION_ROAD,
1655 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
1656 STR_LAI_ROAD_DESCRIPTION_ROAD,
1657 STR_LAI_ROAD_DESCRIPTION_ROAD,
1668 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
1681 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
1701 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
1706 td->
owner[0] = rail_owner;
1708 td->
owner[1] = road_owner;
1710 td->
owner[2] = tram_owner;
1713 td->
owner[0] = first_owner;
1732 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
1781 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
1822 if (bits == bits_copy) {
1837 default: NOT_REACHED();
1847 GetSlopePixelZ_Road,
1851 GetTileTrackStatus_Road,
1855 ChangeTileOwner_Road,