Skip to content

Commit cb0f218

Browse files
committed
Clean up code from cherry pick
1 parent fe2433b commit cb0f218

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

Source/Orts.Common/Conversions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public static class NpM
260260
/// <summary>
261261
/// Resistance conversions from and to Newtons/metre/sec
262262
/// </summary>
263-
public static class NSpM
263+
public static class NpMpS
264264
{
265265
}
266266

@@ -576,12 +576,8 @@ public static class FormatStrings
576576
public static string f = Catalog.GetString("°F");
577577
public static string n = Catalog.GetString("N");
578578
public static string kN = Catalog.GetString("kN");
579-
public static string nspm = Catalog.GetString("N/m/s");
580-
public static string nsspmm = Catalog.GetString("N/(m/s)²");
581579
public static string lbf = Catalog.GetString("lbf");
582580
public static string klbf = Catalog.GetString("klbf");
583-
public static string lbfpmph = Catalog.GetString("lbf/mph");
584-
public static string lbfpmph2 = Catalog.GetString("lbf/mph²");
585581
public static string deg = Catalog.GetString("°");
586582

587583
/// <summary>

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/FreightAnimations.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,10 @@ public string FADiscretesString()
972972
public abstract class FreightAnimation
973973
{
974974
public string ShapeFileName;
975+
public bool Flipped = false;
976+
public Vector3 Offset = new Vector3();
977+
public int ShapeIndex = -1;
978+
public string ShapeHierarchy;
975979
}
976980

977981
public class FreightAnimationContinuous : FreightAnimation

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public abstract class TrainCar
112112

113113
// sound related variables
114114
public bool IsPartOfActiveTrain = true;
115+
public List<int> SoundSourceIDs = new List<int>();
115116

116117
public IPowerSupply PowerSupply;
117118

0 commit comments

Comments
 (0)