Skip to content

Game.Routes.TransportLineFlags

Assembly: Assembly-CSharp
Namespace: Game.Routes

Type: public enum

Base: System.Enum (underlying type: ushort)

Summary:
TransportLineFlags is a bitmask-style enumeration (marked with [Flags]) used to represent small boolean/state flags for a transport line. Each member is a single-bit flag stored in a 16-bit unsigned integer (ushort). Typical usage is to combine flags with bitwise operations to represent multiple states (for example, "require vehicles" and "not enough vehicles") on a transport line.


Fields

  • RequireVehicles = 1
    Indicates that the transport line currently requires vehicles. This flag is the low bit (0x0001). Mods can check this flag to know whether the line is marked as needing vehicles (for dispatch, UI warnings, or logic).

  • NotEnoughVehicles = 2
    Indicates that the transport line does not have enough vehicles to operate properly. This is the second bit (0x0002). It can be used to show shortages, influence scheduling, or trigger vehicle allocation logic.

Properties

  • None
    This enum does not define properties. It uses standard enum behavior from System.Enum.

Constructors

  • None
    Enums do not expose constructors. Values are implicitly convertible to/from the underlying ushort when needed (with casting).

Methods

  • None (uses System.Enum / bitwise operations)
    There are no instance methods defined on this enum. Typical operations are bitwise checks and combinations (|, &, ~). Standard System.Enum methods (ToString, HasFlag, etc.) are available.

Usage Example

// Create and combine flags
TransportLineFlags flags = TransportLineFlags.RequireVehicles | TransportLineFlags.NotEnoughVehicles;

// Check if a flag is set
bool needsVehicles = (flags & TransportLineFlags.RequireVehicles) != 0;
// or using Enum.HasFlag (note: slower boxing)
bool notEnough = flags.HasFlag(TransportLineFlags.NotEnoughVehicles);

// Set a flag
flags |= TransportLineFlags.RequireVehicles;

// Clear a flag
flags &= ~TransportLineFlags.NotEnoughVehicles;

// Storing/loading to a ushort (e.g., saving or interoperating with native code)
ushort raw = (ushort)flags;
TransportLineFlags fromRaw = (TransportLineFlags)raw;

{{ Additional notes: - Because the enum is backed by ushort, ensure casting to/from ushort when writing to compact storage or native structures. - As further flags are added, keep them as distinct power-of-two values to preserve bitmask semantics (4, 8, 16, etc.). - Prefer bitwise checks for performance-critical code; HasFlag boxes the enum and is slower. }}