Skip to content

Commit db8e3f4

Browse files
committed
Merge branch 'master' into release
2 parents ce2dcf3 + 47a74a2 commit db8e3f4

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

source/OpenBVE/Game/ObjectManager/AnimatedObjects/FunctionScripts.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ internal static void ExecuteFunctionScript(FunctionScript Function, TrainBase Tr
14701470
s++; break;
14711471
case Instructions.RainDrop:
14721472
// n.b. windscreen may be null if we've changed driver car, or this is used in non XML train
1473-
if (Train == null || !Train.IsPlayerTrain && Train.Cars[Train.DriverCar].Windscreen != null) {
1473+
if (Train == null || Train.Cars[Train.DriverCar].Windscreen == null) {
14741474
Function.Stack[s - 1] = 0.0;
14751475
} else {
14761476
int n = (int)Math.Round(Function.Stack[s - 1]);

source/Plugins/Formats.OpenBve/CFG/ConfigFile.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ public override bool GetValue(T2 key, out double value)
583583
{
584584
if (keyValuePairs.TryRemove(key, out var s))
585585
{
586-
if (double.TryParse(s.Value, out value))
586+
if (NumberFormats.TryParseDoubleVb6(s.Value, out value))
587587
{
588588
return true;
589589
}
@@ -599,7 +599,7 @@ public override bool TryGetValue(T2 key, ref double value)
599599
{
600600
if (keyValuePairs.TryRemove(key, out var s))
601601
{
602-
if (double.TryParse(s.Value, out double newValue))
602+
if (NumberFormats.TryParseDoubleVb6(s.Value, out double newValue))
603603
{
604604
value = newValue;
605605
return true;

source/Plugins/Object.CsvB3d/Plugin.Parser.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using OpenBveApi.Objects;
1212
using OpenBveApi.Textures;
1313

14-
namespace Plugin
14+
namespace Object.CsvB3d
1515
{
1616
public partial class Plugin
1717
{

source/Plugins/Object.CsvB3d/Plugin.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using OpenBveApi.Interface;
77
using OpenBveApi.Objects;
88

9-
namespace Plugin
9+
namespace Object.CsvB3d
1010
{
1111
public partial class Plugin : ObjectInterface
1212
{

source/Plugins/Train.OpenBve/Panel/Panel2CfgParser.cs

+5
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ internal void ParsePanel2Config(string PanelFile, string TrainPath, CarBase Car)
190190
Block.TryGetValue(Panel2Key.Maximum, ref Maximum);
191191
Block.TryGetValue(Panel2Key.NaturalFreq, ref NaturalFrequency);
192192
Block.TryGetValue(Panel2Key.DampingRatio, ref DampingRatio);
193+
if (DampingRatio < 0)
194+
{
195+
DampingRatio = -DampingRatio;
196+
Plugin.CurrentHost.AddMessage(MessageType.Error, false, "DampingRatio is expected to be non-negative in [Needle] in " + PanelFile);
197+
}
193198
Block.TryGetColor24(Panel2Key.Color, ref Color);
194199
Block.GetValue(Panel2Key.Backstop, out bool Backstop);
195200
Block.GetValue(Panel2Key.Smoothed, out bool Smoothed);

source/Plugins/Train.OpenBve/Sound/SoundCfg.Bve4.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,20 @@ internal void Parse(string FileName, string trainFolder, TrainBase train)
230230
if (block.GetPath(SoundCfgKey.Music, trainFolder, out string musicLoop) || block.GetPath(SoundCfgKey.MusicLoop, trainFolder, out musicLoop))
231231
{
232232
Plugin.CurrentHost.RegisterSound(musicLoop, SoundCfgParser.mediumRadius, out var sound);
233-
train.Cars[train.DriverCar].Horns[0].LoopSound = sound as SoundBuffer;
234-
train.Cars[train.DriverCar].Horns[0].SoundPosition = front;
235-
train.Cars[train.DriverCar].Horns[0].Loop = false;
233+
train.Cars[train.DriverCar].Horns[2].LoopSound = sound as SoundBuffer;
234+
train.Cars[train.DriverCar].Horns[2].SoundPosition = front;
235+
train.Cars[train.DriverCar].Horns[2].Loop = true;
236236
if (block.GetPath(SoundCfgKey.MusicStart, trainFolder, out string musicStart))
237237
{
238238
Plugin.CurrentHost.RegisterSound(musicStart, SoundCfgParser.mediumRadius, out var startSound);
239-
train.Cars[train.DriverCar].Horns[0].StartSound = startSound as SoundBuffer;
240-
train.Cars[train.DriverCar].Horns[0].StartEndSounds = true;
239+
train.Cars[train.DriverCar].Horns[2].StartSound = startSound as SoundBuffer;
240+
train.Cars[train.DriverCar].Horns[2].StartEndSounds = true;
241241
}
242242
if (block.GetPath(SoundCfgKey.MusicEnd, trainFolder, out string musicEnd))
243243
{
244244
Plugin.CurrentHost.RegisterSound(musicEnd, SoundCfgParser.mediumRadius, out var endSound);
245-
train.Cars[train.DriverCar].Horns[0].EndSound = endSound as SoundBuffer;
246-
train.Cars[train.DriverCar].Horns[0].StartEndSounds = true;
245+
train.Cars[train.DriverCar].Horns[2].EndSound = endSound as SoundBuffer;
246+
train.Cars[train.DriverCar].Horns[2].StartEndSounds = true;
247247
}
248248

249249
}

0 commit comments

Comments
 (0)