Game.TilePurchaseErrorFlags
Assembly:
Namespace: Game.Simulation
Type: enum
Base: System.Enum
Summary:
TilePurchaseErrorFlags is a [Flags] enum representing possible reasons why a tile purchase operation can fail in Cities: Skylines 2. Each named value is a bit flag so multiple error reasons can be combined into a single value. Use bitwise operations to test for, set, or clear specific error flags.
Fields
-
None = 0
Represents no error / purchase allowed. -
NoCurrentlyAvailable = 1
A tile currently cannot be purchased (e.g., temporary state preventing purchases). -
NoAvailable = 2
No tiles are available for purchase (general availability restriction). -
NoSelection = 4
No tile has been selected for purchase. -
InsufficientFunds = 8
The player does not have enough money to buy the tile. -
InsufficientPermits = 0x10
The player lacks required permits/licenses to buy the tile.
Properties
- (none)
This enum has no properties. It is a plain flags enum; interact with it using standard enum and bitwise semantics.
Constructors
- (none)
Enums do not define constructors in C#; values are created by assigning the enum members or combinations thereof.
Methods
-
(none declared)
There are no instance methods on the enum itself. Common operations are performed using bitwise operators or helper APIs: -
Check if a specific flag is set: if ((errors & TilePurchaseErrorFlags.InsufficientFunds) != 0) { ... }
-
Check for no errors: if (errors == TilePurchaseErrorFlags.None) { ... }
-
Add a flag: errors |= TilePurchaseErrorFlags.NoSelection;
-
Remove a flag: errors &= ~TilePurchaseErrorFlags.NoSelection;
Usage Example
// Combine multiple error reasons
TilePurchaseErrorFlags errors = TilePurchaseErrorFlags.NoAvailable | TilePurchaseErrorFlags.InsufficientFunds;
// Test for a specific reason
if ((errors & TilePurchaseErrorFlags.InsufficientFunds) != 0)
{
// Prompt the player to add funds or cancel the purchase
}
// Test for any error
bool hasAnyError = errors != TilePurchaseErrorFlags.None;
// Clear a flag (e.g., after funds are added)
errors &= ~TilePurchaseErrorFlags.InsufficientFunds;