Skip to content

Commit 6487be0

Browse files
committed
Automatic merge of T1.5.1-1741-gf80cfb5d1 and 18 pull requests
- Pull request #570 at f11a428: glTF 2.0 support with PBR lighting - Pull request #1030 at d3ae4a2: Refactor settings, in prep for settings exporter - Pull request #1052 at 3b5cb90: Content Manager: Add axle count, and lowest derail force - Pull request #1062 at bbc0013: Train Forces popup Window. - Pull request #1064 at cb510d6: Add Train Info tab to Help window (F1) - Pull request #1066 at 62c89c1: Log derailment, using TraceInformation. - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #1049 at 6a0c471: Re-organise document storage and access - Pull request #1057 at 52554f3: Switchable brake system - Pull request #1069 at 3f153f0: Mouse wheel control only with Alt – Followup for #1051 - Pull request #1070 at f818e40: Fix a NullReferenceException in TCS scripts - Pull request #1071 at 722dd3f: Change cover image for v1.6 - Pull request #1074 at e9a66c1: Gradient - commit 2024-16-12 - Pull request #1076 at d1ff8fd: Allow depart early - Pull request #1077 at 7e73abd: Fix SME brakes not working - Pull request #1079 at 5e37059: Adds Polish transations - Pull request #1080 at a637cb8: arranges Options > System tab for longer texts - Pull request #1078 at 9ab642e: Default PowerSupply script for steam locomotives
20 parents b74fe6a + f80cfb5 + f11a428 + d3ae4a2 + 3b5cb90 + bbc0013 + cb510d6 + 62c89c1 + 1f5ba4c + 6a0c471 + 52554f3 + 3f153f0 + f818e40 + 722dd3f + e9a66c1 + d1ff8fd + 7e73abd + 5e37059 + a637cb8 + 9ab642e commit 6487be0

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -708,51 +708,52 @@ public virtual void LoadFromWagFile(string wagFilePath)
708708

709709
}
710710

711+
void setIfPositive(ref float result, float? value) { if (value > 0) result = (float)value; }
711712
void setIfNonZero(ref float result, float? value) { if (value != null && value != 0) result = (float)value; }
712713

713714
// Read freight animation values from animation INCLUDE files
714715
// Read (initialise) "common" (empty values first).
715716
// Test each value to make sure that it has been defined in the WAG file, if not default to Root WAG file value
716-
setIfNonZero(ref LoadEmptyMassKg, FreightAnimations.WagonEmptyWeight);
717-
setIfNonZero(ref LoadEmptyORTSDavis_A, FreightAnimations.EmptyORTSDavis_A);
718-
setIfNonZero(ref LoadEmptyORTSDavis_B, FreightAnimations.EmptyORTSDavis_B);
719-
setIfNonZero(ref LoadEmptyORTSDavis_C, FreightAnimations.EmptyORTSDavis_C);
720-
setIfNonZero(ref LoadEmptyDavisDragConstant, FreightAnimations.EmptyORTSDavisDragConstant);
721-
setIfNonZero(ref LoadEmptyWagonFrontalAreaM2, FreightAnimations.EmptyORTSWagonFrontalAreaM2);
722-
setIfNonZero(ref LoadEmptyMaxBrakeForceN, FreightAnimations.EmptyMaxBrakeShoeForceN);
723-
setIfNonZero(ref LoadEmptyMaxBrakeForceN, FreightAnimations.EmptyMaxBrakeForceN);
724-
setIfNonZero(ref LoadEmptyMaxHandbrakeForceN, FreightAnimations.EmptyMaxHandbrakeForceN);
725-
setIfNonZero(ref LoadEmptyCentreOfGravityM_Y, FreightAnimations.EmptyCentreOfGravityM_Y);
726-
setIfNonZero(ref LoadEmptyRelayValveRatio, FreightAnimations.EmptyRelayValveRatio);
717+
setIfPositive(ref LoadEmptyMassKg, FreightAnimations.WagonEmptyWeight);
718+
setIfPositive(ref LoadEmptyORTSDavis_A, FreightAnimations.EmptyORTSDavis_A);
719+
setIfPositive(ref LoadEmptyORTSDavis_B, FreightAnimations.EmptyORTSDavis_B);
720+
setIfPositive(ref LoadEmptyORTSDavis_C, FreightAnimations.EmptyORTSDavis_C);
721+
setIfPositive(ref LoadEmptyDavisDragConstant, FreightAnimations.EmptyORTSDavisDragConstant);
722+
setIfPositive(ref LoadEmptyWagonFrontalAreaM2, FreightAnimations.EmptyORTSWagonFrontalAreaM2);
723+
setIfPositive(ref LoadEmptyMaxBrakeForceN, FreightAnimations.EmptyMaxBrakeShoeForceN);
724+
setIfPositive(ref LoadEmptyMaxBrakeForceN, FreightAnimations.EmptyMaxBrakeForceN);
725+
setIfPositive(ref LoadEmptyMaxHandbrakeForceN, FreightAnimations.EmptyMaxHandbrakeForceN);
726+
setIfPositive(ref LoadEmptyCentreOfGravityM_Y, FreightAnimations.EmptyCentreOfGravityM_Y);
727+
setIfPositive(ref LoadEmptyRelayValveRatio, FreightAnimations.EmptyRelayValveRatio);
727728
setIfNonZero(ref LoadEmptyInshotPSI, FreightAnimations.EmptyInshotPSI);
728729

