Skip to content

Commit b1517ee

Browse files
committed
More clean up
1 parent d663400 commit b1517ee

File tree

8 files changed

+18
-11
lines changed

8 files changed

+18
-11
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,9 @@ public FreightAnimationContinuous(STFReader stf, MSTSWagon wagon)
10411041
}),
10421042
new STFReader.TokenProcessor("flip", ()=>{ Flipped = stf.ReadBoolBlock(true);}),
10431043
new STFReader.TokenProcessor("shapeindex", ()=>{ ShapeIndex = stf.ReadIntBlock(null);}),
1044+
new STFReader.TokenProcessor("ortsshapeindex", ()=>{ ShapeIndex = stf.ReadIntBlock(null);}),
10441045
new STFReader.TokenProcessor("shapehierarchy", ()=>{ ShapeHierarchy = stf.ReadStringBlock(null);}),
1046+
new STFReader.TokenProcessor("ortsshapehierarchy", ()=>{ ShapeHierarchy = stf.ReadStringBlock(null);}),
10451047
new STFReader.TokenProcessor("visibility", ()=>{
10461048
for (int index = 0; index < 3; index++)
10471049
Visibility[index] = false;
@@ -1158,7 +1160,9 @@ public FreightAnimationStatic(STFReader stf)
11581160
}),
11591161
new STFReader.TokenProcessor("flip", ()=>{ Flipped = stf.ReadBoolBlock(true);}),
11601162
new STFReader.TokenProcessor("shapeindex", ()=>{ ShapeIndex = stf.ReadIntBlock(null);}),
1163+
new STFReader.TokenProcessor("ortsshapeindex", ()=>{ ShapeIndex = stf.ReadIntBlock(null);}),
11611164
new STFReader.TokenProcessor("shapehierarchy", ()=>{ ShapeHierarchy = stf.ReadStringBlock(null);}),
1165+
new STFReader.TokenProcessor("ortsshapehierarchy", ()=>{ ShapeHierarchy = stf.ReadStringBlock(null);}),
11621166
new STFReader.TokenProcessor("visibility", ()=>{
11631167
for (int index = 0; index < 3; index++)
11641168
Visibility[index] = false;

Source/RunActivity/Viewer3D/Lights.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public LightViewer(Viewer viewer, TrainCar car, TrainCarViewer carViewer)
125125
}
126126
else
127127
{
128-
if (light.ShapeHierarchy != null)
128+
if (!String.IsNullOrEmpty(light.ShapeHierarchy))
129129
{
130130
if ((CarViewer as MSTSWagonViewer).TrainCarShape.SharedShape.MatrixNames.Contains(light.ShapeHierarchy))
131131
{

Source/RunActivity/Viewer3D/ParticleEmitter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public ParticleEmitterPrimitive(Viewer viewer, ParticleEmitterData data, MSTSWag
258258
}
259259
else
260260
{
261-
if (EmitterData.ShapeHierarchy != null)
261+
if (!String.IsNullOrEmpty(EmitterData.ShapeHierarchy))
262262
{
263263
if (CarViewer.TrainCarShape.SharedShape.MatrixNames.Contains(EmitterData.ShapeHierarchy))
264264
{

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ public CabRenderer(Viewer viewer, MSTSLocomotiveViewer carViewer)
13581358
}
13591359
else
13601360
{
1361-
if (view.ShapeHierarchy != null)
1361+
if (!String.IsNullOrEmpty(view.ShapeHierarchy))
13621362
{
13631363
if (carViewer.TrainCarShape.SharedShape.MatrixNames.Contains(view.ShapeHierarchy))
13641364
{

Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ from data in effect.Value
448448
}
449449
else
450450
{
451-
if (view.ShapeHierarchy != null)
451+
if (!String.IsNullOrEmpty(view.ShapeHierarchy))
452452
{
453453
if (TrainCarShape.SharedShape.MatrixNames.Contains(view.ShapeHierarchy))
454454
{

Source/RunActivity/Viewer3D/RollingStock/SubSystems/FreightAnimationsViewer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
1717

18+
using System;
19+
using System.Collections.Generic;
20+
using System.Diagnostics;
21+
using System.Linq;
1822
using Microsoft.Xna.Framework;
1923
using Orts.Simulation.RollingStocks;
2024
using Orts.Simulation.RollingStocks.SubSystems;
2125
using ORTS.Common;
22-
using System.Collections.Generic;
23-
using System.Diagnostics;
24-
using System.Linq;
2526

2627
namespace Orts.Viewer3D.RollingStock.SubSystems
2728
{
@@ -94,7 +95,7 @@ public FreightAnimationViewer(Viewer viewer, MSTSWagonViewer wagonViewer, string
9495
}
9596
else
9697
{
97-
if (Animation.ShapeHierarchy != null)
98+
if (!String.IsNullOrEmpty(Animation.ShapeHierarchy))
9899
{
99100
if (wagonViewer.TrainCarShape.SharedShape.MatrixNames.Contains(Animation.ShapeHierarchy))
100101
{

Source/RunActivity/Viewer3D/Shapes.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,10 +2131,12 @@ void LoadContent()
21312131
else if (LodControls[0].DistanceLevels.Length > 0 && LodControls[0].DistanceLevels[0].SubObjects.Length > 0)
21322132
{
21332133
// Zero the position offset of the root matrix for compatibility with MSTS, unless modified thru SD file
2134-
if (!adjustMAIN && LodControls[0].DistanceLevels[0].SubObjects[0].ShapePrimitives.Length > 0 &&
2134+
if (LodControls[0].DistanceLevels[0].SubObjects[0].ShapePrimitives.Length > 0 &&
21352135
LodControls[0].DistanceLevels[0].SubObjects[0].ShapePrimitives[0].Hierarchy[0] == -1)
21362136
{
2137-
Matrices[0].Translation = Vector3.Zero;
2137+
Matrices[0].M41 = 0;
2138+
Matrices[0].M42 = 0;
2139+
Matrices[0].M43 = 0;
21382140
}
21392141
// Look for root subobject, it is not necessarily the first (see ProTrain signal)
21402142
for (int soIndex = 0; soIndex <= LodControls[0].DistanceLevels[0].SubObjects.Length - 1; soIndex++)

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ public void Initialize(Viewer viewer, WorldLocation worldLocation, Events.Source
757757
}
758758
else
759759
{
760-
if (mstsStream.ShapeHierarchy != null)
760+
if (!String.IsNullOrEmpty(mstsStream.ShapeHierarchy))
761761
{
762762
if (CarViewer.TrainCarShape.SharedShape.MatrixNames.Contains(mstsStream.ShapeHierarchy))
763763
{

0 commit comments

Comments
 (0)