Skip to content

Commit 1615f09

Browse files
authored
Merge pull request #894 from Roeterdink/CorrectDecreaseColour
2 parents b90893b + 5ff1e73 commit 1615f09

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,11 +894,19 @@ public CVCDigital(STFReader stf, string basepath)
894894
}),
895895
new STFReader.TokenProcessor("decreasecolour", ()=>{
896896
stf.MustMatch("(");
897-
stf.ReadInt(0);
897+
int NumColor = stf.ReadInt(0);
898898
if(stf.EndOfBlock() == false)
899899
{
900-
stf.ParseBlock(new STFReader.TokenProcessor[] {
901-
new STFReader.TokenProcessor("controlcolour", ()=>{ DecreaseColor = ParseControlColor(stf); }) });
900+
if (NumColor == 0)
901+
{
902+
// no. of colors is set as 0 and therefor no color is defined, but if set anyway, it must be skipped
903+
stf.SkipRestOfBlock();
904+
}
905+
else
906+
{
907+
stf.ParseBlock(new STFReader.TokenProcessor[] {
908+
new STFReader.TokenProcessor("controlcolour", ()=>{ DecreaseColor = ParseControlColor(stf); }) });
909+
}
902910
}
903911
}),
904912
new STFReader.TokenProcessor("ortsfont", ()=>{ParseFont(stf); }),

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,6 +3079,7 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
30793079
// <CSComment> Now speedometer is handled like the other digitals
30803080

30813081
base.PrepareFrame(frame, elapsedTime);
3082+
digital.OldValue = Num;
30823083
}
30833084

30843085
public override void Draw(GraphicsDevice graphicsDevice)
@@ -3152,6 +3153,8 @@ public string GetDigits(out Color DrawColor)
31523153
displayedText = String.Format(Format, Num);
31533154
DrawColor = Color.White;
31543155
}
3156+
digital.OldValue = Num;
3157+
31553158
// <CSComment> Speedometer is now managed like the other digitals
31563159

31573160
return displayedText;
@@ -3228,6 +3231,8 @@ public string GetDigits(out Color DrawColor)
32283231
{
32293232
displayedText = String.Format(Format, Num);
32303233
}
3234+
digital.OldValue = Num;
3235+
32313236
// <CSComment> Speedometer is now managed like the other digitals
32323237

32333238
return displayedText;

0 commit comments

Comments
 (0)