@@ -60,7 +60,7 @@ internal static void ParseTrainData(string FileName, System.Text.Encoding Encodi
60
60
}
61
61
}
62
62
TrainDatFormats currentFormat = TrainDatFormats . openBVE ;
63
- const int currentVersion = 15311 ;
63
+ const int currentVersion = 18000 ;
64
64
int myVersion = - 1 ;
65
65
for ( int i = 0 ; i < Lines . Length ; i ++ ) {
66
66
if ( Lines [ i ] . Length > 0 ) {
@@ -152,6 +152,8 @@ internal static void ParseTrainData(string FileName, System.Text.Encoding Encodi
152
152
Train . Handles . EmergencyBrake = new TrainManager . EmergencyHandle ( ) ;
153
153
Train . Handles . HasLocoBrake = false ;
154
154
double [ ] powerDelayUp = { } , powerDelayDown = { } , brakeDelayUp = { } , brakeDelayDown = { } , locoBrakeDelayUp = { } , locoBrakeDelayDown = { } ;
155
+ int numberOfPantographs = 1 ;
156
+ double pantographLocation = - 1 ;
155
157
int powerNotches = 0 , brakeNotches = 0 , locoBrakeNotches = 0 , powerReduceSteps = - 1 , locoBrakeType = 0 , driverPowerNotches = 0 , driverBrakeNotches = 0 ;
156
158
TrainManager . MotorSoundTable [ ] Tables = new TrainManager . MotorSoundTable [ 4 ] ;
157
159
for ( int i = 0 ; i < 4 ; i ++ ) {
@@ -675,6 +677,20 @@ internal static void ParseTrainData(string FileName, System.Text.Encoding Encodi
675
677
} else {
676
678
CarUnexposedFrontalArea = a ;
677
679
} break ;
680
+ case 11 :
681
+ if ( a <= 0.0 )
682
+ {
683
+ Interface . AddMessage ( MessageType . Error , false , "NumberOfPantographs is expected to be positive at line " + ( i + 1 ) . ToString ( Culture ) + " in " + FileName ) ;
684
+ }
685
+ else
686
+ {
687
+ numberOfPantographs = ( int ) a ;
688
+ }
689
+ break ;
690
+ case 12 :
691
+ //Do no validation here, as we don't necessarily yet know the length of a car
692
+ pantographLocation = a ;
693
+ break ;
678
694
}
679
695
} i ++ ; n ++ ;
680
696
} i -- ; break ;
@@ -961,10 +977,18 @@ internal static void ParseTrainData(string FileName, System.Text.Encoding Encodi
961
977
MaximumAcceleration = AccelerationCurves [ i ] . StageOneAcceleration ;
962
978
}
963
979
}
980
+
981
+ if ( pantographLocation < 0 || pantographLocation > CarLength )
982
+ {
983
+ //Pantograph location is relative from the front of the car
984
+ //Somone will probably want to add one outside the physical model, so just warn...
985
+ Interface . AddMessage ( MessageType . Warning , false , "A PantographLocation of " + pantographLocation . ToString ( Culture ) + " places it outside the bounds of the car in file " + FileName ) ;
986
+ }
964
987
// assign motor cars
965
988
if ( MotorCars == 1 ) {
966
989
if ( FrontCarIsMotorCar | TrailerCars == 0 ) {
967
990
Train . Cars [ 0 ] . Specs . IsMotorCar = true ;
991
+ Train . Cars [ 0 ] . Pantograph = new TrackFollower ( Program . CurrentHost ) ;
968
992
} else {
969
993
Train . Cars [ Cars - 1 ] . Specs . IsMotorCar = true ;
970
994
}
@@ -1184,15 +1208,9 @@ internal static void ParseTrainData(string FileName, System.Text.Encoding Encodi
1184
1208
{
1185
1209
Train . Cars [ i ] . Coupler = new TrainManager . Coupler ( 0.9 * DistanceBetweenTheCars , 1.1 * DistanceBetweenTheCars , Train . Cars [ i / 2 ] , null , Train ) ;
1186
1210
}
1187
-
1188
- Train . Cars [ i ] . CurrentCarSection = - 1 ;
1189
- Train . Cars [ i ] . ChangeCarSection ( CarSectionType . NotVisible ) ;
1190
- Train . Cars [ i ] . FrontBogie . ChangeSection ( - 1 ) ;
1191
- Train . Cars [ i ] . RearBogie . ChangeSection ( - 1 ) ;
1192
- Train . Cars [ i ] . Coupler . ChangeSection ( - 1 ) ;
1211
+
1193
1212
Train . Cars [ i ] . FrontAxle . Follower . TriggerType = i == 0 ? EventTriggerType . FrontCarFrontAxle : EventTriggerType . OtherCarFrontAxle ;
1194
1213
Train . Cars [ i ] . RearAxle . Follower . TriggerType = i == Cars - 1 ? EventTriggerType . RearCarRearAxle : EventTriggerType . OtherCarRearAxle ;
1195
- Train . Cars [ i ] . BeaconReceiver . TriggerType = i == 0 ? EventTriggerType . TrainFront : EventTriggerType . None ;
1196
1214
Train . Cars [ i ] . BeaconReceiverPosition = 0.5 * CarLength ;
1197
1215
Train . Cars [ i ] . FrontAxle . Follower . Car = Train . Cars [ i ] ;
1198
1216
Train . Cars [ i ] . RearAxle . Follower . Car = Train . Cars [ i ] ;
0 commit comments