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]);
258 cost.
AddCost(_price[PR_CLEAR_ROAD] * 2);
435 RoadBits type_bits = existing | *pieces;
448 type_bits = existing | *pieces;
497 p2 = (town != NULL) ? town->
index : (TownID)INVALID_TOWN;
509 RoadBits pieces = Extract<RoadBits, 0, 4>(p1);
514 RoadType rt = Extract<RoadType, 4, 2>(p1);
521 bool need_to_clear =
false;
537 if ((existing & pieces) == pieces) {
545 if (ret.
Failed())
return ret;
557 if (ret.
Failed())
return ret;
575 if (ret.
Failed())
return ret;
593 default: NOT_REACHED();
616 if (pieces &
ROAD_X)
goto do_clear;
621 if (pieces &
ROAD_Y)
goto do_clear;
625 default:
goto do_clear;
629 if (ret.
Failed())
return ret;
664 if (pieces & ~curbits)
goto do_clear;
678 if (ret.
Failed())
return ret;
684 need_to_clear =
true;
691 if (ret.
Failed())
return ret;
695 if (other_bits != pieces) {
706 if (!need_to_clear) {
730 if (ret.
Failed())
return ret;
740 cost.
AddCost(num_pieces * _price[PR_BUILD_ROAD]);
840 RoadType rt = Extract<RoadType, 3, 2>(p2);
843 Axis axis = Extract<Axis, 2, 1>(p2);
851 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
867 bool had_bridge =
false;
868 bool had_tunnel =
false;
869 bool had_success =
false;
870 bool is_ai =
HasBit(p2, 6);
877 if (!is_ai && start_tile != end_tile) {
894 if (is_ai)
return last_error;
917 if (tile == end_tile)
break;
922 return had_success ? cost : last_error;
945 RoadType rt = Extract<RoadType, 3, 2>(p2);
948 Axis axis = Extract<Axis, 2, 1>(p2);
954 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
956 start_tile = end_tile;
964 bool had_success =
false;
982 RemoveRoad(tile, flags, bits, rt,
true,
false);
988 if (last_error.
GetErrorMessage() != STR_ERROR_OWNED_BY) last_error = ret;
992 if (tile == end_tile)
break;
997 return had_success ? cost : last_error;
1016 RoadType rt = Extract<RoadType, 2, 2>(p1);
1029 if (cost.
Failed())
return cost;
1047 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1055 if (ret.
Failed())
return ret;
1059 if (ret.
Failed())
return ret;
1069 delete Depot::GetByTile(tile);
1070 DoClearSquare(tile);
1088 if (tmp_ret.
Failed())
return tmp_ret;
1108 if (tmp_ret.
Failed())
return tmp_ret;
1113 if (flags & DC_EXEC) {
1121 if (flags & DC_AUTO) {
1124 return RemoveRoadDepot(tile, flags);
1166 const byte _road_sloped_sprites[14] = {
1210 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1211 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1255 if (ti->
tileh !=
SLOPE_FLAT) image = _road_sloped_sprites[ti->
tileh - 1] + SPR_ROAD_SLOPE_START;
1258 if (image == 0) image = _road_tile_sprites_1[road !=
ROAD_NONE ? road : tram];
1269 default: image -= 19;
break;
1280 image = _road_sloped_sprites[ti->
tileh - 1] + SPR_TRAMWAY_SLOPED_OFFSET;
1282 image = _road_tile_sprites_1[tram] - SPR_ROAD_Y;
1284 image += (road ==
ROAD_NONE) ? SPR_TRAMWAY_TRAM : SPR_TRAMWAY_OVERLAY;
1313 if (height < minz)
return;
1320 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1321 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10);
1339 if (rti->UsesOverlay()) {
1351 default: road -= 19;
break;
1377 default: image += 4;
break;
1445 TownID tid = (TownID)INVALID_TOWN;
1448 if (town != NULL) tid = town->
index;
1455 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y)
1480 static const Roadside _town_road_types[][2] = {
1488 static const Roadside _town_road_types_2[][2] = {
1497 static void TileLoop_Road(
TileIndex tile)
1519 HouseZonesBits grp = HZB_TOWN_EDGE;
1549 if (cur_rs == new_rs[0])
return;
1552 if (cur_rs == new_rs[1]) {
1572 if (old_rb != new_rb) {
1581 static bool ClickTile_Road(
TileIndex tile)
1590 static const TrackBits _road_trackbits[16] = {
1622 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
1661 static const StringID _road_tile_strings[] = {
1662 STR_LAI_ROAD_DESCRIPTION_ROAD,
1663 STR_LAI_ROAD_DESCRIPTION_ROAD,
1664 STR_LAI_ROAD_DESCRIPTION_ROAD,
1665 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
1666 STR_LAI_ROAD_DESCRIPTION_ROAD,
1667 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
1668 STR_LAI_ROAD_DESCRIPTION_ROAD,
1669 STR_LAI_ROAD_DESCRIPTION_ROAD,
1680 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
1693 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
1713 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
1718 td->
owner[0] = rail_owner;
1720 td->
owner[1] = road_owner;
1722 td->
owner[2] = tram_owner;
1725 td->
owner[0] = first_owner;
1744 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
1793 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
1834 if (bits == bits_copy) {
1849 default: NOT_REACHED();
1859 GetSlopePixelZ_Road,
1863 GetTileTrackStatus_Road,
1867 ChangeTileOwner_Road,