Skip to content

Commit 776d6df

Browse files
committed
Format
1 parent 4a5484e commit 776d6df

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

Source/RunActivity/Viewer3D/Map/MapDataProvider.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void PopulateItemLists()
9393
{
9494
var oldSiding = F.sidings[oldSidingIndex];
9595
var oldLocation = oldSiding.Location;
96-
var newLocation = new PointF(item.TileX * 2048 + item.X, item.TileZ * 2048 + item.Z);
96+
var newLocation = new PointF((item.TileX * 2048) + item.X, (item.TileZ * 2048) + item.Z);
9797

9898
// Because these are structs, not classes, compiler won't let you overwrite them.
9999
// Instead create a single item which replaces the 2 platform items.
@@ -118,15 +118,15 @@ public void PopulateItemLists()
118118
{
119119
var newPlatform = new PlatformWidget(item as PlatformItem)
120120
{
121-
Extent1 = new PointF(item.TileX * 2048 + item.X, item.TileZ * 2048 + item.Z)
121+
Extent1 = new PointF((item.TileX * 2048) + item.X, (item.TileZ * 2048) + item.Z)
122122
};
123123
F.platforms.Add(newPlatform);
124124
}
125125
else
126126
{
127127
var oldPlatform = F.platforms[oldPlatformIndex];
128128
var oldLocation = oldPlatform.Location;
129-
var newLocation = new PointF(item.TileX * 2048 + item.X, item.TileZ * 2048 + item.Z);
129+
var newLocation = new PointF((item.TileX * 2048) + item.X, (item.TileZ * 2048) + item.Z);
130130

131131
// Because these are structs, not classes, compiler won't let you overwrite them.
132132
// Instead create a single item which replaces the 2 platform items.
@@ -206,7 +206,7 @@ public bool IsActiveTrain(Simulation.AIs.AITrain t)
206206
return t != null
207207
&& (t.MovementState != Simulation.AIs.AITrain.AI_MOVEMENT_STATE.AI_STATIC
208208
&& !(t.TrainType == Train.TRAINTYPE.AI_INCORPORATED && !t.IncorporatingTrain.IsPathless)
209-
209+
210210
|| t.TrainType == Train.TRAINTYPE.PLAYER);
211211
}
212212

@@ -250,7 +250,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
250250
const float noFreeSlotFound = -1f;
251251

252252
var desiredPositionY = (int)(wantY / DispatchViewer.spacing); // The positionY of the ideal row for the text.
253-
var endX = startX + name.Length * F.trainFont.Size;
253+
var endX = startX + (name.Length * F.trainFont.Size);
254254
//out of drawing area
255255
if (endX < 0)
256256
return noFreeSlotFound;

Source/RunActivity/Viewer3D/Map/MapForm.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public partial class MapViewer : Form
4646
public float xScale = 1; // pixels / metre
4747
public float yScale = 1; // pixels / metre
4848

49-
readonly string name = "";
50-
5149
public List<SwitchWidget> switchItemsDrawn;
5250
public List<SignalWidget> signalItemsDrawn;
5351
public SwitchWidget switchPickedItem;
@@ -509,8 +507,8 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
509507
}
510508
else
511509
{*/
512-
foreach (var train in simulator.Trains)
513-
selectedTrainList.Add(train);
510+
foreach (var train in simulator.Trains)
511+
selectedTrainList.Add(train);
514512
/*}*/
515513

516514
foreach (var train in selectedTrainList)
@@ -659,16 +657,11 @@ private void SetTrainColor(Train t, TrainCar locoCar, TrainCar car)
659657
// inactive loco: RGB 153,128,0
660658
// active car: RGB 0,204,0
661659
// inactive car: RGB 0,153,0
662-
if (MapDataProvider.IsActiveTrain(t as AITrain))
663-
{
664-
trainPen.Color = car is MSTSLocomotive
660+
trainPen.Color = MapDataProvider.IsActiveTrain(t as AITrain)
661+
? car is MSTSLocomotive
665662
? (car == locoCar) ? Color.FromArgb(204, 170, 0) : Color.FromArgb(153, 128, 0)
666-
: Color.FromArgb(0, 204, 0);
667-
}
668-
else
669-
{
670-
trainPen.Color = car is MSTSLocomotive ? Color.FromArgb(153, 128, 0) : Color.FromArgb(0, 153, 0);
671-
}
663+
: Color.FromArgb(0, 204, 0)
664+
: car is MSTSLocomotive ? Color.FromArgb(153, 128, 0) : Color.FromArgb(0, 153, 0);
672665

673666
if (t.TrainType == Train.TRAINTYPE.STATIC || (t.TrainType == Train.TRAINTYPE.AI && t.GetAIMovementState() == AITrain.AI_MOVEMENT_STATE.AI_STATIC))
674667
{

Source/RunActivity/Viewer3D/Map/MapThemeProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void InitializeThemes()
5656
Themes.Add("dark", DarkTheme);
5757
}
5858

59-
private Dictionary<string, ThemeStyle> Themes = new Dictionary<string, ThemeStyle>();
59+
private readonly Dictionary<string, ThemeStyle> Themes = new Dictionary<string, ThemeStyle>();
6060

6161
public ThemeStyle GetTheme(string themeName)
6262
{

0 commit comments

Comments
 (0)