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);
432 RoadBits type_bits = existing | *pieces;
445 type_bits = existing | *pieces;
494 p2 = (town != NULL) ? town->
index : (TownID)INVALID_TOWN;
506 RoadBits pieces = Extract<RoadBits, 0, 4>(p1);
511 RoadType rt = Extract<RoadType, 4, 2>(p1);
518 bool need_to_clear =
false;
534 if ((existing & pieces) == pieces) {
542 if (ret.
Failed())
return ret;
554 if (ret.
Failed())
return ret;
572 if (ret.
Failed())
return ret;
590 default: NOT_REACHED();
613 if (pieces &
ROAD_X)
goto do_clear;
618 if (pieces &
ROAD_Y)
goto do_clear;
622 default:
goto do_clear;
626 if (ret.
Failed())
return ret;
658 if (pieces & ~curbits)
goto do_clear;
672 if (ret.
Failed())
return ret;
678 need_to_clear =
true;
685 if (ret.
Failed())
return ret;
689 if (other_bits != pieces) {
700 if (!need_to_clear) {
724 if (ret.
Failed())
return ret;
734 cost.
AddCost(num_pieces * _price[PR_BUILD_ROAD]);
834 RoadType rt = Extract<RoadType, 3, 2>(p2);
837 Axis axis = Extract<Axis, 2, 1>(p2);
845 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
861 bool had_bridge =
false;
862 bool had_tunnel =
false;
863 bool had_success =
false;
864 bool is_ai =
HasBit(p2, 6);
871 if (!is_ai && start_tile != end_tile) {
888 if (is_ai)
return last_error;
911 if (tile == end_tile)
break;
916 return had_success ? cost : last_error;
939 RoadType rt = Extract<RoadType, 3, 2>(p2);
942 Axis axis = Extract<Axis, 2, 1>(p2);
948 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
950 start_tile = end_tile;
958 bool had_success =
false;
976 RemoveRoad(tile, flags, bits, rt,
true,
false);
982 if (last_error.
GetErrorMessage() != STR_ERROR_OWNED_BY) last_error = ret;
986 if (tile == end_tile)
break;
991 return had_success ? cost : last_error;
1010 RoadType rt = Extract<RoadType, 2, 2>(p1);
1023 if (cost.
Failed())
return cost;
1041 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1049 if (ret.
Failed())
return ret;
1053 if (ret.
Failed())
return ret;
1063 delete Depot::GetByTile(tile);
1064 DoClearSquare(tile);
1082 if (tmp_ret.
Failed())
return tmp_ret;
1102 if (tmp_ret.
Failed())
return tmp_ret;
1107 if (flags & DC_EXEC) {
1115 if (flags & DC_AUTO) {
1118 return RemoveRoadDepot(tile, flags);
1160 const byte _road_sloped_sprites[14] = {
1204 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1205 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1249 if (ti->
tileh !=
SLOPE_FLAT) image = _road_sloped_sprites[ti->
tileh - 1] + SPR_ROAD_SLOPE_START;
1252 if (image == 0) image = _road_tile_sprites_1[road !=
ROAD_NONE ? road : tram];
1263 default: image -= 19;
break;
1274 image = _road_sloped_sprites[ti->
tileh - 1] + SPR_TRAMWAY_SLOPED_OFFSET;
1276 image = _road_tile_sprites_1[tram] - SPR_ROAD_Y;
1278 image += (road ==
ROAD_NONE) ? SPR_TRAMWAY_TRAM : SPR_TRAMWAY_OVERLAY;
1307 if (height < minz)
return;
1314 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1315 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10);
1333 if (rti->UsesOverlay()) {
1345 default: road -= 19;
break;
1371 default: image += 4;
break;
1439 TownID tid = (TownID)INVALID_TOWN;
1442 if (town != NULL) tid = town->
index;
1449 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y)
1474 static const Roadside _town_road_types[][2] = {
1482 static const Roadside _town_road_types_2[][2] = {
1491 static void TileLoop_Road(
TileIndex tile)
1513 HouseZonesBits grp = HZB_TOWN_EDGE;
1543 if (cur_rs == new_rs[0])
return;
1546 if (cur_rs == new_rs[1]) {
1566 if (old_rb != new_rb) {
1575 static bool ClickTile_Road(
TileIndex tile)
1584 static const TrackBits _road_trackbits[16] = {
1616 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
1655 static const StringID _road_tile_strings[] = {
1656 STR_LAI_ROAD_DESCRIPTION_ROAD,
1657 STR_LAI_ROAD_DESCRIPTION_ROAD,
1658 STR_LAI_ROAD_DESCRIPTION_ROAD,
1659 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
1660 STR_LAI_ROAD_DESCRIPTION_ROAD,
1661 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
1662 STR_LAI_ROAD_DESCRIPTION_ROAD,
1663 STR_LAI_ROAD_DESCRIPTION_ROAD,
1674 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
1687 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
1707 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
1712 td->
owner[0] = rail_owner;
1714 td->
owner[1] = road_owner;
1716 td->
owner[2] = tram_owner;
1719 td->
owner[0] = first_owner;
1738 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
1787 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
1828 if (bits == bits_copy) {
1843 default: NOT_REACHED();
1853 GetSlopePixelZ_Road,
1857 GetTileTrackStatus_Road,
1861 ChangeTileOwner_Road,