Skip to content

Game.Areas.AreaTypeMask

Assembly: Assembly-CSharp.dll
Namespace: Game.Areas

Type: public enum

Base: System.Enum

Summary: AreaTypeMask is a [Flags] enum used to represent one or more area categories in a compact bitmask form. Each member corresponds to a different "area" concept used by the game (e.g., lots, districts, map tiles, spaces, surfaces). Because it is marked with the Flags attribute, values can be combined with bitwise OR to create masks for filtering, querying, or applying operations to multiple area types simultaneously.


Fields

  • None = 0
    Represents no area types selected. Useful as a default or to indicate an empty mask.

  • Lots = 1
    Represents lot areas (value 1).

  • Districts = 2
    Represents district areas (value 2).

  • MapTiles = 4
    Represents map tile areas (value 4).

  • Spaces = 8
    Represents space areas (value 8).

  • Surfaces = 0x10
    Represents surface areas (value 16). Note: 0x10 is hexadecimal for 16 (1 << 4), keeping each value as a distinct bit for combination.

Properties

  • This enum defines no properties. Use standard enum/bitmask patterns and System.Enum methods (e.g., HasFlag, ToString) to inspect values.

Constructors

  • Enums do not define explicit constructors in source. Values are created/assigned by name or by casting/integer assignment (for example: AreaTypeMask mask = AreaTypeMask.Lots | AreaTypeMask.Districts).

Methods

  • No instance methods are defined here. Use inherited System.Enum/System.ValueType/Object methods as needed:
  • HasFlag(AreaTypeMask flag) — checks whether a specific flag is set.
  • ToString() — returns the textual representation, which for flagged enums will list combined names.
  • Standard bitwise operations (&, |, ~, ^) may be used to manipulate masks.

Usage Example

// Combine flags to create a mask that includes Lots and Districts
AreaTypeMask mask = AreaTypeMask.Lots | AreaTypeMask.Districts;

// Check using HasFlag (easy to read)
if (mask.HasFlag(AreaTypeMask.Lots))
{
    // handle lots
}

// Check using bitwise operator (slightly faster)
if ((mask & AreaTypeMask.Districts) != 0)
{
    // handle districts
}

// Add another flag
mask |= AreaTypeMask.MapTiles;

// Remove a flag
mask &= ~AreaTypeMask.Districts;

// Test for empty
if (mask == AreaTypeMask.None)
{
    // nothing selected
}

Additional notes: - Ensure values remain power-of-two constants so they represent independent bits; currently they are 0, 1, 2, 4, 8, 16. - Use this mask type when APIs accept or return combined area types (filtering, bulk updates, queries).