420 /* determine whether the new state is red */ |
420 /* determine whether the new state is red */ |
421 if (flags & SF_TRAIN) { |
421 if (flags & SF_TRAIN) { |
422 /* train in the segment */ |
422 /* train in the segment */ |
423 newstate = SIGNAL_STATE_RED; |
423 newstate = SIGNAL_STATE_RED; |
424 } else { |
424 } else { |
425 /* is it a bidir combo? - then do not count its other signal direction as exit */ |
425 /* is it a bidir combo? - then do not count its other signal direction as exit */ |
426 if (sig == SIGTYPE_COMBO && HasSignalOnTrackdir(tile, ReverseTrackdir(trackdir))) { |
426 if (sig == SIGTYPE_COMBO && HasSignalOnTrackdir(tile, ReverseTrackdir(trackdir))) { |
427 /* at least one more exit */ |
427 /* at least one more exit */ |
428 if (flags & SF_EXIT2 && |
428 if (flags & SF_EXIT2 && |
429 /* no green exit */ |
429 /* no green exit */ |
430 (!(flags & SF_GREEN) || |
430 (!(flags & SF_GREEN) || |
431 /* only one green exit, and it is this one - so all other exits are red */ |
431 /* only one green exit, and it is this one - so all other exits are red */ |
432 (!(flags & SF_GREEN2) && GetSignalStateByTrackdir(tile, ReverseTrackdir(trackdir)) == SIGNAL_STATE_GREEN))) { |
432 (!(flags & SF_GREEN2) && GetSignalStateByTrackdir(tile, ReverseTrackdir(trackdir)) == SIGNAL_STATE_GREEN))) { |
433 newstate = SIGNAL_STATE_RED; |
433 newstate = SIGNAL_STATE_RED; |
434 } |
434 } |
505 } |
505 } |
506 /* FALLTHROUGH */ |
506 /* FALLTHROUGH */ |
507 case MP_STATION: |
507 case MP_STATION: |
508 case MP_ROAD: |
508 case MP_ROAD: |
509 if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & _enterdir_to_trackbits[dir]) != TRACK_BIT_NONE) { |
509 if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & _enterdir_to_trackbits[dir]) != TRACK_BIT_NONE) { |
510 /* only add to set when there is some 'interesting' track */ |
510 /* only add to set when there is some 'interesting' track */ |
511 _tbdset.Add(tile, dir); |
511 _tbdset.Add(tile, dir); |
512 _tbdset.Add(tile + TileOffsByDiagDir(dir), ReverseDiagDir(dir)); |
512 _tbdset.Add(tile + TileOffsByDiagDir(dir), ReverseDiagDir(dir)); |
513 break; |
513 break; |
514 } |
514 } |
515 /* FALLTHROUGH */ |
515 /* FALLTHROUGH */ |