Game.EmergencyShelterFlags
Assembly: Assembly-CSharp.dll (game code)
Namespace: Game.Buildings
Type: enum (with [Flags] attribute)
Base: System.Enum (underlying type: byte)
Summary:
Bit flags that represent the state of an emergency shelter. Marked with the [Flags] attribute so values can be combined with bitwise operations. The underlying storage is a single byte, which is efficient for memory but means values must fit in the byte range.
Fields
-
HasAvailableVehicles = 1
Flag indicating the shelter has available vehicles (e.g., evacuation vehicles) ready. -
HasShelterSpace = 2
Flag indicating the shelter has spare capacity / shelter space available.
Properties
- This enum defines no properties.
Constructors
- Enums do not define explicit constructors. Instances are created by assignment or casting from the underlying integral type.
Methods
- The enum itself defines no custom methods. Standard System.Enum methods apply (e.g., ToString(), HasFlag(), Enum.TryParse(), etc.). For performance-sensitive checks, prefer bitwise operations (see usage).
Usage Example
// Create a flags value with both flags set
EmergencyShelterFlags flags = EmergencyShelterFlags.HasAvailableVehicles | EmergencyShelterFlags.HasShelterSpace;
// Check for a single flag (preferred: bitwise)
bool hasVehicles = (flags & EmergencyShelterFlags.HasAvailableVehicles) != 0;
// Alternative using Enum.HasFlag (works but slightly slower)
bool hasSpace = flags.HasFlag(EmergencyShelterFlags.HasShelterSpace);
// Add a flag
flags |= EmergencyShelterFlags.HasAvailableVehicles;
// Remove a flag
flags &= ~EmergencyShelterFlags.HasShelterSpace;
// Toggle a flag
flags ^= EmergencyShelterFlags.HasAvailableVehicles;
// Example conditional
if ((flags & EmergencyShelterFlags.HasShelterSpace) != 0)
{
// allocate new shelter occupant
}
{{ Additional notes: - Because the enum uses [Flags], combined values will be shown as a comma-separated list by ToString(), e.g. "HasAvailableVehicles, HasShelterSpace". - Keep in mind the underlying type is byte; when serializing, storing, or casting, ensure values remain within byte range. - Prefer bitwise operations for performance-critical code (HasFlag uses boxing/reflection internally). }}