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;
581 default: NOT_REACHED();
604 if (pieces &
ROAD_X)
goto do_clear;
609 if (pieces &
ROAD_Y)
goto do_clear;
613 default:
goto do_clear;
617 if (ret.
Failed())
return ret;
649 if (pieces & ~curbits)
goto do_clear;
663 if (ret.
Failed())
return ret;
669 need_to_clear =
true;
676 if (ret.
Failed())
return ret;
680 if (other_bits != pieces) {
691 if (!need_to_clear) {
715 if (ret.
Failed())
return ret;
725 cost.
AddCost(num_pieces * _price[PR_BUILD_ROAD]);
825 RoadType rt = Extract<RoadType, 3, 2>(p2);
828 Axis axis = Extract<Axis, 2, 1>(p2);
836 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
852 bool had_bridge =
false;
853 bool had_tunnel =
false;
854 bool had_success =
false;
855 bool is_ai =
HasBit(p2, 6);
862 if (!is_ai && start_tile != end_tile) {
879 if (is_ai)
return last_error;
902 if (tile == end_tile)
break;
907 return had_success ? cost : last_error;
930 RoadType rt = Extract<RoadType, 3, 2>(p2);
933 Axis axis = Extract<Axis, 2, 1>(p2);
939 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
941 start_tile = end_tile;
949 bool had_success =
false;
967 RemoveRoad(tile, flags, bits, rt,
true,
false);
973 if (last_error.
GetErrorMessage() != STR_ERROR_OWNED_BY) last_error = ret;
977 if (tile == end_tile)
break;
982 return had_success ? cost : last_error;
1001 RoadType rt = Extract<RoadType, 2, 2>(p1);
1014 if (cost.
Failed())
return cost;
1032 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1040 if (ret.
Failed())
return ret;
1044 if (ret.
Failed())
return ret;
1054 delete Depot::GetByTile(tile);
1055 DoClearSquare(tile);
1073 if (tmp_ret.
Failed())
return tmp_ret;
1093 if (tmp_ret.
Failed())
return tmp_ret;
1098 if (flags & DC_EXEC) {
1106 if (flags & DC_AUTO) {
1109 return RemoveRoadDepot(tile, flags);
1151 const byte _road_sloped_sprites[14] = {
1195 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1196 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1240 if (ti->
tileh !=
SLOPE_FLAT) image = _road_sloped_sprites[ti->
tileh - 1] + SPR_ROAD_SLOPE_START;
1243 if (image == 0) image = _road_tile_sprites_1[road !=
ROAD_NONE ? road : tram];
1254 default: image -= 19;
break;
1265 image = _road_sloped_sprites[ti->
tileh - 1] + SPR_TRAMWAY_SLOPED_OFFSET;
1267 image = _road_tile_sprites_1[tram] - SPR_ROAD_Y;
1269 image += (road ==
ROAD_NONE) ? SPR_TRAMWAY_TRAM : SPR_TRAMWAY_OVERLAY;
1298 if (height < minz)
return;
1305 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1306 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10);
1324 if (rti->UsesOverlay()) {
1336 default: road -= 19;
break;
1362 default: image += 4;
break;
1430 TownID tid = (TownID)INVALID_TOWN;
1433 if (town != NULL) tid = town->
index;
1440 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y)
1465 static const Roadside _town_road_types[][2] = {
1473 static const Roadside _town_road_types_2[][2] = {
1482 static void TileLoop_Road(
TileIndex tile)
1504 HouseZonesBits grp = HZB_TOWN_EDGE;
1534 if (cur_rs == new_rs[0])
return;
1537 if (cur_rs == new_rs[1]) {
1557 if (old_rb != new_rb) {
1566 static bool ClickTile_Road(
TileIndex tile)
1575 static const TrackBits _road_trackbits[16] = {
1607 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
1646 static const StringID _road_tile_strings[] = {
1647 STR_LAI_ROAD_DESCRIPTION_ROAD,
1648 STR_LAI_ROAD_DESCRIPTION_ROAD,
1649 STR_LAI_ROAD_DESCRIPTION_ROAD,
1650 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
1651 STR_LAI_ROAD_DESCRIPTION_ROAD,
1652 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
1653 STR_LAI_ROAD_DESCRIPTION_ROAD,
1654 STR_LAI_ROAD_DESCRIPTION_ROAD,
1665 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
1678 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
1698 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
1703 td->
owner[0] = rail_owner;
1705 td->
owner[1] = road_owner;
1707 td->
owner[2] = tram_owner;
1710 td->
owner[0] = first_owner;
1729 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
1778 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
1819 if (bits == bits_copy) {
1834 default: NOT_REACHED();
1844 GetSlopePixelZ_Road,
1848 GetTileTrackStatus_Road,
1852 ChangeTileOwner_Road,