@@ -120,7 +120,6 @@ public enum WindowState
120120
121121 // wag file data
122122 public string MainShapeFileName ;
123- public string WagonName ;
124123 public string FreightShapeFileName ;
125124 public float FreightAnimMaxLevelM ;
126125 public float FreightAnimMinLevelM ;
@@ -411,41 +410,41 @@ public virtual void LoadFromWagFile(string wagFilePath)
411410 var wagonFolderSlash = Path . GetDirectoryName ( WagFilePath ) + @"\" ;
412411 if ( MainShapeFileName != null && ! File . Exists ( wagonFolderSlash + MainShapeFileName ) )
413412 {
414- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + MainShapeFileName ) ;
413+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + MainShapeFileName ) ;
415414 MainShapeFileName = string . Empty ;
416415 }
417416 if ( FreightShapeFileName != null && ! File . Exists ( wagonFolderSlash + FreightShapeFileName ) )
418417 {
419- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + FreightShapeFileName ) ;
418+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + FreightShapeFileName ) ;
420419 FreightShapeFileName = null ;
421420 }
422421 if ( InteriorShapeFileName != null && ! File . Exists ( wagonFolderSlash + InteriorShapeFileName ) )
423422 {
424- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + InteriorShapeFileName ) ;
423+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + InteriorShapeFileName ) ;
425424 InteriorShapeFileName = null ;
426425 }
427426
428427 if ( FrontCoupler . Closed . ShapeFileName != null && ! File . Exists ( wagonFolderSlash + FrontCoupler . Closed . ShapeFileName ) )
429428 {
430- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + FrontCoupler . Closed . ShapeFileName ) ;
429+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + FrontCoupler . Closed . ShapeFileName ) ;
431430 FrontCoupler . Closed . ShapeFileName = null ;
432431 }
433432
434433 if ( RearCoupler . Closed . ShapeFileName != null && ! File . Exists ( wagonFolderSlash + RearCoupler . Closed . ShapeFileName ) )
435434 {
436- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + RearCoupler . Closed . ShapeFileName ) ;
435+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + RearCoupler . Closed . ShapeFileName ) ;
437436 RearCoupler . Closed . ShapeFileName = null ;
438437 }
439438
440439 if ( FrontAirHose . Connected . ShapeFileName != null && ! File . Exists ( wagonFolderSlash + FrontAirHose . Connected . ShapeFileName ) )
441440 {
442- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + FrontAirHose . Connected . ShapeFileName ) ;
441+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + FrontAirHose . Connected . ShapeFileName ) ;
443442 FrontAirHose . Connected . ShapeFileName = null ;
444443 }
445444
446445 if ( RearAirHose . Connected . ShapeFileName != null && ! File . Exists ( wagonFolderSlash + RearAirHose . Connected . ShapeFileName ) )
447446 {
448- Trace . TraceWarning ( "{0} references non-existent shape {1}" , shortPath , wagonFolderSlash + RearAirHose . Connected . ShapeFileName ) ;
447+ Trace . TraceWarning ( "{0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + RearAirHose . Connected . ShapeFileName ) ;
449448 RearAirHose . Connected . ShapeFileName = null ;
450449 }
451450
@@ -555,7 +554,7 @@ public virtual void LoadFromWagFile(string wagFilePath)
555554 FormatStrings . FormatVeryShortDistanceDisplay ( mainMins . Z , IsMetric ) ,
556555 FormatStrings . FormatVeryShortDistanceDisplay ( mainMaxes . Z , IsMetric ) ) ;
557556 else
558- Trace . TraceInformation ( "Main shape file {0} bounds calculated to be {1} to {2}. CoG offset used to center shape is {0 }.\n " ,
557+ Trace . TraceInformation ( "Main shape file {0} bounds calculated to be {1} to {2}. CoG offset used to center shape is {3 }.\n " ,
559558 MainShapeFileName ,
560559 FormatStrings . FormatVeryShortDistanceDisplay ( mainMins . Z , IsMetric ) ,
561560 FormatStrings . FormatVeryShortDistanceDisplay ( mainMaxes . Z , IsMetric ) ,
@@ -626,7 +625,7 @@ public virtual void LoadFromWagFile(string wagFilePath)
626625
627626 if ( Simulator . Settings . VerboseConfigurationMessages )
628627 {
629- Trace . TraceInformation ( "Derailment Coefficient set to false for Wagon {0}" , shortPath ) ;
628+ Trace . TraceInformation ( "Derailment Coefficient set to false for Wagon {0}" , WagFilePath ) ;
630629 }
631630 }
632631
@@ -644,7 +643,7 @@ public virtual void LoadFromWagFile(string wagFilePath)
644643
645644 if ( Simulator . Settings . VerboseConfigurationMessages )
646645 {
647- Trace . TraceInformation ( "Number of Wagon Axles set to default value of {0} on Wagon {1}" , WagonNumAxles , shortPath ) ;
646+ Trace . TraceInformation ( "Number of Wagon Axles set to default value of {0} on Wagon {1}" , WagonNumAxles , WagFilePath ) ;
648647 }
649648 }
650649 else
@@ -781,7 +780,7 @@ public virtual void LoadFromWagFile(string wagFilePath)
781780 {
782781 if ( ortsFreightAnim . ShapeFileName != null && ! File . Exists ( wagonFolderSlash + ortsFreightAnim . ShapeFileName ) )
783782 {
784- Trace . TraceWarning ( "ORTS FreightAnim in trainset {0} references non-existent shape {1}" , file , wagonFolderSlash + ortsFreightAnim . ShapeFileName ) ;
783+ Trace . TraceWarning ( "ORTS FreightAnim in trainset {0} references non-existent shape {1}" , wagFilePath , wagonFolderSlash + ortsFreightAnim . ShapeFileName ) ;
785784 ortsFreightAnim . ShapeFileName = null ;
786785 }
787786
@@ -1295,7 +1294,6 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
12951294 STFException . TraceWarning ( stf , "Skipped unknown wagon type " + wagonType ) ;
12961295 }
12971296 break ;
1298- case "wagon(name" : WagonName = stf . ReadStringBlock ( null ) ; break ;
12991297 case "wagon(ortswagonspecialtype" :
13001298 stf . MustMatch ( "(" ) ;
13011299 var wagonspecialType = stf . ReadString ( ) ;
@@ -1355,16 +1353,12 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
13551353 break ;
13561354 case "wagon(centerofgravity" :
13571355 case "wagon(centreofgravity" :
1358- stf . MustMatch ( "(" ) ;
1359- InitialCentreOfGravityM . X = stf . ReadFloat ( STFReader . UNITS . Distance , null ) ;
1360- InitialCentreOfGravityM . Y = stf . ReadFloat ( STFReader . UNITS . Distance , null ) ;
1361- InitialCentreOfGravityM . Z = stf . ReadFloat ( STFReader . UNITS . Distance , null ) ;
1356+ InitialCentreOfGravityM = stf . ReadVector3Block ( STFReader . UNITS . Distance , Vector3 . Zero ) ;
13621357 if ( Math . Abs ( InitialCentreOfGravityM . Z ) > 2 )
13631358 {
13641359 STFException . TraceWarning ( stf , string . Format ( "CentreOfGravity Z set to zero because value {0} outside range -2 to +2" , InitialCentreOfGravityM . Z ) ) ;
13651360 InitialCentreOfGravityM . Z = 0 ;
13661361 }
1367- stf . SkipRestOfBlock ( ) ;
13681362 break ;
13691363 case "wagon(ortscenterofgravity_x" :
13701364 case "wagon(ortscentreofgravity_x" : InitialCentreOfGravityM . X = stf . ReadFloatBlock ( STFReader . UNITS . Distance , null ) ; break ;
0 commit comments