Skip to content

Commit

Permalink
use road piece flags enum in roadextra
Browse files Browse the repository at this point in the history
  • Loading branch information
LeftofZen committed Mar 20, 2024
1 parent 7da5af2 commit 6bcd59b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Core/Objects/RoadExtraObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace OpenLoco.ObjectEditor.Objects
[LocoStringTable("Name")]
public record RoadExtraObject(
[property: LocoStructOffset(0x00), LocoString, Browsable(false)] string_id Name,
[property: LocoStructOffset(0x02)] uint16_t RoadPieces,
[property: LocoStructOffset(0x02)] RoadObjectPieceFlags RoadPieces,
[property: LocoStructOffset(0x04)] uint8_t PaintStyle,
[property: LocoStructOffset(0x05)] uint8_t CostIndex,
[property: LocoStructOffset(0x06)] int16_t BuildCostFactor,
Expand Down
4 changes: 3 additions & 1 deletion Tests/LoadSaveTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using Core.Objects;
using Core.Objects.Sound;
using Microsoft.VisualBasic;
using NUnit.Framework;
using NUnit.Framework.Internal;
using OpenLoco.ObjectEditor.Data;
using OpenLoco.ObjectEditor.DatFileParsing;
using OpenLoco.ObjectEditor.Headers;
using OpenLoco.ObjectEditor.Objects;
using OpenLoco.ObjectEditor.Types;
using static System.Formats.Asn1.AsnWriter;
using Logger = OpenLoco.ObjectEditor.Logging.Logger;

namespace OpenLoco.ObjectEditor.Tests
Expand Down Expand Up @@ -531,7 +533,7 @@ void assertFunc(ILocoObject obj, RoadExtraObject struc) => Assert.Multiple(() =>
Assert.That(struc.BuildCostFactor, Is.EqualTo(4), nameof(struc.BuildCostFactor));
Assert.That(struc.CostIndex, Is.EqualTo(1), nameof(struc.CostIndex));
Assert.That(struc.PaintStyle, Is.EqualTo(1), nameof(struc.PaintStyle));
Assert.That(struc.RoadPieces, Is.EqualTo(127), nameof(struc.RoadPieces));
Assert.That(struc.RoadPieces, Is.EqualTo(RoadObjectPieceFlags.OneWay | RoadObjectPieceFlags.Track | RoadObjectPieceFlags.Slope | RoadObjectPieceFlags.SteepSlope | RoadObjectPieceFlags.Intersection | RoadObjectPieceFlags.OneSided | RoadObjectPieceFlags.Overtake), nameof(struc.RoadPieces));
Assert.That(struc.SellCostFactor, Is.EqualTo(-3), nameof(struc.SellCostFactor));
Assert.That(struc.var_0E, Is.EqualTo(0), nameof(struc.var_0E));
});
Expand Down

0 comments on commit 6bcd59b

Please sign in to comment.