From 7da5af2e1b073431c27797f7dbb2069d1db6165c Mon Sep 17 00:00:00 2001 From: Benjamin Sutas Date: Wed, 20 Mar 2024 23:49:26 +1100 Subject: [PATCH] name building.var9F, fix unit tests --- Core/Objects/BuildingObject.cs | 2 +- Tests/LoadSaveTests.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/Objects/BuildingObject.cs b/Core/Objects/BuildingObject.cs index 0b21beee..c2d01721 100644 --- a/Core/Objects/BuildingObject.cs +++ b/Core/Objects/BuildingObject.cs @@ -37,7 +37,7 @@ public record BuildingObject( [property: LocoStructOffset(0x9C)] uint8_t ScaffoldingSegmentType, [property: LocoStructOffset(0x9D)] Colour ScaffoldingColour, [property: LocoStructOffset(0x9E)] uint8_t GeneratorFunction, - [property: LocoStructOffset(0x9F)] uint8_t var_9F, + [property: LocoStructOffset(0x9F)] uint8_t AverageNumberOnMap, [property: LocoStructOffset(0xA0), LocoStructVariableLoad, LocoArrayLength(2)] List _ProducedQuantity, [property: LocoStructOffset(0xA2), LocoStructVariableLoad, LocoArrayLength(BuildingObject.MaxProducedCargoType), Browsable(false)] List _ProducedCargoType, [property: LocoStructOffset(0xA4), LocoStructVariableLoad, LocoArrayLength(BuildingObject.MaxRequiredCargoType), Browsable(false)] List _RequiredCargoType, diff --git a/Tests/LoadSaveTests.cs b/Tests/LoadSaveTests.cs index 68375a3a..bb3fe396 100644 --- a/Tests/LoadSaveTests.cs +++ b/Tests/LoadSaveTests.cs @@ -138,7 +138,7 @@ void assertFunc(ILocoObject obj, BridgeObject struc) => Assert.Multiple(() => Assert.That(struc.BaseCostFactor, Is.EqualTo(16), nameof(struc.BaseCostFactor)); Assert.That(struc.HeightCostFactor, Is.EqualTo(8), nameof(struc.HeightCostFactor)); Assert.That(struc.SellCostFactor, Is.EqualTo(-12), nameof(struc.SellCostFactor)); - Assert.That(struc.DisabledTrackCfg, Is.EqualTo(0), nameof(struc.DisabledTrackCfg)); + Assert.That(struc.DisabledTrackFlags, Is.EqualTo(BridgeDisabledTrackFlags.None), nameof(struc.DisabledTrackFlags)); //Assert.That(struc.TrackNumCompatible, Is.EqualTo(0), nameof(struc.TrackNumCompatible)); //CollectionAssert.AreEqual(struc.TrackMods, Array.CreateInstance(typeof(byte), 7), nameof(struc.TrackMods)); //Assert.That(struc.RoadNumCompatible, Is.EqualTo(0), nameof(struc.RoadNumCompatible)); @@ -170,7 +170,7 @@ void assertFunc(ILocoObject obj, BuildingObject struc) => Assert.Multiple(() => Assert.That(struc.ScaffoldingSegmentType, Is.EqualTo(1), nameof(struc.ScaffoldingSegmentType)); Assert.That(struc.ScaffoldingColour, Is.EqualTo(Colour.Yellow), nameof(struc.ScaffoldingColour)); Assert.That(struc.GeneratorFunction, Is.EqualTo(3), nameof(struc.GeneratorFunction)); - Assert.That(struc.var_9F, Is.EqualTo(3), nameof(struc.var_9F)); + Assert.That(struc.AverageNumberOnMap, Is.EqualTo(3), nameof(struc.AverageNumberOnMap)); // ProducedQuantity // ProducedCargoType // RequiredCargoType @@ -730,7 +730,7 @@ void assertFunc(ILocoObject obj, TrackObject struc) => Assert.Multiple(() => Assert.That(struc.SellCostFactor, Is.EqualTo(-10), nameof(struc.SellCostFactor)); // Signals // Stations - Assert.That(struc.StationTrackPieces, Is.EqualTo(525), nameof(struc.StationTrackPieces)); + Assert.That(struc.StationTrackPieces, Is.EqualTo(TrackObjectPieceFlags.Diagonal | TrackObjectPieceFlags.NormalCurve | TrackObjectPieceFlags.SmallCurve | TrackObjectPieceFlags.SBend), nameof(struc.StationTrackPieces)); Assert.That(struc.TrackPieces, Is.EqualTo(TrackObjectPieceFlags.Diagonal | TrackObjectPieceFlags.LargeCurve | TrackObjectPieceFlags.NormalCurve | TrackObjectPieceFlags.SmallCurve | TrackObjectPieceFlags.Slope | TrackObjectPieceFlags.SlopedCurve | TrackObjectPieceFlags.SBend | TrackObjectPieceFlags.Junction), nameof(struc.TrackPieces)); Assert.That(struc.TunnelCostFactor, Is.EqualTo(24), nameof(struc.TunnelCostFactor)); Assert.That(struc.var_06, Is.EqualTo(0), nameof(struc.var_06)); @@ -747,7 +747,7 @@ public void TrackExtraObject(string objectName) { void assertFunc(ILocoObject obj, TrackExtraObject struc) => Assert.Multiple(() => { - Assert.That(struc.TrackPieces, Is.EqualTo(1023), nameof(struc.TrackPieces)); + Assert.That(struc.TrackPieces, Is.EqualTo(TrackObjectPieceFlags.Diagonal | TrackObjectPieceFlags.LargeCurve | TrackObjectPieceFlags.NormalCurve | TrackObjectPieceFlags.SmallCurve | TrackObjectPieceFlags.VerySmallCurve | TrackObjectPieceFlags.Slope | TrackObjectPieceFlags.SteepSlope | TrackObjectPieceFlags.OneSided | TrackObjectPieceFlags.SlopedCurve | TrackObjectPieceFlags.SBend), nameof(struc.TrackPieces)); Assert.That(struc.PaintStyle, Is.EqualTo(1), nameof(struc.PaintStyle)); Assert.That(struc.CostIndex, Is.EqualTo(1), nameof(struc.CostIndex)); Assert.That(struc.BuildCostFactor, Is.EqualTo(2), nameof(struc.BuildCostFactor)); @@ -797,7 +797,7 @@ void assertFunc(ILocoObject obj, TrainStationObject struc) => Assert.Multiple(() Assert.That(struc.NumCompatible, Is.EqualTo(0), nameof(struc.NumCompatible)); Assert.That(struc.ObsoleteYear, Is.EqualTo(65535), nameof(struc.ObsoleteYear)); Assert.That(struc.SellCostFactor, Is.EqualTo(-7), nameof(struc.SellCostFactor)); - Assert.That(struc.TrackPieces, Is.EqualTo(0), nameof(struc.TrackPieces)); + Assert.That(struc.TrackPieces, Is.EqualTo(TrackObjectPieceFlags.None), nameof(struc.TrackPieces)); Assert.That(struc.var_0B, Is.EqualTo(2), nameof(struc.var_0B)); Assert.That(struc.var_0D, Is.EqualTo(0), nameof(struc.var_0D)); });