Game.Net.RoadFlags
Assembly: Assembly-CSharp (common game assembly)
Namespace: Game.Net
Type: enum (flags)
Base: System.Enum (underlying type: byte)
Summary: RoadFlags is a byte-backed flags enumeration used to describe per-road properties such as alignment halves and lighting state for road segments in the game. The enum is decorated with [Flags], so values can be combined using bitwise operations to represent multiple boolean-like states simultaneously.
Fields
-
StartHalfAligned = 1
Indicates the start half of the road segment is aligned (bit 0). -
EndHalfAligned = 2
Indicates the end half of the road segment is aligned (bit 1). -
IsLit = 4
Indicates that the road currently has lighting enabled (bit 2). This can represent whether lights are currently on for that road. -
AlwaysLit = 8
Indicates the road is configured to always be lit regardless of other conditions (bit 3). -
LightsOff = 0x10
Indicates lights are forcibly off for this road (bit 4).
Properties
- None.
(Being an enum, RoadFlags exposes no custom properties. Use bitwise operations or Enum helper methods to inspect values.)
Constructors
- None (enums are value types with implicit default values).
(Default value is 0, which means none of the flags are set.)
Methods
- None defined on this enum type.
(You can use System.Enum methods and extension methods such as Enum.HasFlag, or simple bitwise checks and operations: & | ^ ~.)
Usage Example
// Define a variable with multiple flags set
RoadFlags flags = RoadFlags.StartHalfAligned | RoadFlags.IsLit;
// Check a flag using bitwise test
bool isStartAligned = (flags & RoadFlags.StartHalfAligned) != 0;
// Check a flag using Enum.HasFlag (slightly slower but clearer)
bool isLit = flags.HasFlag(RoadFlags.IsLit);
// Set a flag
flags |= RoadFlags.AlwaysLit;
// Clear a flag
flags &= ~RoadFlags.IsLit;
// Toggle a flag
flags ^= RoadFlags.LightsOff;
// Example: ensure LightsOff and AlwaysLit are not both set at the same time
if (flags.HasFlag(RoadFlags.LightsOff) && flags.HasFlag(RoadFlags.AlwaysLit))
{
// resolve conflict: prefer LightsOff (clear AlwaysLit)
flags &= ~RoadFlags.AlwaysLit;
}
Additional notes: - Because the enum is backed by a byte, store/serialize accordingly when saving network or binary data. - When combining flags, be mindful of conflicting states (for example AlwaysLit vs LightsOff) and handle resolution in code logic.