Skip to content

Commit

Permalink
Hide internal flag field
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-zk committed Mar 2, 2024
1 parent fd4d671 commit a0ed028
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions TruckLib/ScsMap/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public Quaternion Rotation
/// </summary>
public IMapObject ForwardItem { get; set; }

protected FlagField Flags;
private FlagField flags;

/// <summary>
/// Gets or sets if this node is red or green.
/// </summary>
public bool IsRed
{
get => Flags[0];
set => Flags[0] = value;
get => flags[0];
set => flags[0] = value;
}

/// <summary>
Expand All @@ -79,53 +79,53 @@ public bool IsRed
/// </summary>
public bool FreeRotation
{
get => Flags[2];
set => Flags[2] = value;
get => flags[2];
set => flags[2] = value;
}

/// <summary>
/// Gets or sets if this node is a country border.
/// </summary>
public bool IsCountryBorder
{
get => Flags[1];
set => Flags[1] = value;
get => flags[1];
set => flags[1] = value;
}

/// <summary>
/// Gets or sets if this node represents a curve locator.
/// </summary>
public bool IsCurveLocator
{
get => Flags[3];
set => Flags[3] = value;
get => flags[3];
set => flags[3] = value;
}

/// <summary>
/// Gets or sets if this node can be moved or deleted in the editor.
/// </summary>
public bool Locked
{
get => Flags[26];
set => Flags[26] = value;
get => flags[26];
set => flags[26] = value;
}

/// <summary>
/// The country of the backward item if this node is a country border.
/// </summary>
public byte BackwardCountry
{
get => Flags.GetByte(2);
set => Flags.SetByte(2, value);
get => flags.GetByte(2);
set => flags.SetByte(2, value);
}

/// <summary>
/// The country of the forward item if this node is a country border.
/// </summary>
public byte ForwardCountry
{
get => Flags.GetByte(1);
set => Flags.SetByte(1, value);
get => flags.GetByte(1);
set => flags.SetByte(1, value);
}

/// <summary>
Expand Down Expand Up @@ -157,7 +157,7 @@ protected virtual void Init()
{
Uid = Utils.GenerateUuid();
rotation = Quaternion.Identity;
Flags = new FlagField();
flags = new FlagField();
}

/// <summary>
Expand Down Expand Up @@ -353,7 +353,7 @@ public void Deserialize(BinaryReader r, uint? version = null)
var fwItemUid = r.ReadUInt64();
ForwardItem = fwItemUid == 0 ? null : (IMapObject)new UnresolvedItem(fwItemUid);

Flags = new FlagField(r.ReadUInt32());
flags = new FlagField(r.ReadUInt32());
}

/// <summary>
Expand All @@ -373,7 +373,7 @@ public void Serialize(BinaryWriter w)
w.Write(BackwardItem is null ? 0UL : BackwardItem.Uid);
w.Write(ForwardItem is null ? 0UL : ForwardItem.Uid);

w.Write(Flags.Bits);
w.Write(flags.Bits);
}

/// <inheritdoc/>
Expand Down

0 comments on commit a0ed028

Please sign in to comment.