diff options
author | celestar <celestar@openttd.org> | 2006-03-29 16:30:26 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-03-29 16:30:26 +0000 |
commit | a7d8ad0004e00e1d917d636f4d69fd58f5edbfa3 (patch) | |
tree | c1903bfd394f761768fa9d907c58a76229e1b2f8 /rail_cmd.c | |
parent | 9c96bcb9975c4f9e197cebf0562f81de5be99b5b (diff) | |
download | openttd-a7d8ad0004e00e1d917d636f4d69fd58f5edbfa3.tar.xz |
(svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
Diffstat (limited to 'rail_cmd.c')
-rw-r--r-- | rail_cmd.c | 15 |
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, |