@@ -463,10 +463,10 @@ public WorldFile(Viewer viewer, int tileX, int tileZ, bool visible)
463463 if ( Program . Simulator . CarSpawnerLists != null && ( ( CarSpawnerObj ) worldObject ) . ListName != null )
464464 {
465465 ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx = Program . Simulator . CarSpawnerLists . FindIndex ( x => x . ListName == ( ( CarSpawnerObj ) worldObject ) . ListName ) ;
466- if ( ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx < 0 || ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx > Program . Simulator . CarSpawnerLists . Count - 1 )
466+ if ( ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx < 0 || ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx > Program . Simulator . CarSpawnerLists . Count - 1 )
467467 ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx = 0 ;
468468 }
469- else
469+ else
470470 ( ( CarSpawnerObj ) worldObject ) . CarSpawnerListIdx = 0 ;
471471 carSpawners . Add ( new RoadCarSpawner ( viewer , worldMatrix , ( CarSpawnerObj ) worldObject ) ) ;
472472 }
@@ -480,9 +480,13 @@ public WorldFile(Viewer viewer, int tileX, int tileZ, bool visible)
480480 }
481481 else if ( worldObject . GetType ( ) == typeof ( StaticObj ) )
482482 {
483- // preTestShape for lookup if it is an animated clock shape with subobjects named as clock hands
483+ // preTestShape for lookup if it is an animated clock shape with subobjects named as clock hands
484484 StaticShape preTestShape = ( new StaticShape ( viewer , shapeFilePath , worldMatrix , shadowCaster ? ShapeFlags . ShadowCaster : ShapeFlags . None ) ) ;
485- var animNodes = preTestShape . SharedShape . Animations ? [ 0 ] ? . anim_nodes ?? new List < anim_node > ( ) ;
485+
486+ // FirstOrDefault() checks for "animations( 0 )" as this is a valid entry in *.s files
487+ // and is included by MSTSexporter for Blender 2.8+ Release V4.0 or older
488+ var animNodes = preTestShape . SharedShape . Animations ? . FirstOrDefault ( ) ? . anim_nodes ?? new List < anim_node > ( ) ;
489+
486490 var isAnimatedClock = animNodes . Exists ( node => Regex . IsMatch ( node . Name , @"^orts_[hmsc]hand_clock" , RegexOptions . IgnoreCase ) ) ;
487491 if ( isAnimatedClock )
488492 {
0 commit comments