@@ -75,7 +75,7 @@ public partial class MapViewer : Form
7575 public double switchPickedTime ;
7676 public bool signalPickedItemHandled ;
7777 public double signalPickedTime ;
78- public bool DrawPath = true ; //draw train path
78+ public bool DrawPath = true ; // Whether the train path should be drawn
7979 readonly TrackNode [ ] nodes ;
8080
8181 public List < Train > selectedTrainList ;
@@ -380,8 +380,8 @@ public void GenerateView()
380380 xScale = yScale = Math . Max ( xScale , yScale ) ; // Make X and Y scales the same to maintain correct angles
381381
382382 // Set the default pen to represent 1 meter
383- var scale = ( float ) Math . Round ( xScale ) ; // Round to nearest pixels/meter
384- var penWidth = ( int ) MathHelper . Clamp ( scale , 1 , 4 ) ; // Keep 1 <= width <= 4 pixels
383+ var scale = ( float ) Math . Round ( xScale ) ; // Round to nearest pixels/meter
384+ var penWidth = ( int ) MathHelper . Clamp ( scale , 1 , 4 ) ; // Keep 1 <= width <= 4 pixels
385385
386386 PointF [ ] points = new PointF [ 3 ] ;
387387 Pen p = grayPen ;
@@ -396,10 +396,6 @@ public void GenerateView()
396396
397397 var forwardDist = 100 / xScale ; if ( forwardDist < 5 ) forwardDist = 5 ;
398398
399- /*PointF scaledA = new PointF(0, 0);
400- PointF scaledB = new PointF(0, 0);
401- PointF scaledC = new PointF(0, 0);*/
402-
403399 // Draw platforms first because track is drawn over the thicker platform line
404400 DrawPlatforms ( g , penWidth ) ;
405401
@@ -421,7 +417,7 @@ public void GenerateView()
421417 ShowSwitches ( g , widgetWidth ) ;
422418
423419 // Draw labels for sidings and platforms last so they go on top for readability
424- MapDataProvider . CleanTextCells ( ) ; // Empty the listing of labels ready for adding labels again
420+ MapDataProvider . CleanTextCells ( ) ; // Empty the listing of labels ready for adding labels again
425421 ShowPlatformLabels ( g ) ; // Platforms take priority over sidings and signal states
426422 ShowSidingLabels ( g ) ;
427423
@@ -497,21 +493,8 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
497493
498494 selectedTrainList . Clear ( ) ;
499495
500- /*if (simulator.TimetableMode)
501- {
502- // Add the player's train...
503- if (simulator.PlayerLocomotive.Train is AITrain)
504- selectedTrainList.Add(simulator.PlayerLocomotive.Train as AITrain);
505-
506- // ...then all the AI trains, including static consists.
507- foreach (AITrain train in simulator.AI.AITrains)
508- selectedTrainList.Add(train);
509- }
510- else
511- {*/
512496 foreach ( var train in simulator . Trains )
513497 selectedTrainList . Add ( train ) ;
514- /*}*/
515498
516499 foreach ( var train in selectedTrainList )
517500 {
@@ -677,9 +660,6 @@ private void SetTrainColor(Train t, TrainCar locoCar, TrainCar car)
677660
678661 private void DrawTrainLabels ( Graphics g , Train t , string trainName , PointF scaledTrain )
679662 {
680- /*WorldPosition worldPos = firstCar.WorldPosition;
681- scaledTrain.X = ((worldPos.TileX * 2048) - subX + worldPos.Location.X) * xScale;
682- scaledTrain.Y = -25 + mapCanvas.Height - (((worldPos.TileZ * 2048) - subY + worldPos.Location.Z) * yScale);*/
683663 if ( showActiveTrainsRadio . Checked )
684664 {
685665 if ( t is AITrain && MapDataProvider . IsActiveTrain ( t as AITrain ) )
@@ -945,7 +925,7 @@ SignallingDebugWindow.TrackSectionCacheEntry GetCacheEntry(Traveller position)
945925 return rv ;
946926 }
947927
948- //draw the train path if it is within the window
928+ // Draw the train path if it is within the window
949929 public void DrawTrainPath ( Train train , float subX , float subY , Pen pathPen , Graphics g , PointF scaledA , PointF scaledB , float stepDist , float MaximumSectionDistance )
950930 {
951931 if ( DrawPath != true ) return ;
@@ -1314,10 +1294,6 @@ private void mapCanvas_MouseDown(object sender, MouseEventArgs e)
13141294 LastCursorPosition . X = e . X ;
13151295 LastCursorPosition . Y = e . Y ;
13161296 MPManager . Instance ( ) . ComposingText = false ;
1317- /*lblInstruction1.Visible = true;
1318- lblInstruction2.Visible = true;
1319- lblInstruction3.Visible = true;
1320- lblInstruction4.Visible = true;*/
13211297 }
13221298
13231299 private void mapCanvas_MouseUp ( object sender , MouseEventArgs e )
@@ -1383,10 +1359,6 @@ private void mapCanvas_MouseUp(object sender, MouseEventArgs e)
13831359 }
13841360
13851361 }
1386- /*lblInstruction1.Visible = false;
1387- lblInstruction2.Visible = false;
1388- lblInstruction3.Visible = false;
1389- lblInstruction4.Visible = false;*/
13901362 }
13911363
13921364 private void UnHandleItemPick ( )
@@ -1397,8 +1369,9 @@ private void UnHandleItemPick()
13971369
13981370 private void HandlePickedSignal ( )
13991371 {
1400- if ( MPManager . IsClient ( ) && ! MPManager . Instance ( ) . AmAider ) // normal client not server or aider
1372+ if ( MPManager . IsClient ( ) && ! MPManager . Instance ( ) . AmAider ) // Normal client ( not server nor aider)
14011373 return ;
1374+
14021375 setSwitchMenu . Visible = false ;
14031376 if ( signalPickedItem == null ) return ;
14041377
@@ -1415,8 +1388,8 @@ private void HandlePickedSignal()
14151388
14161389 private void HandlePickedSwitch ( )
14171390 {
1418- if ( MPManager . IsClient ( ) && ! MPManager . Instance ( ) . AmAider )
1419- return ; //normal client not server
1391+ if ( MPManager . IsClient ( ) && ! MPManager . Instance ( ) . AmAider ) // Normal client (not server nor aider)
1392+ return ;
14201393
14211394 setSignalMenu . Visible = false ;
14221395 if ( switchPickedItem == null ) return ;
@@ -1521,11 +1494,9 @@ private void setSwitchMenu_ItemClicked(object sender, ToolStripItemClickedEventA
15211494 {
15221495 case "mainRoute" :
15231496 Program . Simulator . Signals . RequestSetSwitch ( sw . TN , ( int ) switchPickedItem . main ) ;
1524- //sw.SelectedRoute = (int)switchPickedItem.main;
15251497 break ;
15261498 case "sideRoute" :
15271499 Program . Simulator . Signals . RequestSetSwitch ( sw . TN , 1 - ( int ) switchPickedItem . main ) ;
1528- //sw.SelectedRoute = 1 - (int)switchPickedItem.main;
15291500 break ;
15301501 }
15311502 }
@@ -1541,7 +1512,7 @@ private ItemWidget findItemFromMouse(int x, int y, int range)
15411512 {
15421513 foreach ( var item in switchItemsDrawn )
15431514 {
1544- //if out of range, continue
1515+ // If out of range, continue
15451516 if ( item . Location2D . X < x - range || item . Location2D . X > x + range
15461517 || item . Location2D . Y < y - range || item . Location2D . Y > y + range )
15471518 continue ;
@@ -1566,7 +1537,7 @@ private ItemWidget findItemFromMouse(int x, int y, int range)
15661537 {
15671538 foreach ( var item in signalItemsDrawn )
15681539 {
1569- //if out of range, continue
1540+ // If out of range, continue
15701541 if ( item . Location2D . X < x - range || item . Location2D . X > x + range
15711542 || item . Location2D . Y < y - range || item . Location2D . Y > y + range )
15721543 continue ;
@@ -1588,7 +1559,7 @@ private ItemWidget findItemFromMouse(int x, int y, int range)
15881559 }
15891560 }
15901561
1591- //now check for trains (first car only)
1562+ // Now check for trains (first car only)
15921563 TrainCar firstCar ;
15931564 PickedTrain = null ; float tX , tY ;
15941565 closest = 100f ;
@@ -1621,7 +1592,7 @@ private ItemWidget findItemFromMouse(int x, int y, int range)
16211592 if ( PickedTrain == null )
16221593 PickedTrain = t ;
16231594 }
1624- //if a train is picked, will clear the avatar list selection
1595+ // If a train is picked, will clear the player list selection
16251596 if ( PickedTrain != null )
16261597 {
16271598 //AvatarView.SelectedItems.Clear();
0 commit comments