Skip to content

Game.Zones.CellFlags

Assembly:
Namespace: Game.Zones

Type: enum (flags)

Base: System.Enum (underlying type: System.UInt16)

Summary:
CellFlags is a bitmask enum (marked with [Flags]) used to represent various boolean states for a zoning cell in the Game.Zones subsystem. Each flag occupies a distinct bit in a 16-bit value so multiple states can be combined with bitwise operations. Typical uses include marking whether a cell is blocked, visible, part of a road, currently being updated, selected in the editor, etc.


Fields

  • None = 0
    Represents no flags set.

  • Blocked = 1
    Indicates the cell is blocked (not available for zoning/placement).

  • Shared = 2
    Marks the cell as shared (used by multiple systems or owners).

  • Roadside = 4
    Marks the cell as adjacent to a road or as part of the roadside zone.

  • Visible = 8
    Indicates the cell is currently visible (e.g., not culled or hidden by the view).

  • Overridden = 0x10
    (16) Indicates a manual override on this cell, typically set when user/tool overrides automatic behavior.

  • Occupied = 0x20
    (32) Indicates the cell is occupied (by a building, object, or temporary occupation).

  • Selected = 0x40
    (64) Marks the cell as selected in the editor or UI selection.

  • Redundant = 0x80
    (128) Used to mark redundant/duplicate cells or states that may be subject to cleanup.

  • Updating = 0x100
    (256) Indicates the cell is currently being updated by a background process or job.

  • RoadLeft = 0x200
    (512) Directional/positional flag indicating a road exists to the left of the cell.

  • RoadRight = 0x400
    (1024) Directional/positional flag indicating a road exists to the right of the cell.

  • RoadBack = 0x800
    (2048) Directional/positional flag indicating a road exists behind the cell.

Properties

  • This enum type does not define properties. Use bitwise operations or Enum.HasFlag for queries.

Constructors

  • Enums do not define explicit constructors. Values are represented by the underlying ushort storage.

Methods

  • No instance methods are defined on the enum. Use standard enum helpers and bitwise operators:
  • (flags & CellFlags.SomeFlag) != 0
  • flags.HasFlag(CellFlags.SomeFlag) (note: HasFlag is slower and uses boxing)

Usage Example

// Combine flags
CellFlags flags = CellFlags.Roadside | CellFlags.Visible;

// Check flags (fast bitwise)
if ((flags & CellFlags.RoadLeft) != 0)
{
    // road on left
}

// Check flags (convenient but slower due to boxing)
if (flags.HasFlag(CellFlags.Visible))
{
    // cell is visible
}

// Set a flag
flags |= CellFlags.Selected;

// Clear a flag
flags &= ~CellFlags.Selected;

// Store as underlying ushort (if needed for native interop or serialization)
ushort raw = (ushort)flags;
CellFlags restored = (CellFlags)raw;

Additional notes: - Because the enum's underlying type is ushort, it fits into 16 bits. Avoid adding flags that exceed the 0x800 bit without changing the underlying type. - Prefer bitwise checks for performance-critical code (e.g., inner loops, jobs). Use HasFlag only for clarity in non-performance-critical paths.