Merge remote-tracking branch 'upstream/1.11' into 1.11
This commit is contained in:
@@ -1423,8 +1423,23 @@ void DrawRoadTypeCatenary(const TileInfo *ti, RoadType rt, RoadBits rb)
|
||||
* For tiles with OWNER_TOWN or OWNER_NONE, recolour CC to grey as a neutral colour. */
|
||||
Owner owner = GetRoadOwner(ti->tile, GetRoadTramType(rt));
|
||||
PaletteID pal = (owner == OWNER_NONE || owner == OWNER_TOWN ? GENERAL_SPRITE_COLOUR(COLOUR_GREY) : COMPANY_SPRITE_COLOUR(owner));
|
||||
if (back != 0) AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_CATENARY));
|
||||
if (front != 0) AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_CATENARY));
|
||||
int z_wires = (ti->tileh == SLOPE_FLAT ? 0 : TILE_HEIGHT) + BB_HEIGHT_UNDER_BRIDGE;
|
||||
if (back != 0) {
|
||||
/* The "back" sprite contains the west, north and east pillars.
|
||||
* We cut the sprite at 3/8 of the west/east edges to create 3 sprites.
|
||||
* 3/8 is chosen so that sprites can somewhat graphically extend into the tile. */
|
||||
static const int INF = 1000; ///< big number compared to sprite size
|
||||
static const SubSprite west = { -INF, -INF, -12, INF };
|
||||
static const SubSprite north = { -12, -INF, 12, INF };
|
||||
static const SubSprite east = { 12, -INF, INF, INF };
|
||||
AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 16, 1, z_wires, ti->z, IsTransparencySet(TO_CATENARY), 15, 0, GetSlopePixelZInCorner(ti->tileh, CORNER_W), &west);
|
||||
AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 1, 1, z_wires, ti->z, IsTransparencySet(TO_CATENARY), 0, 0, GetSlopePixelZInCorner(ti->tileh, CORNER_N), &north);
|
||||
AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 1, 16, z_wires, ti->z, IsTransparencySet(TO_CATENARY), 0, 15, GetSlopePixelZInCorner(ti->tileh, CORNER_E), &east);
|
||||
}
|
||||
if (front != 0) {
|
||||
/* Draw the "front" sprite (containing south pillar and wires) at a Z height that is both above the vehicles and above the "back" pillars. */
|
||||
AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, z_wires + 1, ti->z, IsTransparencySet(TO_CATENARY), 0, 0, z_wires);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1917,7 +1932,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||
if (GetFoundationSlope(tile) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) {
|
||||
StartRoadWorks(tile);
|
||||
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_21_JACKHAMMER, tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_21_ROAD_WORKS, tile);
|
||||
CreateEffectVehicleAbove(
|
||||
TileX(tile) * TILE_SIZE + 7,
|
||||
TileY(tile) * TILE_SIZE + 7,
|
||||
@@ -2291,7 +2306,7 @@ static bool CanConvertUnownedRoadType(Owner owner, RoadTramType rtt)
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the ownership of the RoadType of the tile if applyable
|
||||
* Convert the ownership of the RoadType of the tile if applicable
|
||||
* @param tile the tile of which convert ownership
|
||||
* @param num_pieces the count of the roadbits to assign to the new owner
|
||||
* @param owner the current owner of the RoadType
|
||||
@@ -2428,11 +2443,9 @@ CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
cost.AddCost(num_pieces * RoadConvertCost(from_type, to_type));
|
||||
|
||||
if (flags & DC_EXEC) { // we can safely convert, too
|
||||
/* Update the company infrastructure counters. */
|
||||
/* Call ConvertRoadTypeOwner() to update the company infrastructure counters. */
|
||||
if (owner == _current_company) {
|
||||
Company * c = Company::Get(_current_company);
|
||||
c->infrastructure.road[from_type] -= num_pieces;
|
||||
c->infrastructure.road[to_type] += num_pieces;
|
||||
ConvertRoadTypeOwner(tile, num_pieces, owner, from_type, to_type);
|
||||
}
|
||||
|
||||
/* Perform the conversion */
|
||||
|
||||
Reference in New Issue
Block a user