summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 039acf9bd..75e0263f1 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -896,11 +896,13 @@ int32 CmdRemoveSignalTrack(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return CmdSignalTrackHelper(x, y, flags, p1, SETBIT(p2, 0));
}
-typedef int32 DoConvertRailProc(TileIndex tile, uint totype, bool exec);
+typedef int32 DoConvertRailProc(TileIndex tile, RailType totype, bool exec);
-static int32 DoConvertRail(TileIndex tile, uint totype, bool exec)
+static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
{
- if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR;
+ if (!CheckTileOwnership(tile)) return CMD_ERROR;
+
+ if (!EnsureNoVehicle(tile) && (!IsCompatibleRail(GetRailType(tile), totype) || IsPlainRailTile(tile))) return CMD_ERROR;
// tile is already of requested type?
if (GetRailType(tile) == totype) return CMD_ERROR;
@@ -1297,6 +1299,9 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track, bool earth, bool snow,
if (track & TRACK_BIT_LEFT) DrawGroundSprite(rti->base_sprites.single_w);
if (track & TRACK_BIT_RIGHT) DrawGroundSprite(rti->base_sprites.single_e);
}
+
+ if (GB(_m[ti->tile].m3, 0, 4) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
+
}
static void DrawTile_Track(TileInfo *ti)
@@ -1388,6 +1393,8 @@ static void DrawTile_Track(TileInfo *ti)
DrawGroundSprite(image);
+ if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
+
foreach_draw_tile_seq(seq, cust->seq) {
DrawSpecialBuilding(
seq->image + relocation, 0, ti,
@@ -1420,6 +1427,8 @@ static void DrawTile_Track(TileInfo *ti)
DrawGroundSprite(image);
+ if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
+
for (; drss->image != 0; drss++) {
DrawSpecialBuilding(
drss->image, type < 4 ? rti->total_offset : 0, ti,