mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
This commit is contained in:
parent
739b118c6b
commit
43c0f7ea8e
|
@ -2639,8 +2639,7 @@ static CommandCost AiDoBuildDefaultRoadBlock(TileIndex tile, const AiDefaultBloc
|
||||||
_cleared_town = NULL;
|
_cleared_town = NULL;
|
||||||
|
|
||||||
if (p->mode == 2) {
|
if (p->mode == 2) {
|
||||||
if (IsTileType(c, MP_ROAD) &&
|
if (IsNormalRoadTile(c) &&
|
||||||
GetRoadTileType(c) == ROAD_TILE_NORMAL &&
|
|
||||||
(GetRoadBits(c, ROADTYPE_ROAD) & p->attr) != 0) {
|
(GetRoadBits(c, ROADTYPE_ROAD) & p->attr) != 0) {
|
||||||
roadflag |= 2;
|
roadflag |= 2;
|
||||||
|
|
||||||
|
@ -2682,7 +2681,7 @@ clear_town_stuff:;
|
||||||
|
|
||||||
if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR;
|
if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR;
|
||||||
|
|
||||||
if (!IsTileType(c, MP_ROAD) || GetRoadTileType(c) != ROAD_TILE_NORMAL) {
|
if (!IsNormalRoadTile(c)) {
|
||||||
ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
|
ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
|
||||||
if (CmdFailed(ret)) return CMD_ERROR;
|
if (CmdFailed(ret)) return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -2857,7 +2856,7 @@ static bool AiEnumFollowRoad(TileIndex tile, AiRoadEnum *a, int track, uint leng
|
||||||
if (dist <= a->best_dist) {
|
if (dist <= a->best_dist) {
|
||||||
TileIndex tile2 = TILE_MASK(tile + TileOffsByDiagDir(_dir_by_track[track]));
|
TileIndex tile2 = TILE_MASK(tile + TileOffsByDiagDir(_dir_by_track[track]));
|
||||||
|
|
||||||
if (IsTileType(tile2, MP_ROAD) && GetRoadTileType(tile2) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoadTile(tile2)) {
|
||||||
a->best_dist = dist;
|
a->best_dist = dist;
|
||||||
a->best_tile = tile;
|
a->best_tile = tile;
|
||||||
a->best_track = track;
|
a->best_track = track;
|
||||||
|
@ -3740,7 +3739,7 @@ pos_3:
|
||||||
|
|
||||||
if (IsLevelCrossing(tile)) goto is_rail_crossing;
|
if (IsLevelCrossing(tile)) goto is_rail_crossing;
|
||||||
|
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
|
if (IsRoadDepot(tile)) {
|
||||||
DiagDirection dir;
|
DiagDirection dir;
|
||||||
TileIndex t;
|
TileIndex t;
|
||||||
|
|
||||||
|
|
|
@ -801,8 +801,7 @@ static void AiNew_State_FindDepot(Player *p)
|
||||||
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
|
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
|
||||||
TileIndex t = tile + TileOffsByDiagDir(j);
|
TileIndex t = tile + TileOffsByDiagDir(j);
|
||||||
|
|
||||||
if (IsTileType(t, MP_ROAD) &&
|
if (IsRoadDepotTile(t) &&
|
||||||
GetRoadTileType(t) == ROAD_TILE_DEPOT &&
|
|
||||||
IsTileOwner(t, _current_player) &&
|
IsTileOwner(t, _current_player) &&
|
||||||
GetRoadDepotDirection(t) == ReverseDiagDir(j)) {
|
GetRoadDepotDirection(t) == ReverseDiagDir(j)) {
|
||||||
_players_ainew[p->index].depot_tile = t;
|
_players_ainew[p->index].depot_tile = t;
|
||||||
|
@ -1102,7 +1101,7 @@ static void AiNew_State_BuildDepot(Player *p)
|
||||||
CommandCost res;
|
CommandCost res;
|
||||||
assert(_players_ainew[p->index].state == AI_STATE_BUILD_DEPOT);
|
assert(_players_ainew[p->index].state == AI_STATE_BUILD_DEPOT);
|
||||||
|
|
||||||
if (IsTileType(_players_ainew[p->index].depot_tile, MP_ROAD) && GetRoadTileType(_players_ainew[p->index].depot_tile) == ROAD_TILE_DEPOT) {
|
if (IsRoadDepotTile(_players_ainew[p->index].depot_tile)) {
|
||||||
if (IsTileOwner(_players_ainew[p->index].depot_tile, _current_player)) {
|
if (IsTileOwner(_players_ainew[p->index].depot_tile, _current_player)) {
|
||||||
// The depot is already built
|
// The depot is already built
|
||||||
_players_ainew[p->index].state = AI_STATE_BUILD_VEHICLE;
|
_players_ainew[p->index].state = AI_STATE_BUILD_VEHICLE;
|
||||||
|
|
|
@ -45,7 +45,7 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
|
||||||
return IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT;
|
return IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT;
|
||||||
|
|
||||||
case TRANSPORT_ROAD:
|
case TRANSPORT_ROAD:
|
||||||
return IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT;
|
return IsRoadDepotTile(tile);
|
||||||
|
|
||||||
case TRANSPORT_WATER:
|
case TRANSPORT_WATER:
|
||||||
return IsTileType(tile, MP_WATER) && GetWaterTileType(tile) == WATER_TILE_DEPOT;
|
return IsTileType(tile, MP_WATER) && GetWaterTileType(tile) == WATER_TILE_DEPOT;
|
||||||
|
@ -64,7 +64,7 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
|
||||||
static inline bool IsDepotTile(TileIndex tile)
|
static inline bool IsDepotTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_ROAD: return GetRoadTileType(tile) == ROAD_TILE_DEPOT;
|
case MP_ROAD: return IsRoadDepot(tile);
|
||||||
case MP_WATER: return GetWaterTileType(tile) == WATER_TILE_DEPOT;
|
case MP_WATER: return GetWaterTileType(tile) == WATER_TILE_DEPOT;
|
||||||
case MP_RAILWAY: return GetRailTileType(tile) == RAIL_TILE_DEPOT;
|
case MP_RAILWAY: return GetRailTileType(tile) == RAIL_TILE_DEPOT;
|
||||||
case MP_STATION: return IsHangar(tile);
|
case MP_STATION: return IsHangar(tile);
|
||||||
|
|
|
@ -103,7 +103,7 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
|
||||||
return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(t)));
|
return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(t)));
|
||||||
|
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return TRACK_BIT_NONE;
|
if (!IsLevelCrossing(t)) return TRACK_BIT_NONE;
|
||||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||||
return GetCrossingRailBits(t);
|
return GetCrossingRailBits(t);
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ static DiagDirection GetDepotDirection(TileIndex tile, TransportType type)
|
||||||
/** Tests if a tile is a road tile with a single tramtrack (tram can reverse) */
|
/** Tests if a tile is a road tile with a single tramtrack (tram can reverse) */
|
||||||
static DiagDirection GetSingleTramBit(TileIndex tile)
|
static DiagDirection GetSingleTramBit(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoadTile(tile)) {
|
||||||
RoadBits rb = GetRoadBits(tile, ROADTYPE_TRAM);
|
RoadBits rb = GetRoadBits(tile, ROADTYPE_TRAM);
|
||||||
switch (rb) {
|
switch (rb) {
|
||||||
case ROAD_NW: return DIAGDIR_NW;
|
case ROAD_NW: return DIAGDIR_NW;
|
||||||
|
|
|
@ -2388,7 +2388,7 @@ bool AfterLoadGame()
|
||||||
Owner o = GetRoadOwner(t, rt);
|
Owner o = GetRoadOwner(t, rt);
|
||||||
if (IsValidPlayer(o) && !GetPlayer(o)->is_active) SetRoadOwner(t, rt, OWNER_NONE);
|
if (IsValidPlayer(o) && !GetPlayer(o)->is_active) SetRoadOwner(t, rt, OWNER_NONE);
|
||||||
}
|
}
|
||||||
if (GetRoadTileType(t) == ROAD_TILE_CROSSING) {
|
if (IsLevelCrossing(t)) {
|
||||||
Owner o = GetTileOwner(t);
|
Owner o = GetTileOwner(t);
|
||||||
if (!GetPlayer(o)->is_active) {
|
if (!GetPlayer(o)->is_active) {
|
||||||
/* remove leftover rail piece from crossing (from very old savegames) */
|
/* remove leftover rail piece from crossing (from very old savegames) */
|
||||||
|
|
|
@ -281,7 +281,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.type = OT_GOTO_DEPOT;
|
||||||
order.flags = OFB_PART_OF_ORDERS;
|
order.flags = OFB_PART_OF_ORDERS;
|
||||||
order.dest = GetDepotByTile(tile)->index;
|
order.dest = GetDepotByTile(tile)->index;
|
||||||
|
|
|
@ -356,7 +356,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
||||||
|
|
||||||
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
||||||
|
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoad(tile)) {
|
||||||
if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
|
if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
|
||||||
|
|
||||||
RoadTypes roadtypes = GetRoadTypes(tile);
|
RoadTypes roadtypes = GetRoadTypes(tile);
|
||||||
|
|
|
@ -225,7 +225,7 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
|
||||||
|
|
||||||
/* Don't allow road to be removed from the crossing when there is tram;
|
/* Don't allow road to be removed from the crossing when there is tram;
|
||||||
* we can't draw the crossing without trambits ;) */
|
* we can't draw the crossing without trambits ;) */
|
||||||
if (rt == ROADTYPE_ROAD && HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) && (flags & DC_EXEC || crossing_check)) return CMD_ERROR;
|
if (rt == ROADTYPE_ROAD && HasTileRoadType(tile, ROADTYPE_TRAM) && (flags & DC_EXEC || crossing_check)) return CMD_ERROR;
|
||||||
|
|
||||||
if (rt == ROADTYPE_ROAD) {
|
if (rt == ROADTYPE_ROAD) {
|
||||||
ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
|
ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
|
||||||
|
@ -429,7 +429,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
||||||
|
|
||||||
all_bits = GetAllRoadBits(tile);
|
all_bits = GetAllRoadBits(tile);
|
||||||
if (!HasBit(GetRoadTypes(tile), rt)) break;
|
if (!HasTileRoadType(tile, rt)) break;
|
||||||
|
|
||||||
existing = GetRoadBits(tile, rt);
|
existing = GetRoadBits(tile, rt);
|
||||||
RoadBits merged = existing | pieces;
|
RoadBits merged = existing | pieces;
|
||||||
|
@ -455,7 +455,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ROAD_TILE_CROSSING:
|
case ROAD_TILE_CROSSING:
|
||||||
if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
||||||
all_bits = GetCrossingRoadBits(tile);
|
all_bits = GetCrossingRoadBits(tile);
|
||||||
if (pieces & ComplementRoadBits(all_bits)) goto do_clear;
|
if (pieces & ComplementRoadBits(all_bits)) goto do_clear;
|
||||||
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
||||||
|
@ -508,14 +508,14 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
|
if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
|
||||||
if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
||||||
/* Don't allow adding roadtype to the roadstop when vehicles are already driving on it */
|
/* Don't allow adding roadtype to the roadstop when vehicles are already driving on it */
|
||||||
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
|
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
|
||||||
if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
||||||
/* Don't allow adding roadtype to the bridge/tunnel when vehicles are already driving on it */
|
/* Don't allow adding roadtype to the bridge/tunnel when vehicles are already driving on it */
|
||||||
if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
|
if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
|
||||||
break;
|
break;
|
||||||
|
@ -543,7 +543,7 @@ do_clear:;
|
||||||
pieces &= ComplementRoadBits(existing);
|
pieces &= ComplementRoadBits(existing);
|
||||||
|
|
||||||
/* Check if new road bits will have the same foundation as other existing road types */
|
/* Check if new road bits will have the same foundation as other existing road types */
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoad(tile)) {
|
||||||
Slope slope = GetTileSlope(tile, NULL);
|
Slope slope = GetTileSlope(tile, NULL);
|
||||||
Foundation found_new = GetRoadFoundation(slope, pieces | existing);
|
Foundation found_new = GetRoadFoundation(slope, pieces | existing);
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ do_clear:;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rt != ROADTYPE_TRAM && IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (rt != ROADTYPE_TRAM && IsNormalRoadTile(tile)) {
|
||||||
existing |= pieces;
|
existing |= pieces;
|
||||||
SetDisallowedRoadDirections(tile, (existing == ROAD_X || existing == ROAD_Y) ?
|
SetDisallowedRoadDirections(tile, (existing == ROAD_X || existing == ROAD_Y) ?
|
||||||
GetDisallowedRoadDirections(tile) ^ toggle_drd : DRD_NONE);
|
GetDisallowedRoadDirections(tile) ^ toggle_drd : DRD_NONE);
|
||||||
|
@ -1090,7 +1090,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGroundSprite(image, pal);
|
DrawGroundSprite(image, pal);
|
||||||
if (HasBit(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
|
if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
|
||||||
DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
|
DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
|
||||||
DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
|
DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1108,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
|
|
||||||
palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
|
palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
|
||||||
|
|
||||||
if (HasBit(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
|
if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
|
||||||
dts = &_tram_depot[GetRoadDepotDirection(ti->tile)];
|
dts = &_tram_depot[GetRoadDepotDirection(ti->tile)];
|
||||||
} else {
|
} else {
|
||||||
dts = &_road_depot[GetRoadDepotDirection(ti->tile)];
|
dts = &_road_depot[GetRoadDepotDirection(ti->tile)];
|
||||||
|
@ -1165,7 +1165,7 @@ static uint GetSlopeZ_Road(TileIndex tile, uint x, uint y)
|
||||||
Slope tileh = GetTileSlope(tile, &z);
|
Slope tileh = GetTileSlope(tile, &z);
|
||||||
|
|
||||||
if (tileh == SLOPE_FLAT) return z;
|
if (tileh == SLOPE_FLAT) return z;
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoad(tile)) {
|
||||||
Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile));
|
Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile));
|
||||||
z += ApplyFoundationToSlope(f, &tileh);
|
z += ApplyFoundationToSlope(f, &tileh);
|
||||||
return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
|
return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
|
||||||
|
@ -1176,7 +1176,7 @@ static uint GetSlopeZ_Road(TileIndex tile, uint x, uint y)
|
||||||
|
|
||||||
static Foundation GetFoundation_Road(TileIndex tile, Slope tileh)
|
static Foundation GetFoundation_Road(TileIndex tile, Slope tileh)
|
||||||
{
|
{
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoad(tile)) {
|
||||||
return GetRoadFoundation(tileh, GetAllRoadBits(tile));
|
return GetRoadFoundation(tileh, GetAllRoadBits(tile));
|
||||||
} else {
|
} else {
|
||||||
return FlatteningFoundation(tileh);
|
return FlatteningFoundation(tileh);
|
||||||
|
@ -1229,7 +1229,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) return;
|
if (IsRoadDepot(tile)) return;
|
||||||
|
|
||||||
const Town* t = ClosestTownFromTile(tile, (uint)-1);
|
const Town* t = ClosestTownFromTile(tile, (uint)-1);
|
||||||
if (!HasRoadWorks(tile)) {
|
if (!HasRoadWorks(tile)) {
|
||||||
|
@ -1241,7 +1241,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||||
/* Show an animation to indicate road work */
|
/* Show an animation to indicate road work */
|
||||||
if (t->road_build_months != 0 &&
|
if (t->road_build_months != 0 &&
|
||||||
(DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) &&
|
(DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) &&
|
||||||
GetRoadTileType(tile) == ROAD_TILE_NORMAL && CountBits(GetAllRoadBits(tile)) > 1 ) {
|
IsNormalRoad(tile) && CountBits(GetAllRoadBits(tile)) > 1 ) {
|
||||||
if (GetTileSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile) && Chance16(1, 40)) {
|
if (GetTileSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile) && Chance16(1, 40)) {
|
||||||
StartRoadWorks(tile);
|
StartRoadWorks(tile);
|
||||||
|
|
||||||
|
@ -1297,7 +1297,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||||
|
|
||||||
static void ClickTile_Road(TileIndex tile)
|
static void ClickTile_Road(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) ShowDepotWindow(tile, VEH_ROAD);
|
if (IsRoadDepot(tile)) ShowDepotWindow(tile, VEH_ROAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const byte _road_trackbits[16] = {
|
static const byte _road_trackbits[16] = {
|
||||||
|
@ -1402,7 +1402,7 @@ static VehicleEnterTileStatus VehicleEnter_Road(Vehicle *v, TileIndex tile, int
|
||||||
|
|
||||||
static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||||
{
|
{
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
|
if (IsRoadDepot(tile)) {
|
||||||
if (GetTileOwner(tile) == old_player) {
|
if (GetTileOwner(tile) == old_player) {
|
||||||
if (new_player == PLAYER_SPECTATOR) {
|
if (new_player == PLAYER_SPECTATOR) {
|
||||||
DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
|
DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
|
||||||
|
@ -1415,7 +1415,7 @@ static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID n
|
||||||
|
|
||||||
for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
|
for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
|
||||||
/* ROADTYPE_ROAD denotes the tile owner, so update it too */
|
/* ROADTYPE_ROAD denotes the tile owner, so update it too */
|
||||||
if (rt != ROADTYPE_ROAD && !HasBit(GetRoadTypes(tile), rt)) continue;
|
if (rt != ROADTYPE_ROAD && !HasTileRoadType(tile, rt)) continue;
|
||||||
|
|
||||||
if (GetRoadOwner(tile, rt) == old_player) {
|
if (GetRoadOwner(tile, rt) == old_player) {
|
||||||
SetRoadOwner(tile, rt, new_player == PLAYER_SPECTATOR ? OWNER_NONE : new_player);
|
SetRoadOwner(tile, rt, new_player == PLAYER_SPECTATOR ? OWNER_NONE : new_player);
|
||||||
|
|
|
@ -177,7 +177,7 @@ static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
|
||||||
{
|
{
|
||||||
tile += TileOffsByDiagDir(direction);
|
tile += TileOffsByDiagDir(direction);
|
||||||
// if there is a roadpiece just outside of the station entrance, build a connecting route
|
// if there is a roadpiece just outside of the station entrance, build a connecting route
|
||||||
if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsNormalRoadTile(tile)) {
|
||||||
if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
|
if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
|
||||||
DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
|
DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
|
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
|
||||||
{
|
{
|
||||||
if (!HasBit(GetRoadTypes(tile), rt)) return ROAD_NONE;
|
if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
|
||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
|
@ -46,7 +46,7 @@ TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt)
|
||||||
uint32 r;
|
uint32 r;
|
||||||
|
|
||||||
/* Don't allow local authorities to build roads through road depots or road stops. */
|
/* Don't allow local authorities to build roads through road depots or road stops. */
|
||||||
if ((IsTileType(tile, MP_ROAD) && IsTileDepotType(tile, TRANSPORT_ROAD)) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HasBit(GetRoadTypes(tile), rt)) {
|
if (IsRoadDepotTile(tile) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HasTileRoadType(tile, rt)) {
|
||||||
return TRACK_BIT_NONE;
|
return TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,16 @@ static inline RoadTileType GetRoadTileType(TileIndex t)
|
||||||
return (RoadTileType)GB(_m[t].m5, 6, 2);
|
return (RoadTileType)GB(_m[t].m5, 6, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool IsNormalRoad(TileIndex t)
|
||||||
|
{
|
||||||
|
return GetRoadTileType(t) == ROAD_TILE_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsNormalRoadTile(TileIndex t)
|
||||||
|
{
|
||||||
|
return IsTileType(t, MP_ROAD) && IsNormalRoad(t);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool IsLevelCrossing(TileIndex t)
|
static inline bool IsLevelCrossing(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRoadTileType(t) == ROAD_TILE_CROSSING;
|
return GetRoadTileType(t) == ROAD_TILE_CROSSING;
|
||||||
|
@ -34,9 +44,19 @@ static inline bool IsLevelCrossingTile(TileIndex t)
|
||||||
return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
|
return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool IsRoadDepot(TileIndex t)
|
||||||
|
{
|
||||||
|
return GetRoadTileType(t) == ROAD_TILE_DEPOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsRoadDepotTile(TileIndex t)
|
||||||
|
{
|
||||||
|
return IsTileType(t, MP_ROAD) && IsRoadDepot(t);
|
||||||
|
}
|
||||||
|
|
||||||
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt)
|
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_NORMAL);
|
assert(IsNormalRoad(t));
|
||||||
switch (rt) {
|
switch (rt) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case ROADTYPE_ROAD: return (RoadBits)GB(_m[t].m4, 0, 4);
|
case ROADTYPE_ROAD: return (RoadBits)GB(_m[t].m4, 0, 4);
|
||||||
|
@ -52,7 +72,7 @@ static inline RoadBits GetAllRoadBits(TileIndex tile)
|
||||||
|
|
||||||
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt)
|
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_NORMAL); // XXX incomplete
|
assert(IsNormalRoad(t)); // XXX incomplete
|
||||||
switch (rt) {
|
switch (rt) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case ROADTYPE_ROAD: SB(_m[t].m4, 0, 4, r); break;
|
case ROADTYPE_ROAD: SB(_m[t].m4, 0, 4, r); break;
|
||||||
|
@ -80,6 +100,11 @@ static inline void SetRoadTypes(TileIndex t, RoadTypes rt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool HasTileRoadType(TileIndex t, RoadType rt)
|
||||||
|
{
|
||||||
|
return HasBit(GetRoadTypes(t), rt);
|
||||||
|
}
|
||||||
|
|
||||||
static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
if (!IsTileType(t, MP_ROAD)) return GetTileOwner(t);
|
if (!IsTileType(t, MP_ROAD)) return GetTileOwner(t);
|
||||||
|
@ -159,7 +184,7 @@ DECLARE_ENUM_AS_BIT_SET(DisallowedRoadDirections);
|
||||||
*/
|
*/
|
||||||
static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_NORMAL);
|
assert(IsNormalRoad(t));
|
||||||
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
|
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,14 +195,14 @@ static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
||||||
*/
|
*/
|
||||||
static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_NORMAL);
|
assert(IsNormalRoad(t));
|
||||||
assert(drd < DRD_END);
|
assert(drd < DRD_END);
|
||||||
SB(_m[t].m5, 4, 2, drd);
|
SB(_m[t].m5, 4, 2, drd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Axis GetCrossingRoadAxis(TileIndex t)
|
static inline Axis GetCrossingRoadAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
|
assert(IsLevelCrossing(t));
|
||||||
return (Axis)GB(_m[t].m4, 6, 1);
|
return (Axis)GB(_m[t].m4, 6, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,13 +218,13 @@ static inline TrackBits GetCrossingRailBits(TileIndex tile)
|
||||||
|
|
||||||
static inline bool IsCrossingBarred(TileIndex t)
|
static inline bool IsCrossingBarred(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
|
assert(IsLevelCrossing(t));
|
||||||
return HasBit(_m[t].m4, 5);
|
return HasBit(_m[t].m4, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetCrossingBarred(TileIndex t, bool barred)
|
static inline void SetCrossingBarred(TileIndex t, bool barred)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
|
assert(IsLevelCrossing(t));
|
||||||
SB(_m[t].m4, 5, 1, barred);
|
SB(_m[t].m4, 5, 1, barred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +305,7 @@ static inline void TerminateRoadWorks(TileIndex t)
|
||||||
|
|
||||||
static inline DiagDirection GetRoadDepotDirection(TileIndex t)
|
static inline DiagDirection GetRoadDepotDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetRoadTileType(t) == ROAD_TILE_DEPOT);
|
assert(IsRoadDepot(t));
|
||||||
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR;
|
if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR;
|
||||||
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
|
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
|
||||||
|
|
||||||
if (HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) != HasBit(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
|
if (HasTileRoadType(tile, ROADTYPE_TRAM) != HasBit(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
|
||||||
|
|
||||||
uint num_vehicles = 1 + CountArticulatedParts(p1, false);
|
uint num_vehicles = 1 + CountArticulatedParts(p1, false);
|
||||||
|
|
||||||
|
@ -404,8 +404,7 @@ static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, Trackdir trackdi
|
||||||
|
|
||||||
tile += TileOffsByDiagDir(_road_pf_directions[trackdir]);
|
tile += TileOffsByDiagDir(_road_pf_directions[trackdir]);
|
||||||
|
|
||||||
if (IsTileType(tile, MP_ROAD) &&
|
if (IsRoadDepotTile(tile) &&
|
||||||
GetRoadTileType(tile) == ROAD_TILE_DEPOT &&
|
|
||||||
IsTileOwner(tile, rfdd->owner) &&
|
IsTileOwner(tile, rfdd->owner) &&
|
||||||
length < rfdd->best_length) {
|
length < rfdd->best_length) {
|
||||||
rfdd->best_length = length;
|
rfdd->best_length = length;
|
||||||
|
@ -550,7 +549,7 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
|
if (IsNormalRoadTile(v->tile) && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
|
||||||
|
|
||||||
if (IsTileType(v->tile, MP_TUNNELBRIDGE) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
|
if (IsTileType(v->tile, MP_TUNNELBRIDGE) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -1159,7 +1158,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
|
||||||
TrackdirBits trackdirs = (TrackdirBits)GB(r, 0, 16);
|
TrackdirBits trackdirs = (TrackdirBits)GB(r, 0, 16);
|
||||||
|
|
||||||
if (IsTileType(tile, MP_ROAD)) {
|
if (IsTileType(tile, MP_ROAD)) {
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir || (GetRoadTypes(tile) & v->u.road.compatible_roadtypes) == 0)) {
|
if (IsRoadDepot(tile) && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir || (GetRoadTypes(tile) & v->u.road.compatible_roadtypes) == 0)) {
|
||||||
/* Road depot owned by another player or with the wrong orientation */
|
/* Road depot owned by another player or with the wrong orientation */
|
||||||
trackdirs = TRACKDIR_BIT_NONE;
|
trackdirs = TRACKDIR_BIT_NONE;
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1250,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
|
||||||
DiagDirection dir;
|
DiagDirection dir;
|
||||||
|
|
||||||
if (IsTileType(desttile, MP_ROAD)) {
|
if (IsTileType(desttile, MP_ROAD)) {
|
||||||
if (GetRoadTileType(desttile) == ROAD_TILE_DEPOT) {
|
if (IsRoadDepot(desttile)) {
|
||||||
dir = GetRoadDepotDirection(desttile);
|
dir = GetRoadDepotDirection(desttile);
|
||||||
goto do_it;
|
goto do_it;
|
||||||
}
|
}
|
||||||
|
@ -1413,7 +1412,7 @@ static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev,
|
||||||
|
|
||||||
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
||||||
diag_dir = GetTunnelBridgeDirection(tile);
|
diag_dir = GetTunnelBridgeDirection(tile);
|
||||||
} else if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
|
} else if (IsRoadDepotTile(tile)) {
|
||||||
diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
|
diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1582,8 +1581,7 @@ again:
|
||||||
case TRACKDIR_RVREV_NW: needed = ROAD_SE; break;
|
case TRACKDIR_RVREV_NW: needed = ROAD_SE; break;
|
||||||
}
|
}
|
||||||
if ((v->Previous() != NULL && v->Previous()->tile == tile) ||
|
if ((v->Previous() != NULL && v->Previous()->tile == tile) ||
|
||||||
(IsRoadVehFront(v) && IsTileType(tile, MP_ROAD) &&
|
(IsRoadVehFront(v) && IsNormalRoadTile(tile) && !HasRoadWorks(tile) &&
|
||||||
GetRoadTileType(tile) == ROAD_TILE_NORMAL && !HasRoadWorks(tile) &&
|
|
||||||
(needed & GetRoadBits(tile, ROADTYPE_TRAM)) != ROAD_NONE)) {
|
(needed & GetRoadBits(tile, ROADTYPE_TRAM)) != ROAD_NONE)) {
|
||||||
/*
|
/*
|
||||||
* Taking the 'big' corner for trams only happens when:
|
* Taking the 'big' corner for trams only happens when:
|
||||||
|
@ -1614,7 +1612,7 @@ again:
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) {
|
} else if (IsNormalRoadTile(v->tile) && GetDisallowedRoadDirections(v->tile) != DRD_NONE) {
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1757,9 +1755,7 @@ again:
|
||||||
/* This vehicle is not in a wormhole and it hasn't entered a new tile. If
|
/* This vehicle is not in a wormhole and it hasn't entered a new tile. If
|
||||||
* it's on a depot tile, check if it's time to activate the next vehicle in
|
* it's on a depot tile, check if it's time to activate the next vehicle in
|
||||||
* the chain yet. */
|
* the chain yet. */
|
||||||
if (v->Next() != NULL &&
|
if (v->Next() != NULL && IsRoadDepotTile(v->tile)) {
|
||||||
IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_DEPOT) {
|
|
||||||
|
|
||||||
if (v->u.road.frame == v->u.road.cached_veh_length + RVC_DEPOT_START_FRAME) {
|
if (v->u.road.frame == v->u.road.cached_veh_length + RVC_DEPOT_START_FRAME) {
|
||||||
RoadVehLeaveDepot(v->Next(), false);
|
RoadVehLeaveDepot(v->Next(), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1333,7 +1333,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
bool type = HasBit(p2, 0);
|
bool type = HasBit(p2, 0);
|
||||||
bool is_drive_through = HasBit(p2, 1);
|
bool is_drive_through = HasBit(p2, 1);
|
||||||
bool build_over_road = is_drive_through && IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL;
|
bool build_over_road = is_drive_through && IsNormalRoadTile(tile);
|
||||||
bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN);
|
bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN);
|
||||||
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
|
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
|
||||||
|
|
||||||
|
@ -1356,7 +1356,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
/* Not allowed to build over this road */
|
/* Not allowed to build over this road */
|
||||||
if (build_over_road) {
|
if (build_over_road) {
|
||||||
if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
|
if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
|
||||||
if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) return CMD_ERROR;
|
|
||||||
|
|
||||||
RoadTypes cur_rts = GetRoadTypes(tile);
|
RoadTypes cur_rts = GetRoadTypes(tile);
|
||||||
|
|
||||||
|
@ -2946,8 +2945,8 @@ static CommandCost ClearTile_Station(TileIndex tile, byte flags)
|
||||||
switch (GetStationType(tile)) {
|
switch (GetStationType(tile)) {
|
||||||
case STATION_RAIL: return_cmd_error(STR_300B_MUST_DEMOLISH_RAILROAD);
|
case STATION_RAIL: return_cmd_error(STR_300B_MUST_DEMOLISH_RAILROAD);
|
||||||
case STATION_AIRPORT: return_cmd_error(STR_300E_MUST_DEMOLISH_AIRPORT_FIRST);
|
case STATION_AIRPORT: return_cmd_error(STR_300E_MUST_DEMOLISH_AIRPORT_FIRST);
|
||||||
case STATION_TRUCK: return_cmd_error(HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) ? STR_MUST_DEMOLISH_CARGO_TRAM_STATION : STR_3047_MUST_DEMOLISH_TRUCK_STATION);
|
case STATION_TRUCK: return_cmd_error(HasTileRoadType(tile, ROADTYPE_TRAM) ? STR_MUST_DEMOLISH_CARGO_TRAM_STATION : STR_3047_MUST_DEMOLISH_TRUCK_STATION);
|
||||||
case STATION_BUS: return_cmd_error(HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) ? STR_MUST_DEMOLISH_PASSENGER_TRAM_STATION : STR_3046_MUST_DEMOLISH_BUS_STATION);
|
case STATION_BUS: return_cmd_error(HasTileRoadType(tile, ROADTYPE_TRAM) ? STR_MUST_DEMOLISH_PASSENGER_TRAM_STATION : STR_3046_MUST_DEMOLISH_BUS_STATION);
|
||||||
case STATION_BUOY: return_cmd_error(STR_306A_BUOY_IN_THE_WAY);
|
case STATION_BUOY: return_cmd_error(STR_306A_BUOY_IN_THE_WAY);
|
||||||
case STATION_DOCK: return_cmd_error(STR_304D_MUST_DEMOLISH_DOCK_FIRST);
|
case STATION_DOCK: return_cmd_error(STR_304D_MUST_DEMOLISH_DOCK_FIRST);
|
||||||
case STATION_OILRIG:
|
case STATION_OILRIG:
|
||||||
|
|
|
@ -387,7 +387,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) goto not_valid_below;
|
if (IsRoadDepot(tile)) goto not_valid_below;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct CFollowTrackT : public FollowTrack_t
|
||||||
/** Tests if a tile is a road tile with a single tramtrack (tram can reverse) */
|
/** Tests if a tile is a road tile with a single tramtrack (tram can reverse) */
|
||||||
FORCEINLINE DiagDirection GetSingleTramBit(TileIndex tile)
|
FORCEINLINE DiagDirection GetSingleTramBit(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (IsTram() && IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsTram() && IsNormalRoadTile(tile)) {
|
||||||
RoadBits rb = GetRoadBits(tile, ROADTYPE_TRAM);
|
RoadBits rb = GetRoadBits(tile, ROADTYPE_TRAM);
|
||||||
switch (rb) {
|
switch (rb) {
|
||||||
case ROAD_NW: return DIAGDIR_NW;
|
case ROAD_NW: return DIAGDIR_NW;
|
||||||
|
|
Loading…
Reference in New Issue