@@ -423,21 +423,30 @@ public LightCollection(STFReader stf)
423423 Lights . Add ( new Light ( light , true ) ) ;
424424
425425 // Determine which, if any, conditions are ignored by all conditions of all lights
426- IgnoredConditions [ 0 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Headlight == LightHeadlightCondition . Ignore ) ) ;
427- IgnoredConditions [ 1 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Unit == LightUnitCondition . Ignore ) ) ;
428- IgnoredConditions [ 2 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Penalty == LightPenaltyCondition . Ignore ) ) ;
429- IgnoredConditions [ 3 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Control == LightControlCondition . Ignore ) ) ;
430- IgnoredConditions [ 4 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Service == LightServiceCondition . Ignore ) ) ;
431- IgnoredConditions [ 5 ] = Lights . All ( light => light . Conditions . All ( cond => cond . TimeOfDay == LightTimeOfDayCondition . Ignore ) ) ;
432- IgnoredConditions [ 6 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Weather == LightWeatherCondition . Ignore ) ) ;
433- IgnoredConditions [ 7 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Coupling == LightCouplingCondition . Ignore ) ) ;
434- IgnoredConditions [ 8 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Battery == LightBatteryCondition . Ignore ) ) ;
435- IgnoredConditions [ 9 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Brake == LightBrakeCondition . Ignore ) ) ;
436- IgnoredConditions [ 10 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Reverser == LightReverserCondition . Ignore ) ) ;
437- IgnoredConditions [ 11 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Doors == LightDoorsCondition . Ignore ) ) ;
438- IgnoredConditions [ 12 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Horn == LightHornCondition . Ignore ) ) ;
439- IgnoredConditions [ 13 ] = Lights . All ( light => light . Conditions . All ( cond => cond . Bell == LightBellCondition . Ignore ) ) ;
440- IgnoredConditions [ 14 ] = Lights . All ( light => light . Conditions . All ( cond => cond . MU == LightMUCondition . Ignore ) ) ;
426+ // Assume all conditions are ignored unless determined otherwise
427+ for ( int i = 0 ; i < IgnoredConditions . Length ; i ++ )
428+ IgnoredConditions [ i ] = true ;
429+ foreach ( Light light in Lights )
430+ {
431+ foreach ( LightCondition condition in light . Conditions )
432+ {
433+ IgnoredConditions [ 0 ] &= condition . Headlight == LightHeadlightCondition . Ignore ;
434+ IgnoredConditions [ 1 ] &= condition . Unit == LightUnitCondition . Ignore ;
435+ IgnoredConditions [ 2 ] &= condition . Penalty == LightPenaltyCondition . Ignore ;
436+ IgnoredConditions [ 3 ] &= condition . Control == LightControlCondition . Ignore ;
437+ IgnoredConditions [ 4 ] &= condition . Service == LightServiceCondition . Ignore ;
438+ IgnoredConditions [ 5 ] &= condition . TimeOfDay == LightTimeOfDayCondition . Ignore ;
439+ IgnoredConditions [ 6 ] &= condition . Weather == LightWeatherCondition . Ignore ;
440+ IgnoredConditions [ 7 ] &= condition . Coupling == LightCouplingCondition . Ignore ;
441+ IgnoredConditions [ 8 ] &= condition . Battery == LightBatteryCondition . Ignore ;
442+ IgnoredConditions [ 9 ] &= condition . Brake == LightBrakeCondition . Ignore ;
443+ IgnoredConditions [ 10 ] &= condition . Reverser == LightReverserCondition . Ignore ;
444+ IgnoredConditions [ 11 ] &= condition . Doors == LightDoorsCondition . Ignore ;
445+ IgnoredConditions [ 12 ] &= condition . Horn == LightHornCondition . Ignore ;
446+ IgnoredConditions [ 13 ] &= condition . Bell == LightBellCondition . Ignore ;
447+ IgnoredConditions [ 14 ] &= condition . MU == LightMUCondition . Ignore ;
448+ }
449+ }
441450 }
442451 }
443452}
0 commit comments