Game.Simulation.MaintenanceType
Assembly: Assembly-CSharp
Namespace: Game.Simulation
Type: public enum (with [Flags])
Base: System.Enum (underlying type: System.Byte)
Summary:
MaintenanceType is a bitflag enum that represents different categories of maintenance tasks in the simulation (park, road, snow, vehicle). The [Flags] attribute allows combining multiple maintenance types into a single value. A None value (0) represents no maintenance flags set.
Fields
-
Park = 1
Represents park-related maintenance. -
Road = 2
Represents road-related maintenance. -
Snow = 4
Represents snow-related maintenance (e.g., plowing). -
Vehicle = 8
Represents vehicle-related maintenance. -
None = 0
No maintenance flags set. This is the default/empty value.
Properties
- This enum type has no instance properties. Use bitwise operations or Enum.HasFlag to query combined flags.
Constructors
- Enums do not define typical constructors. The default value is
None
(0). Individual named values (Park, Road, etc.) are the valid enum values.
Methods
- There are no custom methods defined on this enum. Standard System.Enum / System.ValueType methods are available (ToString, HasFlag, CompareTo, etc.). For flag testing and manipulation prefer bitwise operations for performance:
- Test:
(value & MaintenanceType.Road) == MaintenanceType.Road
- Test with built-in:
value.HasFlag(MaintenanceType.Road)
(boxes the enum) - Set:
value |= MaintenanceType.Snow
- Clear:
value &= ~MaintenanceType.Road
Usage Example
// Combining flags
MaintenanceType current = MaintenanceType.Park | MaintenanceType.Road;
// Check for a specific flag (recommended: bitwise test for performance)
bool hasRoad = (current & MaintenanceType.Road) == MaintenanceType.Road;
// Using HasFlag (convenient but may allocate/box)
bool hasPark = current.HasFlag(MaintenanceType.Park);
// Add a flag
current |= MaintenanceType.Snow;
// Remove a flag
current &= ~MaintenanceType.Road;
// Check for no flags
if (current == MaintenanceType.None) { /* nothing to maintain */ }