Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 573e2fc

Browse files
committed
Automatic merge of T1.5.1-542-ga8a4343d9 and 15 pull requests
- Pull request #757 at 98dd1a7: Unify RailDriver code implementations - Pull request #821 at cc3af66: Adds suppression of safety valves - Pull request #831 at 61bbf43: poor mans switch panel on tablet - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #841 at 410a585: https://blueprints.launchpad.net/or/+spec/animating-trainset-windows - Pull request #853 at a9760ec: Notify out of focus - Pull request #855 at b39e5d8: Adds new route from TrainSimulations - Pull request #857 at 9afc8c3: Adding Air Flow Meters - Pull request #859 at 8a7df84: Steam adhesion bug#1 - Pull request #860 at d2b8a52: Changes in the Car Operations Menu for the lines with brake information - Pull request #861 at 589e716: Curve friction#1 - Pull request #862 at 489f261: Fix engine leak problem - Pull request #863 at a34b857: Alternate preset 3D cabviewpoints - Pull request #864 at 7d0f327: Fixes for Undesired Emergency Applications - Pull request #865 at 705126e: Dispatcher window improvements
17 parents de5bf9c + a8a4343 + 98dd1a7 + cc3af66 + 61bbf43 + d00beb9 + 410a585 + a9760ec + b39e5d8 + 9afc8c3 + 8a7df84 + d2b8a52 + 589e716 + 489f261 + a34b857 + 7d0f327 + 705126e commit 573e2fc

File tree

8 files changed

+126
-145
lines changed

8 files changed

+126
-145
lines changed

Source/ORTS.Common/Input/UserCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public enum UserCommand
6262
[GetString("Debug Precipitation Decrease")] DebugPrecipitationDecrease,
6363
[GetString("Debug Precipitation Liquidity Increase")] DebugPrecipitationLiquidityIncrease,
6464
[GetString("Debug Precipitation Liquidity Decrease")] DebugPrecipitationLiquidityDecrease,
65+
[GetString("Debug Daylight Offset Increase")] DebugDaylightOffsetIncrease,
66+
[GetString("Debug Daylight Offset Decrease")] DebugDaylightOffsetDecrease,
6567
[GetString("Debug Weather Change")] DebugWeatherChange,
6668
[GetString("Debug Clock Forwards")] DebugClockForwards,
6769
[GetString("Debug Clock Backwards")] DebugClockBackwards,

Source/ORTS.Settings/InputSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ static void InitializeCommands(UserCommandInput[] Commands)
478478
Commands[(int)UserCommand.DebugLockShadows] = new UserCommandKeyInput(0x1F, KeyModifiers.Control | KeyModifiers.Alt);
479479
Commands[(int)UserCommand.DebugLogger] = new UserCommandKeyInput(0x58);
480480
Commands[(int)UserCommand.DebugLogRenderFrame] = new UserCommandKeyInput(0x58, KeyModifiers.Alt);
481+
Commands[(int)UserCommand.DebugDaylightOffsetDecrease] = new UserCommandKeyInput(0x0C, KeyModifiers.Shift | KeyModifiers.Alt);
482+
Commands[(int)UserCommand.DebugDaylightOffsetIncrease] = new UserCommandKeyInput(0x0D, KeyModifiers.Shift | KeyModifiers.Alt);
481483
Commands[(int)UserCommand.DebugOvercastDecrease] = new UserCommandKeyInput(0x0C, KeyModifiers.Control);
482484
Commands[(int)UserCommand.DebugOvercastIncrease] = new UserCommandKeyInput(0x0D, KeyModifiers.Control);
483485
Commands[(int)UserCommand.DebugPhysicsForm] = new UserCommandKeyInput(0x3D, KeyModifiers.Alt);

Source/Orts.Simulation/Simulation/Weather.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public class Weather
4444

4545
// Fog/visibility distance. Ranges from 10m (can't see anything), 5km (medium), 20km (clear) to 100km (clear arctic).
4646
public float FogDistance;
47+
48+
// Daylight offset (-12h to +12h)
49+
public int DaylightOffset = 0;
4750

4851
// Precipitation liquidity; =1 for rain, =0 for snow; intermediate values possible with dynamic weather;
4952
public float PrecipitationLiquidity;

Source/RunActivity/Viewer3D/Debugging/DebugViewerBetaForm.cs