729730
// Read (initialise) Static load ones if a static load
730731
// Test each value to make sure that it has been defined in the WAG file, if not default to Root WAG file value
731-
setIfNonZero(ref LoadFullORTSDavis_A, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavis_A);
732-
setIfNonZero(ref LoadFullORTSDavis_B, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavis_B);
733-
setIfNonZero(ref LoadFullORTSDavis_C, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavis_C);
734-
setIfNonZero(ref LoadFullDavisDragConstant, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavisDragConstant);
735-
setIfNonZero(ref LoadFullWagonFrontalAreaM2, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSWagonFrontalAreaM2);
736-
setIfNonZero(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsStaticOne?.FullStaticMaxBrakeShoeForceN);
737-
setIfNonZero(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsStaticOne?.FullStaticMaxBrakeForceN);
738-
setIfNonZero(ref LoadFullMaxHandbrakeForceN, FreightAnimations.FullPhysicsStaticOne?.FullStaticMaxHandbrakeForceN);
739-
setIfNonZero(ref LoadFullCentreOfGravityM_Y, FreightAnimations.FullPhysicsStaticOne?.FullStaticCentreOfGravityM_Y);
740-
setIfNonZero(ref LoadFullRelayValveRatio, FreightAnimations.FullPhysicsStaticOne?.FullStaticRelayValveRatio);
741-
setIfNonZero(ref LoadFullInshotPSI, FreightAnimations.FullPhysicsStaticOne?.FullStaticInshotPSI);
732+
setIfPositive(ref LoadFullORTSDavis_A, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavis_A);
733+
setIfPositive(ref LoadFullORTSDavis_B, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavis_B);
734+
setIfPositive(ref LoadFullORTSDavis_C, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavis_C);
735+
setIfPositive(ref LoadFullDavisDragConstant, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSDavisDragConstant);
736+
setIfPositive(ref LoadFullWagonFrontalAreaM2, FreightAnimations.FullPhysicsStaticOne?.FullStaticORTSWagonFrontalAreaM2);
737+
setIfPositive(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsStaticOne?.FullStaticMaxBrakeShoeForceN);
738+
setIfPositive(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsStaticOne?.FullStaticMaxBrakeForceN);
739+
setIfPositive(ref LoadFullMaxHandbrakeForceN, FreightAnimations.FullPhysicsStaticOne?.FullStaticMaxHandbrakeForceN);
740+
setIfPositive(ref LoadFullCentreOfGravityM_Y, FreightAnimations.FullPhysicsStaticOne?.FullStaticCentreOfGravityM_Y);
741+
setIfPositive(ref LoadFullRelayValveRatio, FreightAnimations.FullPhysicsStaticOne?.FullStaticRelayValveRatio);
742+
setIfPositive(ref LoadFullInshotPSI, FreightAnimations.FullPhysicsStaticOne?.FullStaticInshotPSI);
742743

