1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-25 15:39:09 +00:00

(svn r2433) - CodeChange: unmagicify all road/train crossings with IsLevelCrossing() function (peter1138)

This commit is contained in:
Darkvater
2005-06-07 21:37:00 +00:00
parent fa8f46c0b7
commit 0171aae109
9 changed files with 26 additions and 21 deletions

View File

@@ -1258,7 +1258,7 @@ static void *TestTrainOnCrossing(Vehicle *v, void *data)
static void DisableTrainCrossing(TileIndex tile)
{
/* Test if we have a rail/road-crossing */
if (IsTileType(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) {
if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) {
/* Check if there is a train on the tile itself */
if (VehicleFromPos(tile, &tile, TestTrainOnCrossing) == NULL) {
/* If light is on, switch light off */
@@ -3082,7 +3082,7 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
}
if ((ts &= (ts >> 16)) == 0) {
// make a rail/road crossing red
if (IsTileType(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) {
if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) {
if (!(_map5[tile] & 4)) {
_map5[tile] |= 4;
SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v);