Skip to content

Commit

Permalink
Fixed bug with S train type having number > 9
Browse files Browse the repository at this point in the history
S Train type with numbers 10 or higher did not display correctly on the
SNCB template
  • Loading branch information
Tom committed Jul 30, 2016
1 parent 1828184 commit ca6ab0d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RailtimeScreenSaver/RailtimeScreenSaver.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<ApplicationVersion>1.1.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion RailtimeScreenSaver/SNCB.vb
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ Public Class SNCB

Dim TrainTypeFlags As TrainData.TrainTypeFlags = RailtimeScreenSaver.TrainData.TrainTypeFlags.TrainTypeNormal

If TrainType Like "S#" Then
If TrainType Like "S#" OrElse TrainType Like "S##" Then
TrainTypeFlags = TrainTypeFlags Or RailtimeScreenSaver.TrainData.TrainTypeFlags.TrainTypeSBahn
Else
If InStr(TrainDestination, "airport", CompareMethod.Text) > 0 OrElse _
Expand Down
5 changes: 3 additions & 2 deletions RailtimeScreenSaver/Templates.vb
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ Public Class SNCBTemplate
Dim STrainType As String = Mid(Train.Type, 2)
Dim STrainTypeFont As New Font(TrainFont.FontFamily, TrainFont.Size * 3 / 4)
Dim TrainTypeSize As SizeF = Graphics.MeasureString("S", TrainFont)
Dim STrainTypeSize As SizeF = Graphics.MeasureString(STrainType, STrainTypeFont)
Dim STrainTypeCricle As New RectangleF(TrackRect.X - BorderWidth - STrainTypeSize.Width * 5 / 4, TrackRect.Y + TrainTypeSize.Height * 1 / 4, STrainTypeSize.Width * 2 / STrainType.Length * 4 / 5, STrainTypeSize.Width * 2 / STrainType.Length * 4 / 5)
Dim STrainTypeSize As SizeF = Graphics.MeasureString("0", STrainTypeFont) ' STrainType, STrainTypeFont)
Dim STrainTypeCricle As New RectangleF(TrackRect.X - BorderWidth - STrainTypeSize.Width * 5 / 4, TrackRect.Y + TrainTypeSize.Height * 1 / 4, STrainTypeSize.Width * 2 * 4 / 5, STrainTypeSize.Width * 2 * 4 / 5)
Graphics.DrawString("S", TrainFont, m_ForeColorBrush, TrackRect.X - BorderWidth - TrainTypeSize.Width - STrainTypeSize.Width, TrackRect.Y)
'Graphics.DrawString("S", TrainFont, m_ForeColorBrush, TrackRect.X - BorderWidth - TrainTypeSize.Width - STrainTypeCricle.Width, TrackRect.Y)

Graphics.FillEllipse(m_ForeColorBrush, STrainTypeCricle)
PrintCentered(STrainType, STrainTypeCricle, Graphics, STrainTypeFont, New SolidBrush(TrainRectColor))
Expand Down
Binary file modified exe/RailtimeScreenSaver.exe
Binary file not shown.
Binary file modified exe/RailtimeScreenSaver.scr
Binary file not shown.

0 comments on commit ca6ab0d

Please sign in to comment.