743744
// Read (initialise) Continuous load ones if a continuous load
744745
// Test each value to make sure that it has been defined in the WAG file, if not default to Root WAG file value
745-
setIfNonZero(ref LoadFullMassKg, FreightAnimations.WagonEmptyWeight + FreightAnimations.FullPhysicsContinuousOne?.FreightWeightWhenFull);
746-
setIfNonZero(ref LoadFullORTSDavis_A, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavis_A);
747-
setIfNonZero(ref LoadFullORTSDavis_B, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavis_B);
748-
setIfNonZero(ref LoadFullORTSDavis_C, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavis_C);
749-
setIfNonZero(ref LoadFullDavisDragConstant, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavisDragConstant);
750-
setIfNonZero(ref LoadFullWagonFrontalAreaM2, FreightAnimations.FullPhysicsContinuousOne?.FullORTSWagonFrontalAreaM2);
751-
setIfNonZero(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsContinuousOne?.FullMaxBrakeShoeForceN);
752-
setIfNonZero(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsContinuousOne?.FullMaxBrakeForceN);
753-
setIfNonZero(ref LoadFullMaxHandbrakeForceN, FreightAnimations.FullPhysicsContinuousOne?.FullMaxHandbrakeForceN);
754-
setIfNonZero(ref LoadFullCentreOfGravityM_Y, FreightAnimations.FullPhysicsContinuousOne?.FullCentreOfGravityM_Y);
755-
setIfNonZero(ref LoadFullRelayValveRatio, FreightAnimations.FullPhysicsContinuousOne?.FullRelayValveRatio);
746+
setIfPositive(ref LoadFullMassKg, FreightAnimations.WagonEmptyWeight + FreightAnimations.FullPhysicsContinuousOne?.FreightWeightWhenFull);
747+
setIfPositive(ref LoadFullORTSDavis_A, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavis_A);
748+
setIfPositive(ref LoadFullORTSDavis_B, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavis_B);
749+
setIfPositive(ref LoadFullORTSDavis_C, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavis_C);
750+
setIfPositive(ref LoadFullDavisDragConstant, FreightAnimations.FullPhysicsContinuousOne?.FullORTSDavisDragConstant);
751+
setIfPositive(ref LoadFullWagonFrontalAreaM2, FreightAnimations.FullPhysicsContinuousOne?.FullORTSWagonFrontalAreaM2);
752+
setIfPositive(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsContinuousOne?.FullMaxBrakeShoeForceN);
753+
setIfPositive(ref LoadFullMaxBrakeForceN, FreightAnimations.FullPhysicsContinuousOne?.FullMaxBrakeForceN);
754+
setIfPositive(ref LoadFullMaxHandbrakeForceN, FreightAnimations.FullPhysicsContinuousOne?.FullMaxHandbrakeForceN);
755+
setIfPositive(ref LoadFullCentreOfGravityM_Y, FreightAnimations.FullPhysicsContinuousOne?.FullCentreOfGravityM_Y);
756+
setIfPositive(ref LoadFullRelayValveRatio, FreightAnimations.FullPhysicsContinuousOne?.FullRelayValveRatio);
756757
setIfNonZero(ref LoadFullInshotPSI, FreightAnimations.FullPhysicsContinuousOne?.FullInshotPSI);
757758

758759
if (!FreightAnimations.MSTSFreightAnimEnabled) FreightShapeFileName = null;

0 commit comments

Comments
 (0)