Class ProvinceHistoryData
- Namespace
- StarterKit
- Assembly
- StarterKit.dll
Cold data storage for a single province's history. Uses CircularBuffer to prevent unbounded memory growth.
Access pattern: Loaded on-demand when player clicks province. NOT accessed every frame - this is the key distinction from hot data.
public class ProvinceHistoryData
- Inheritance
-
objectProvinceHistoryData
Constructors
ProvinceHistoryData(ushort)
public ProvinceHistoryData(ushort provinceId)
Parameters
provinceIdushort
Properties
ProvinceId
public ushort ProvinceId { get; }
Property Value
- ushort
Methods
GetCurrentOwnerFromHistory()
Get the current owner from history (or 0 if no history). Note: For current owner, use ProvinceState.ownerID (hot data) instead. This is just for completeness of the history record.
public ushort GetCurrentOwnerFromHistory()
Returns
- ushort
GetHistory()
Get ownership history (most recent first). Returns empty list if no history recorded.
public IReadOnlyList<OwnershipRecord> GetHistory()
Returns
- IReadOnlyList<OwnershipRecord>
GetOwnershipChangeCount()
Get number of times this province changed hands.
public int GetOwnershipChangeCount()
Returns
- int
GetPreviousOwner()
Get previous owner (before current). Useful for "reclaimed from X" messages.
public ushort GetPreviousOwner()
Returns
- ushort
RecordOwnershipChange(ushort, int)
Record a new owner for this province. Called when ownership changes - closes previous record and opens new one.
public void RecordOwnershipChange(ushort newOwnerId, int gameDay)
Parameters
newOwnerIdushortgameDayint
WasOwnedBy(ushort)
Check if province was ever owned by a specific country.
public bool WasOwnedBy(ushort countryId)
Parameters
countryIdushort
Returns
- bool