18
18
using System ;
19
19
using System . Diagnostics ;
20
20
using System . Drawing ;
21
- using System . Linq ;
22
21
using Microsoft . Xna . Framework ;
23
22
using Orts . Formats . Msts ;
24
23
using Orts . MultiPlayer ;
25
- using Orts . Simulation ;
26
24
using Orts . Simulation . Physics ;
27
- using Orts . Simulation . RollingStocks ;
28
25
using Orts . Simulation . Signalling ;
29
- using ORTS . Common ;
30
- using Color = System . Drawing . Color ;
31
26
32
27
namespace Orts . Viewer3D . Debugging
33
28
{
@@ -97,7 +92,7 @@ public void PopulateItemLists()
97
92
{
98
93
var oldSiding = F . sidings [ oldSidingIndex ] ;
99
94
var oldLocation = oldSiding . Location ;
100
- var newLocation = new PointF ( item . TileX * 2048 + item . X , item . TileZ * 2048 + item . Z ) ;
95
+ var newLocation = new PointF ( ( item . TileX * 2048 ) + item . X , ( item . TileZ * 2048 ) + item . Z ) ;
101
96
102
97
// Because these are structs, not classes, compiler won't let you overwrite them.
103
98
// Instead create a single item which replaces the 2 platform items.
@@ -122,15 +117,15 @@ public void PopulateItemLists()
122
117
{
123
118
var newPlatform = new PlatformWidget ( item as PlatformItem )
124
119
{
125
- Extent1 = new PointF ( item . TileX * 2048 + item . X , item . TileZ * 2048 + item . Z )
120
+ Extent1 = new PointF ( ( item . TileX * 2048 ) + item . X , ( item . TileZ * 2048 ) + item . Z )
126
121
} ;
127
122
F . platforms . Add ( newPlatform ) ;
128
123
}
129
124
else
130
125
{
131
126
var oldPlatform = F . platforms [ oldPlatformIndex ] ;
132
127
var oldLocation = oldPlatform . Location ;
133
- var newLocation = new PointF ( item . TileX * 2048 + item . X , item . TileZ * 2048 + item . Z ) ;
128
+ var newLocation = new PointF ( ( item . TileX * 2048 ) + item . X , ( item . TileZ * 2048 ) + item . Z ) ;
134
129
135
130
// Because these are structs, not classes, compiler won't let you overwrite them.
136
131
// Instead create a single item which replaces the 2 platform items.
@@ -207,12 +202,11 @@ public void FixForBadData(float width, ref PointF scaledA, ref PointF scaledB, P
207
202
208
203
public bool IsActiveTrain ( Simulation . AIs . AITrain t )
209
204
{
210
- if ( t == null )
211
- return false ;
212
- return ( t . MovementState != Simulation . AIs . AITrain . AI_MOVEMENT_STATE . AI_STATIC
205
+ return t != null
206
+ && ( ( t . MovementState != Simulation . AIs . AITrain . AI_MOVEMENT_STATE . AI_STATIC
213
207
&& ! ( t . TrainType == Train . TRAINTYPE . AI_INCORPORATED && ! t . IncorporatingTrain . IsPathless )
214
208
)
215
- || t . TrainType == Train . TRAINTYPE . PLAYER ;
209
+ || t . TrainType == Train . TRAINTYPE . PLAYER ) ;
216
210
}
217
211
218
212
/*
@@ -255,7 +249,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
255
249
const float noFreeSlotFound = - 1f ;
256
250
257
251
var desiredPositionY = ( int ) ( wantY / DispatchViewer . spacing ) ; // The positionY of the ideal row for the text.
258
- var endX = startX + name . Length * F . trainFont . Size ;
252
+ var endX = startX + ( name . Length * F . trainFont . Size ) ;
259
253
//out of drawing area
260
254
if ( endX < 0 )
261
255
return noFreeSlotFound ;
@@ -274,7 +268,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
274
268
{
275
269
var v = F . alignedTextY [ positionY ] [ col ] ;
276
270
//check conflict with a text, v.X is the start of the text, v.Y is the end of the text
277
- if ( ( endX >= v . X && startX <= v . Y ) )
271
+ if ( endX >= v . X && startX <= v . Y )
278
272
{
279
273
conflict = true ;
280
274
break ;
@@ -294,10 +288,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
294
288
else
295
289
{
296
290
// Check that row has an unused column in its fixed size array
297
- if ( F . alignedTextNum [ positionY ] >= F . alignedTextY [ positionY ] . Length )
298
- return noFreeSlotFound ;
299
-
300
- return SaveLabelLocation ( startX , endX , positionY ) ;
291
+ return F . alignedTextNum [ positionY ] >= F . alignedTextY [ positionY ] . Length ? noFreeSlotFound : SaveLabelLocation ( startX , endX , positionY ) ;
301
292
}
302
293
}
303
294
return noFreeSlotFound ;
0 commit comments