Game.Areas.AreaFlags
Assembly:
Assembly-CSharp (typical for Cities: Skylines 2 / Unity mods)
Namespace: Game.Areas
Type: enum (with [Flags] attribute)
Base: System.Enum (underlying type: System.Byte)
Summary: AreaFlags is a byte-based bitmask enumeration used to describe properties or state flags for an Area in the Game.Areas namespace. The [Flags] attribute indicates that values can be combined with bitwise operations to represent multiple boolean properties at once (e.g., Complete | CounterClockwise). Each member occupies a single bit so flags can be efficiently stored and tested.
Fields
-
Complete = 1
Indicates the area is complete/finished. As the lowest bit (0x01) it can be combined with other flags. -
CounterClockwise = 2
Likely denotes the winding order of the area's polygon (counter-clockwise). Stored as bit 0x02 so it can be combined with other flags. -
NoTriangles = 4
Indicates the area should not generate triangles (e.g., skip triangulation or rendering). Stored as bit 0x04. -
Slave = 8
Indicates the area is a slave/subordinate area (possibly linked to a master area). Stored as bit 0x08.
Properties
- None declared on this enum. Use bitwise operations or Enum methods to inspect values.
Constructors
- None declared. Enums have implicit default values; the default value is 0 (no flags set).
Methods
- None declared specifically for AreaFlags. Use standard Enum and bitwise operations:
- areaFlags.HasFlag(AreaFlags.Complete)
- (areaFlags & AreaFlags.NoTriangles) != 0
- areaFlags |= AreaFlags.Slave
- areaFlags &= ~AreaFlags.Slave
Usage Example
// Create a flags value combining Complete and CounterClockwise
AreaFlags flags = AreaFlags.Complete | AreaFlags.CounterClockwise;
// Test for a flag (recommended: bitwise test for performance in hot code)
bool isComplete = (flags & AreaFlags.Complete) != 0;
// Add a flag
flags |= AreaFlags.NoTriangles;
// Remove a flag
flags &= ~AreaFlags.CounterClockwise;
// Alternative check using Enum.HasFlag (slower but clearer)
bool hasNoTriangles = flags.HasFlag(AreaFlags.NoTriangles);
// Example output
Console.WriteLine(flags); // e.g., "Complete, NoTriangles"
Notes: - Because the enum is defined with [Flags] and an explicit underlying type of byte, it is compact and suitable for packing into byte fields or serialized structures. - Prefer bitwise checks ((flags & flag) != 0) in performance-sensitive code (e.g., within tight update loops). Enum.HasFlag is more convenient but has some overhead.