Class DiplomacyKeyHelper
ENGINE LAYER - Helper for packing/unpacking country pairs into relationship keys. PATTERN: Static utility class (no state). Ensures consistent key generation (always smaller ID first). Prevents duplicate relationships (A to B and B to A use same key). KEY FORMAT: ulong 64 bits, country1 always less than country2 (normalized order).
public static class DiplomacyKeyHelper
- Inheritance
-
objectDiplomacyKeyHelper
Methods
GetKey(ushort, ushort)
Pack two country IDs into a single ulong key Ensures country1 is less than country2 for consistent ordering
public static ulong GetKey(ushort country1, ushort country2)
Parameters
country1ushortcountry2ushort
Returns
- ulong
UnpackKey(ulong)
Unpack a relationship key into two country IDs Returns (country1, country2) where country1 is less than country2
public static (ushort, ushort) UnpackKey(ulong key)
Parameters
keyulong
Returns
- (ushort, ushort)