diff options
author | celestar <celestar@openttd.org> | 2006-03-24 15:24:16 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-03-24 15:24:16 +0000 |
commit | 842eac5d7fb8c5408f75797f243876dc20a1454e (patch) | |
tree | 3b4d33841e65351365a09bb79e14272d518bca1b /road_cmd.c | |
parent | 0977a8a04e9c28d714a6b599d19bc8006f39ca03 (diff) | |
download | openttd-842eac5d7fb8c5408f75797f243876dc20a1454e.tar.xz |
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
Diffstat (limited to 'road_cmd.c')
-rw-r--r-- | road_cmd.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/road_cmd.c b/road_cmd.c index 82284a7f9..fcc7ecd7a 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -776,7 +776,7 @@ static void DrawTile_Road(TileInfo *ti) if (GetCrossingRoadAxis(ti->tile) == AXIS_X) image++; - if ((ti->map5 & 4) != 0) image += 2; + if (IsCrossingBarred(ti->tile)) image += 2; if ( _m[ti->tile].m4 & 0x80) { image += 8; @@ -1059,10 +1059,10 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y) { switch (GetRoadType(tile)) { case ROAD_CROSSING: - if (v->type == VEH_Train && GB(_m[tile].m5, 2, 1) == 0) { + if (v->type == VEH_Train && !IsCrossingBarred(tile)) { /* train crossing a road */ SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v); - SB(_m[tile].m5, 2, 1, 1); + BarCrossing(tile); MarkTileDirtyByTile(tile); } break; @@ -1084,8 +1084,7 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y) static void VehicleLeave_Road(Vehicle *v, TileIndex tile, int x, int y) { if (IsLevelCrossing(tile) && v->type == VEH_Train && v->next == NULL) { - // Turn off level crossing lights - SB(_m[tile].m5, 2, 1, 0); + UnbarCrossing(tile); MarkTileDirtyByTile(tile); } } |