Lines changed: 99 additions & 124 deletions
Large diffs are not rendered by default.

Source/RunActivity/Viewer3D/Debugging/MapDataProvider.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@
1818
using System;
1919
using System.Diagnostics;
2020
using System.Drawing;
21-
using System.Linq;
2221
using Microsoft.Xna.Framework;
2322
using Orts.Formats.Msts;
2423
using Orts.MultiPlayer;
25-
using Orts.Simulation;
2624
using Orts.Simulation.Physics;
27-
using Orts.Simulation.RollingStocks;
2825
using Orts.Simulation.Signalling;
29-
using ORTS.Common;
30-
using Color = System.Drawing.Color;
3126

3227
namespace Orts.Viewer3D.Debugging
3328
{
@@ -97,7 +92,7 @@ public void PopulateItemLists()
9792
{
9893
var oldSiding = F.sidings[oldSidingIndex];
9994
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);
10196

10297
// Because these are structs, not classes, compiler won't let you overwrite them.
10398
// Instead create a single item which replaces the 2 platform items.
@@ -122,15 +117,15 @@ public void PopulateItemLists()
122117
{
123118
var newPlatform = new PlatformWidget(item as PlatformItem)
124119
{
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)
126121
};
127122
F.platforms.Add(newPlatform);
128123
}
129124
else
130125
{
131126
var oldPlatform = F.platforms[oldPlatformIndex];
132127
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);
134129

135130
// Because these are structs, not classes, compiler won't let you overwrite them.
136131
// 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
207202

208203
public bool IsActiveTrain(Simulation.AIs.AITrain t)
209204
{
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
213207
&& !(t.TrainType == Train.TRAINTYPE.AI_INCORPORATED && !t.IncorporatingTrain.IsPathless)
214208
)
215-
|| t.TrainType == Train.TRAINTYPE.PLAYER;
209+
|| t.TrainType == Train.TRAINTYPE.PLAYER);
216210
}
217211

218212
/*
@@ -255,7 +249,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
255249
const float noFreeSlotFound = -1f;
256250

257251
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);
259253
//out of drawing area
260254
if (endX < 0)
261255
return noFreeSlotFound;
@@ -274,7 +268,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
274268
{
275269
var v = F.alignedTextY[positionY][col];
276270
//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)
278272
{
279273
conflict = true;
280274
break;
@@ -294,10 +288,7 @@ public float GetUnusedYLocation(float startX, float wantY, string name)
294288
else
295289
{
296290
// 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);
301292
}
302293
}
303294
return noFreeSlotFound;

Source/RunActivity/Viewer3D/Debugging/MapThemeProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Drawing;
22
using System.Windows.Forms;
3-
using Orts.Formats.Msts;
43

54
namespace Orts.Viewer3D.Debugging
65
{

Source/RunActivity/Viewer3D/SkyInterpolation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class SkyInterpolation
2929
public int Step1;
3030
public int Step2;
3131

32-
static float DaylightOffsetS => (Program.DebugViewer == null) ? 0f : (float)Program.DebugViewer.DaylightOffsetHrs * 60 * 60;
32+
static float DaylightOffsetS => (float)Program.Simulator.Weather.DaylightOffset * 60 * 60;
3333

3434
public void SetSunAndMoonDirection(ref Vector3 solarDirection, ref Vector3 lunarDirection, Vector3[] solarPosArray, Vector3[] lunarPosArray, double clockTime)
3535
{

Source/RunActivity/Viewer3D/Weather.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2010, 2011, 2014 by the Open Rails project.
1+
// COPYRIGHT 2010, 2011, 2014 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -487,6 +487,15 @@ public virtual void Update(ElapsedTime elapsedTime)
487487
weatherChangeOn = false;
488488
}
489489

490+
// Daylight offset is useful for debugging night running timetables; it ranges from -12h to +12h
491+
if (UserInput.IsPressed(UserCommand.DebugDaylightOffsetIncrease) && Weather.DaylightOffset < 12) {
492+
Weather.DaylightOffset += 1;
493+
}
494+
if (UserInput.IsPressed(UserCommand.DebugDaylightOffsetDecrease) && Weather.DaylightOffset > -12)
495+
{
496+
Weather.DaylightOffset -= 1;
497+
}
498+
490499
UpdateWind(elapsedTime);
491500
}
492501

0 commit comments

Comments
 (0)