Class PlotStateExtensions
Convenience tests over PlotState.
public static class PlotStateExtensions
- Inheritance
-
PlotStateExtensions
- Inherited Members
Methods
FromStored(int)
Reads a stored state column back into the enum.
public static PlotState FromStored(int stored)
Parameters
storedintThe integer held in the plot row.
Returns
Remarks
A plain cast is not safe here. The column is an integer, and a row written by a newer build can hold a value this one has no name for — cast blindly, that produces a PlotState matching none of the branches that decide access, and the resulting plot answers "no" to every question including the ones that should be yes.
Unrecognised values become Empty, which is the reading that grants the least: an unclaimed lot people may walk over and nothing more. The alternative — trusting the number — is how a state nobody in this build understands ends up admitting strangers to a house.
IsClaimable(PlotState)
True when a plot in this state may be claimed by somebody.
public static bool IsClaimable(this PlotState state)
Parameters
statePlotState
Returns
Remarks
Both of the unowned states, not just Empty. An abandoned plot that could not be claimed would be land permanently removed from the world by one player having stopped paying for it.
IsHeld(PlotState)
True when this state describes land somebody holds.
public static bool IsHeld(this PlotState state)
Parameters
statePlotState
Returns
OnClaimed()
The state a plot enters when it is claimed.
public static PlotState OnClaimed()
Returns
OnReleased()
The state a plot returns to when its owner gives it up deliberately.
public static PlotState OnReleased()