Skip to content

Commit 18f1a65

Browse files
committed
remove unnecessary state from transfer table class
1 parent 2b21ff7 commit 18f1a65

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Source/Orts.Simulation/Simulation/Transfertables.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ public class Transfertable : MovingTable
4242
{
4343
public float Span; // horizontal or vertical
4444
public List<float> Offsets = new List<float>();
45-
public float CenterOffsetComponent = 0;
4645
private bool VerticalTransfer = false;
46+
public float CenterOffsetComponent
47+
{
48+
get => VerticalTransfer ? CenterOffset.Y : CenterOffset.X;
49+
}
4750
// Dynamic data
4851
public bool Forward; // forward motion on
4952
public bool Reverse; // reverse motion on
@@ -154,12 +157,12 @@ protected void InitializeOffsetsAndTrackNodes()
154157
}
155158
if (VerticalTransfer)
156159
{
157-
OffsetPos = CenterOffsetComponent = CenterOffset.Y;
160+
OffsetPos = CenterOffset.Y;
158161
Span = (float)(trackShape.SectionIdxs[trackShape.SectionIdxs.Length - 1].Y - trackShape.SectionIdxs[0].Y);
159162
}
160163
else
161164
{
162-
OffsetPos = CenterOffsetComponent = CenterOffset.X;
165+
OffsetPos = CenterOffset.X;
163166
Span = (float)(trackShape.SectionIdxs[trackShape.SectionIdxs.Length - 1].X - trackShape.SectionIdxs[0].X);
164167
}
165168
}

0 commit comments

Comments
 (0)