Class CountryQueries
High-performance country data access layer Provides optimized queries for country/nation information Performance: All basic queries <0.01ms, cached complex queries
public class CountryQueries
- Inheritance
-
objectCountryQueries
Constructors
CountryQueries(CountrySystem, ProvinceSystem, AdjacencySystem)
public CountryQueries(CountrySystem countrySystem, ProvinceSystem provinceSystem, AdjacencySystem adjacencySystem)
Parameters
countrySystemCountrySystemprovinceSystemProvinceSystemadjacencySystemAdjacencySystem
Methods
ClearCache()
Clear all cached data
public void ClearCache()
CompareProvinceCount(ushort, ushort)
Compare two countries by province count Performance target: <0.1ms
public int CompareProvinceCount(ushort countryId1, ushort countryId2)
Parameters
countryId1ushortcountryId2ushort
Returns
- int
Dispose()
public void Dispose()
Exists(ushort)
Check if country exists Performance target: <0.001ms
public bool Exists(ushort countryId)
Parameters
countryIdushort
Returns
- bool
GetAllCountryIds(Allocator)
Get all active country IDs Returns native array that must be disposed by caller Performance target: <1ms
public NativeArray<ushort> GetAllCountryIds(Allocator allocator = Allocator.TempJob)
Parameters
allocatorAllocator
Returns
- NativeArray<ushort>
GetBorderingCountries(ushort, Allocator)
Get all countries that share a border with the specified country. Returns native list that must be disposed by caller. Performance target: O(P × N) where P = provinces, N = ~6 neighbors. Target: less than 15ms.
public NativeList<ushort> GetBorderingCountries(ushort countryId, Allocator allocator)
Parameters
countryIdushortallocatorAllocator
Returns
- NativeList<ushort>
GetBorderingCountries(ushort, NativeList<ushort>)
Get all countries that share a border with the specified country. Zero-allocation variant - fills existing buffer. Performance target: O(P × N) where P = provinces, N = ~6 neighbors. Target: less than 15ms.
public void GetBorderingCountries(ushort countryId, NativeList<ushort> resultBuffer)
Parameters
countryIdushortresultBufferNativeList<ushort>
GetBorderingCountryCount(ushort)
Get the number of countries that share a border with the specified country. Performance target: less than 15ms.
public int GetBorderingCountryCount(ushort countryId)
Parameters
countryIdushort
Returns
- int
GetColdData(ushort)
Get country cold data (detailed information, lazy-loaded) Performance target: <0.1ms if cached, variable if loading
public CountryColdData GetColdData(ushort countryId)
Parameters
countryIdushort
Returns
GetColor(ushort)
Get country color - most common query (must be ultra-fast) Performance target: <0.001ms
public Color32 GetColor(ushort countryId)
Parameters
countryIdushort
Returns
GetCountryStatistics()
Get country statistics for debugging/UI (engine-only data - no game-specific fields) Performance target: <50ms for 256 countries Note: Development statistics removed (game-specific). Use HegemonCountryQueries for game stats.
public CountryStatistics GetCountryStatistics()
Returns
GetGraphicalCulture(ushort)
Get graphical culture ID for unit graphics Performance target: <0.001ms
public byte GetGraphicalCulture(ushort countryId)
Parameters
countryIdushort
Returns
- byte
GetHotData(ushort)
Get complete country hot data (8-byte struct) Performance target: <0.001ms
public CountryHotData GetHotData(ushort countryId)
Parameters
countryIdushort
Returns
GetIdFromTag(string)
Get country ID from tag Performance target: <0.001ms
public ushort GetIdFromTag(string tag)
Parameters
tagstring
Returns
- ushort
GetLandProvinceCount(ushort)
Get total land area (non-ocean provinces) owned by this country Performance target: <0.01ms if cached, <5ms if calculating
public int GetLandProvinceCount(ushort countryId)
Parameters
countryIdushort
Returns
- int
GetProvinceCount(ushort)
Get number of provinces owned by this country Performance target: <0.01ms if cached, <5ms if calculating
public int GetProvinceCount(ushort countryId)
Parameters
countryIdushort
Returns
- int
GetProvinces(ushort, Allocator)
Get provinces owned by this country Returns native array that must be disposed by caller Performance target: <5ms for 10k provinces
public NativeArray<ushort> GetProvinces(ushort countryId, Allocator allocator = Allocator.TempJob)
Parameters
countryIdushortallocatorAllocator
Returns
- NativeArray<ushort>
GetTag(ushort)
Get country tag (3-letter code like "ENG", "FRA") Performance target: <0.001ms
public string GetTag(ushort countryId)
Parameters
countryIdushort
Returns
- string
GetTotalCountryCount()
Get total number of countries in the system Performance target: <0.001ms
public int GetTotalCountryCount()
Returns
- int
HasFlag(ushort, byte)
Check if country has specific flag/feature Performance target: <0.001ms
public bool HasFlag(ushort countryId, byte flag)
Parameters
countryIdushortflagbyte
Returns
- bool
InvalidateCache(ushort)
Clear cache for a specific country (call when country data changes)
public void InvalidateCache(ushort countryId)
Parameters
countryIdushort
SharesBorder(ushort, ushort)
Check if two countries share any border provinces. Uses AdjacencySystem to check if any province of country1 is adjacent to any province of country2. Performance target: O(P × N) where P = provinces, N = ~6 neighbors. Target: less than 10ms.
public bool SharesBorder(ushort countryId1, ushort countryId2)
Parameters
countryId1ushortcountryId2ushort
Returns
- bool