Home › Dev CE (experimental) › Game
Experimental: needs Dev CE (
fork of the Community Extension, release zip and source). A GameCore that adds these Lua methods by calling engine functions directly. Not part of the upstream Community Extension, single-player testing only. Descriptions on these pages were written by an AI assistant from decompiled code and are marked inferred unless a test result confirms them.
Game
55 methods (Dev CE test build). this is found with the game's own IGame instance resolver (plain).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| AttachScoreListeners |
Game:AttachScoreListeners() |
Iterates the EmergencyScoreSource definitions and subscribes lambda listeners to game message signals for each source, storing the handles in the manager's handle vector; decompilation is truncated so the full set of signals is not visible. |
— |
— |
0x198100 |
| BuildCivics |
Game:BuildCivics() |
Builds the game's civic tree data: clears and repopulates the civic node list, choosing a random cost from the CivicRandomCost definitions where available. |
— |
Game::Culture::BuildCivics |
0x1c71c0 |
| BuildTechs |
Game:BuildTechs() |
Builds the tech tree data: clears and repopulates the tech node list, choosing a random cost from the TechnologyRandomCost definitions where available. |
— |
Game::Techs::BuildTechs |
0x2502e0 |
| CalculateMaxTurn |
Game:CalculateMaxTurn() → number |
Computes the maximum turn from the turn limit setting: none gives 0, custom uses configured max turns, otherwise sums game speed turn segments, falling back to 500. |
— |
— |
0x63cb40 |
| CalculatePlayerControlledResources |
Game:CalculatePlayerControlledResources() |
Recounts, for each player allowed to use the economy, how many extractable resource plots they and their suzerain city-states control, storing per-resource counts in the manager; decompilation is truncated. |
— |
— |
0x62b0a0 |
| CalculatePurchaseCostFromProductionCost |
Game:CalculatePurchaseCostFromProductionCost(iProductionCost: integer, ePurchaseYield: integer) → number |
Computes purchase cost as production cost times a global multiplier, additionally multiplied by a second global factor when the yield is gold. |
— |
— |
0x36f9a0 |
| CalculateResourceMonopolies |
Game:CalculateResourceMonopolies() |
For each resource and player, checks monopoly status and updates the monopoly owner and count; dispatches gained/lost signals and logs; decompilation is truncated. |
— |
— |
0x62b4a0 |
| CanAddGreatWork |
Game:CanAddGreatWork(eGreatPerson: integer) → boolean |
Returns true if a great person individual has at least one associated great work that has not yet been created. |
— |
— |
0x1c7c20 |
| CanCreateNewProduct |
Game:CanCreateNewProduct(ePlayer: integer, eResource: integer) → boolean |
Returns true if at least one product great work linked to the resource's improvement type has not yet been created. |
— |
— |
0x62bae0 |
| CheckForEndingDroughts |
Game:CheckForEndingDroughts() |
Copies the list of active droughts, and for each one whose end turn has been reached looks up its random event, sends a notification to players and marks the drought inactive; decompilation is truncated. |
— |
— |
0x1ba250 |
| ClearLists |
Game:ClearLists() |
Empties the player manager's cached player lists by resetting the end pointer of about 23 vectors to their begin pointer, and frees the team-to-players hash table nodes. |
— |
Player::Manager::ClearLists |
0x3065e0 |
| CreateComponents |
Game:CreateComponents() |
Creates the game instance's component objects: global parameters, registered components, AI, victory manager, analysis manager and game summary, storing pointers in the instance. |
— |
— |
0x63cc10 |
| DecrementGameStateLock |
Game:DecrementGameStateLock() → number |
Decrements the game-state lock counter; when it reaches zero a signal with false is dispatched to say the state is unlocked. |
— |
Game::Instance::DecrementGameStateLock |
0x63cee0 |
| DetachScoreListeners |
Game:DetachScoreListeners() |
Unsubscribes and destroys every message handle stored in the manager's handle vector, then resets the count to zero. |
— |
— |
0x199990 |
| DoActiveOneOffs |
Game:DoActiveOneOffs() |
Copies the active one-off climate events; for each, if still within its duration applies its effects and sends a notification, otherwise marks it inactive. |
— |
— |
0x1bb4d0 |
| DoTurn |
Game:DoTurn() |
Per-turn emergency processing: if the emergency capability is enabled, it walks the emergency alliance definitions and the manager's emergency list, builds a temporary array and may call ConfirmEmergency; decompilation is truncated so details are incomplete. |
— |
— |
0x199b80 |
| GetCorporationPlayer |
Game:GetCorporationPlayer(eResource: integer) → number |
Scans the corporation list and returns the player whose corporation matches the resource. |
— |
— |
0x62d510 |
| GetCurrentTurnDeforestationPoints |
Game:GetCurrentTurnDeforestationPoints() → number |
Computes a deforestation score from features removed minus forests placed across players, finds the matching DeforestationLevel by percentage, stores a control-priority value, and returns the level's points. |
— |
— |
0x1bd6f0 |
| GetFirstTurnActiveHuman |
Game:GetFirstTurnActiveHuman() → number |
Returns the first human player flagged active this turn (byte at +0x288), or -1. |
— |
— |
0x306d80 |
| GetFreeGreatWorkForSlot |
Game:GetFreeGreatWorkForSlot(eGreatPerson: integer, eSlot: integer, eObject: integer) → number |
Searches great work definitions for one not yet created that belongs to the given great person and whose object type fits the slot; returns its type. |
— |
— |
0x1c8500 |
| GetGameEndTurn |
Game:GetGameEndTurn() → number |
Returns the turn on which the game ends from the turn limit type, start turn and the stored value; 0 if no limit. |
— |
— |
0x63d0e0 |
| GetGoldFromMonopolies |
Game:GetGoldFromMonopolies(ePlayer: integer) → number |
Sums gold from the player's resource monopolies using tiers by control percentage, plus a bonus per other player with a trade route to them. |
— |
— |
0x62d5c0 |
| GetHappinessGrowthModifier |
Game:GetHappinessGrowthModifier(eHappiness: integer) → number |
Returns the growth modifier of a happiness (amenity) level definition as an 8-bit fixed point value, or 0 if the type is invalid or the definition flag is unset. |
— |
— |
0x371180 |
| GetHappinessIdentityPerTurnChange |
Game:GetHappinessIdentityPerTurnChange(eHappiness: integer) → number |
Looks up the Happiness_XP1 definition by hash of the happiness type and returns an int field (+0x1c) used as identity per-turn change; 0 if missing. |
— |
— |
0x371220 |
| GetHappinessInEra |
Game:GetHappinessInEra(eResource: integer, eEra: integer) → number |
Returns a resource base amenity value reduced by era distance: base minus abs(resource era - given era) times a global per-era penalty, floored at a global minimum. |
— |
— |
0x371260 |
| GetHousingSurplusReduction |
Game:GetHousingSurplusReduction(iPopDifference: integer) → number |
Returns a fixed-point housing surplus reduction depending on how the population difference compares to global thresholds: 0, 0.25, 0.5 or 1.0. |
— |
— |
0x371420 |
| GetMaxVoteswithFavor |
Game:GetMaxVoteswithFavor(maxFavor: integer) → number |
Computes max World Congress votes from favor: 1 if favor <= 0, else (sqrt(4favor/gameSpeedAdjusted(5)+1)+1)0.5 truncated. |
— |
— |
0x371500 |
| GetNumControlledResources |
Game:GetNumControlledResources(ePlayer: integer, eResource: integer) → number |
Returns the stored count of controlled plots of a resource for a player. |
— |
— |
0x62d7a0 |
| GetNumCorporations |
Game:GetNumCorporations(ePlayer: integer, bActiveOnly: boolean) → number |
Counts corporation list entries owned by the player; bActiveOnly is not used. |
— |
— |
0x62d7c0 |
| GetNumIndustries |
Game:GetNumIndustries(ePlayer: integer, bActiveOnly: boolean) → number |
Counts industry entries owned by the player; bActiveOnly is not used. |
— |
— |
0x62d880 |
| GetNumRollsForResult |
Game:GetNumRollsForResult(iLowRoll: integer, iHighRoll: integer) → number |
Sums entries of a global three-dice-six probability table (iThreeDieSixProb) from iLowRoll to iHighRoll inclusive, giving the number of dice combinations producing that range. |
— |
— |
0x373f10 |
| GetNumTechs |
Game:GetNumTechs() → number |
Returns the number of technology definitions. |
— |
— |
0x251320 |
| GetScaledWeightForMap |
Game:GetScaledWeightForMap(iInitialWeight: integer) → number |
Scales a weight by the current map's plot count relative to the standard map size definition. |
— |
— |
0x1be810 |
| GetStormDirection |
Game:GetStormDirection(iCurrentLocation: integer) → number |
Picks a storm direction for a plot by collecting prevailing wind definitions whose latitude range covers the plot and making a weighted random choice. |
— |
— |
0x1be930 |
| GetStormNearestPlayer |
Game:GetStormNearestPlayer(iPlotIndex: integer) → number |
Returns the owner of a plot if a major player owns it, otherwise the player whose closest city (or fallback start location) is nearest the plot. |
— |
— |
0x1beb50 |
| HasAvailableBuildingForProduct |
Game:HasAvailableBuildingForProduct(ePlayer: integer) → boolean |
Returns true if any city of the player has a free product great work slot. |
— |
— |
0x62e550 |
| HasGreatWorkBeenCreated |
Game:HasGreatWorkBeenCreated(eWork: integer) → boolean |
Returns true if the given great work type is in the culture manager's created great works list. |
— |
— |
0x1c87d0 |
| HasIndustryOf |
Game:HasIndustryOf(ePlayer: integer, eResource: integer) → boolean |
Returns true if the player has an industry for the resource. |
— |
— |
0x62e5c0 |
| HasResourceMonopolyOf |
Game:HasResourceMonopolyOf(ePlayer: integer, eResource: integer) → boolean |
Returns true if the player controls enough of a luxury resource to meet the monopoly threshold from global parameters. |
— |
— |
0x62e5f0 |
| IncrementGameStateLock |
Game:IncrementGameStateLock() → number |
Increments a game-state lock counter; on the first increment (0 to 1) dispatches a signal with true to notify listeners that the game state is locked. |
— |
Game::Instance::IncrementGameStateLock |
0x63d1a0 |
| IsAI |
Game:IsAI(ePlayer: integer) → boolean |
Returns whether the player is a AI player, false for invalid ids. |
— |
— |
0x307850 |
| IsActive |
Game:IsActive() → boolean |
Returns whether capability hash 0x10c40410 (economic system) is enabled. |
— |
— |
0x62e7e0 |
| IsAiProcessing |
Game:IsAiProcessing() → boolean |
Returns false when the AI counter is not positive; otherwise returns false if an active non-human player in a non-multiplayer game has pending diplomacy sessions, statements, actions or deals, else true. |
— |
— |
0x63d910 |
| IsBarbarian |
Game:IsBarbarian(ePlayer: integer) → boolean |
Returns whether the player is a barbarian player, false for invalid ids. |
— |
— |
0x3078b0 |
| IsFreeCities |
Game:IsFreeCities(ePlayer: integer) → boolean |
Returns whether the player is a free cities player, false for invalid ids. |
— |
— |
0x3078e0 |
| IsMajor |
Game:IsMajor(ePlayer: integer) → boolean |
Returns whether the player is a major civ player, false for invalid ids. |
— |
— |
0x307950 |
| IsMinor |
Game:IsMinor(ePlayer: integer) → boolean |
Returns whether the player is a city-state player, false for invalid ids. |
— |
— |
0x307980 |
| IsSpecialtyDistrict |
Game:IsSpecialtyDistrict(eDistrict: integer) → boolean |
Returns bit 6 of a flags byte (+0xe1) in the district definition, i.e. whether the district is a specialty district. |
— |
— |
0x3715b0 |
| IsTerrainValid |
Game:IsTerrainValid(eEventType: integer, eTerrain: integer) → boolean |
Checks whether a random event can occur on a terrain: true if the terrain is in the event's terrain list, or the list is empty. |
— |
— |
0x1bfe70 |
| IsValidObjectForSlot |
Game:IsValidObjectForSlot(eSlot: integer, eObject: integer) → boolean |
Returns true if a GreatWork_ValidSubType row pairs the given slot type with the given object type. |
— |
— |
0x1c89d0 |
| MoveActiveStorms |
Game:MoveActiveStorms() |
Copies the active storm list and advances each storm: computes next plot and direction, applies storm effects, updates storm data and sends notifications; decompilation is truncated. |
— |
— |
0x1c0090 |
| ResetPlayerTurnResourceConsumption |
Game:ResetPlayerTurnResourceConsumption(ePlayer: integer) |
Zeroes two per-player counters (fields 3 and 5 of the 24-byte entry) for the matching player in the climate resource consumption table. |
— |
— |
0x1c0b90 |
| SetAsObserver |
Game:SetAsObserver(ePlayer: integer) |
Turns a human player slot into an observer: sets configuration slot status to 4, sends a configuration event and notifies the player-type processor; if it is the local player, resets the field at 0x2dac to 1000 and swaps visibility. |
— |
— |
0x308a80 |
| SetLocalPlayerTo |
Game:SetLocalPlayerTo(ePlayer: integer) → boolean |
Sets which player is the local (viewing) player and the secondary observer slot, then refreshes visibility for the new player. |
— |
Player::Manager::SetLocalPlayerTo |
0x308ca0 |
| SetPaused |
Game:SetPaused(gamePaused: boolean) |
Stores the paused flag on the game instance and sends a reporting event with it. |
— |
— |
0x63e0e0 |
Details
AttachScoreListeners
Writes
- handle vector at this+0x18/0x28 (appends subscription handles)
- signal listener counts on the game message hub (offset 0x280 object)
Side effects
- registers callbacks that fire on later game events (e.g. project/district signals)
Input checks: No parameters; skips sources lacking the relevant optional fields.
Multiplayer: may-desync, registers gameplay callbacks that change emergency scores. Risk: high (Adds persistent signal subscriptions; calling twice duplicates listeners.). Confidence of the reading: low.
BuildCivics
Writes
- civic node vector at this+0xa8
- second list at this+0xd8 reset
Side effects
- uses seeded game random numbers ('Choosing a random cost for a civic to have')
- allocates temporary arrays
Input checks: Does nothing beyond clearing if the current game is null; null definitions skipped.
Preconditions
- game start / initialisation
- game thread
Multiplayer: safe-deterministic. Risk: medium (rebuilds core civic tree data; uses synced RNG). Confidence of the reading: low.
Verified from the code
- clears the list at this+0xa8 and resets list at +0xd8
- draws a random number labelled for civic cost choice
- candidate costs capped by a count of 6 per base cost
Inferred
- later part likely builds prerequisites (random label mentions prerequisites)
Open questions
- decompilation truncated; prerequisite handling unseen
BuildTechs
Writes
- tech node vector at this+0xa8
- second list at this+0xd8 reset
Side effects
- uses seeded game random numbers ('Choosing a random cost for a tech to have')
- allocates temporary arrays
Input checks: Does nothing beyond clearing if the current game is null; null definitions skipped.
Preconditions
- game start / initialisation
- game thread
Multiplayer: safe-deterministic. Risk: medium (rebuilds core tech tree data; uses synced RNG). Confidence of the reading: low.
Verified from the code
- clears the list at this+0xa8 and resets list at +0xd8
- draws a random number labelled for tech cost choice
- candidate costs capped by a count of 7 per base cost
Inferred
- near-identical to BuildCivics, applied to techs
Open questions
- decompilation truncated; prerequisite handling unseen
CalculateMaxTurn
Input checks: Falls back to 500 for missing data.
Multiplayer: read-only, config computation. Risk: low (Pure computation.). Confidence of the reading: medium.
CalculatePlayerControlledResources
Writes
- per-player controlled resource counts (VariantMap at this+0x100)
Input checks: Skips players not allowed to use economy or out of table range.
Multiplayer: may-desync, rewrites synced economic data. Risk: medium (Recomputes synced counters.). Confidence of the reading: medium.
CalculatePurchaseCostFromProductionCost
Arguments: iProductionCost — production cost to convert; ePurchaseYield — yield used to buy; gold gets an extra multiplier
Input checks: No range checks; no overflow check.
Multiplayer: read-only, pure arithmetic on global parameters. Risk: low (pure calculation). Confidence of the reading: high.
CalculateResourceMonopolies
Writes
- monopoly owner and count entries (VariantMap at this+0xa8)
Side effects
- dispatches monopoly gained/lost signals
- logs 'Monopoly Gained/Lost'
Input checks: Range checks resource and player against table sizes.
Multiplayer: may-desync, changes synced monopoly ownership. Risk: high (Changes ownership and fires signals.). Confidence of the reading: medium.
CanAddGreatWork
Arguments: eGreatPerson — great person individual type
Input checks: Checks index against definition count and null entry; otherwise false.
Multiplayer: read-only, culture list lookup. Risk: low (Pure query.). Confidence of the reading: medium.
CanCreateNewProduct
Arguments: ePlayer — player (not used in the code shown) (inferred); eResource — resource type
Input checks: Resource index is bounds-checked loosely; player unused.
Multiplayer: read-only, definition lookup. Risk: low (Pure query.). Confidence of the reading: medium.
CheckForEndingDroughts
Writes
- active drought list in climate data (SetDroughtInactive)
- edits the drought VariantMap
Side effects
- sends drought-ended notifications to affected players
- fires reporting event
Input checks: Bounds-checks drought index against the vector size; null-checks the event definition.
Multiplayer: may-desync, ends droughts and edits synced climate data. Risk: high (Mutates synchronised climate data and notifies players.). Confidence of the reading: medium.
ClearLists
Writes
- vector end pointers at +0x58, +0x280, +0x4a8, +0x5d8, +0x800 and others (sets end = begin)
- team hash table at this+0x2b20 (nodes freed, count at +0x2b34 set to 0)
Side effects
- DoFreeNodes on the team-to-fixed-vector hashtable
Input checks: none
Preconditions
- called during manager reset or setup
Multiplayer: may-desync: wipes shared player lists; must be called in sync on all clients. Risk: high (clears cached lists; calling at runtime leaves lists stale until rebuilt). Confidence of the reading: medium.
Verified from the code
- each of ~23 vectors has its end pointer set to its begin pointer
- hashtable nodes freed and count zeroed
Inferred
- vectors are lists of players by category (alive, major, minor, human, per team etc.)
- called before repopulating the lists
Open questions
- which list is at which offset
CreateComponents
Writes
- component pointers at this+0x240..0x288 and component container
Side effects
- allocates and registers components
Input checks: None; runs at game setup.
Multiplayer: may-desync, game setup only. Risk: high (Creating components twice leaks or breaks the game.). Confidence of the reading: medium.
DecrementGameStateLock
Writes
- game state lock counter at this+0x2a0
Side effects
- dispatch signal (bool=false) at signal table +0x18f0 when count goes 1 to 0
Input checks: Does nothing if counter already 0 (no underflow).
Preconditions
- game thread
- must pair with an increment
Multiplayer: unknown. Risk: high (unbalanced lock calls can unfreeze state early). Confidence of the reading: high.
Verified from the code
- no underflow
- signal dispatched only on 1 to 0 transition
- returns the new value
Inferred
- lock prevents game-state changes while held (name)
Open questions
- what the lock actually blocks
DetachScoreListeners
Writes
- handle vector count at this+0x28 set to 0
- unsubscribes handles stored at this+0x18
Side effects
- emergency score listeners stop receiving signals
Input checks: No input checks; assumes handle vector is valid.
Multiplayer: may-desync, removes gameplay listeners. Risk: medium (Removes emergency score tracking until reattached.). Confidence of the reading: high.
DoActiveOneOffs
Writes
- one-off event list (SetOneOffInactive) and one-off VariantMap via edit()
Side effects
- applies effects via ApplyOneOffEffects
- sends one-off event notifications
Input checks: Bounds-checks index; skips if event definition not found.
Multiplayer: may-desync, applies climate event effects to players. Risk: high (Applies gameplay effects and mutates synced data.). Confidence of the reading: medium.
DoTurn
Writes
- emergency state (list at this+0x68, other fields) via ConfirmEmergency
Side effects
- may confirm emergencies and send notifications
- writes log entries via logging manager
Input checks: Checks the capability hash 0x370521e0 only; no parameters.
Multiplayer: may-desync, advances emergency state each turn. Risk: high (Turn-processing function altering emergency state.). Confidence of the reading: low.
GetCorporationPlayer
Arguments: eResource — resource type of the corporation
Input checks: No checks; returns the last match.
Multiplayer: read-only, list scan. Risk: low (Pure query.). Confidence of the reading: medium.
GetCurrentTurnDeforestationPoints
Writes
- AI control priority field (climate sub-object +0x150) assigned from level data
Input checks: Returns 0 when total at +0x100 is not positive or no level matches; the division is guarded by that check.
Multiplayer: may-desync, writes a field despite getter-like name. Risk: medium (Looks like a getter but assigns a stored value.). Confidence of the reading: medium.
GetFirstTurnActiveHuman
Input checks: None.
Multiplayer: read-only, player list scan. Risk: low (Pure query.). Confidence of the reading: medium.
GetFreeGreatWorkForSlot
Arguments: eGreatPerson — great person individual type; eSlot — great work slot type; eObject — great work object type (not used in the code shown) (inferred)
Input checks: Returns -1 if none; no range check on great person index.
Multiplayer: read-only, culture list lookup. Risk: low (Pure query.). Confidence of the reading: medium.
GetGameEndTurn
Input checks: Handles null configuration.
Multiplayer: read-only, config computation. Risk: low (Pure query.). Confidence of the reading: medium.
GetGoldFromMonopolies
Arguments: ePlayer — player to evaluate
Input checks: Returns 0 for player -1; no upper bound check.
Multiplayer: read-only, computed value. Risk: low (Pure computation.). Confidence of the reading: medium.
GetHappinessGrowthModifier
Arguments: eHappiness — happiness level type
Input checks: Checks -1, definition index range, null definition and an enable byte at +0x30.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: high.
GetHappinessIdentityPerTurnChange
Arguments: eHappiness — happiness type whose hash is looked up
Input checks: Checks -1 and null definition.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: medium.
GetHappinessInEra
Arguments: eResource — resource type; eEra — era to evaluate in
Input checks: Range-checks era index and -1; resource definition is read at +0x24 even when the index is out of range.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: medium.
GetHousingSurplusReduction
Arguments: iPopDifference — difference between population and housing
Input checks: No validation of the integer.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: medium.
GetMaxVoteswithFavor
Arguments: maxFavor — favor amount
Input checks: Non-positive favor returns 1.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: medium.
GetNumControlledResources
Arguments: ePlayer — player index; eResource — resource type
Input checks: No bounds checks on either index.
Multiplayer: read-only, direct table read. Risk: low (Unchecked indices may crash on bad values.). Confidence of the reading: high.
GetNumCorporations
Arguments: ePlayer — player to count for; bActiveOnly — active-only flag, ignored in code (inferred)
Input checks: No checks.
Multiplayer: read-only, list scan. Risk: low (Pure query.). Confidence of the reading: high.
GetNumIndustries
Arguments: ePlayer — player to count for; bActiveOnly — active-only flag, ignored in code (inferred)
Input checks: No checks.
Multiplayer: read-only, list scan. Risk: low (Pure query.). Confidence of the reading: high.
GetNumRollsForResult
Arguments: iLowRoll — lower bound of roll range; iHighRoll — upper bound of roll range
Input checks: Returns 0 if low > high; no bounds check on table indices.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: medium.
GetNumTechs
Input checks: None.
Multiplayer: read-only, definition count. Risk: low (Pure query.). Confidence of the reading: high.
GetScaledWeightForMap
Arguments: iInitialWeight — weight to scale
Input checks: Falls back to the input if MAPSIZE_STANDARD is not found; division by standard dims unchecked.
Multiplayer: read-only, pure computation. Risk: low (Pure calculation.). Confidence of the reading: high.
GetStormDirection
Arguments: iCurrentLocation — plot index where the storm is
Side effects
- consumes a game random number (GetRandNum 'Storm Direction Preview')
Input checks: No range check on plot index; returns -1 if no wind definition matches.
Multiplayer: may-desync, draws from the synced game RNG. Risk: medium (Advances the synced RNG despite being a query.). Confidence of the reading: medium.
GetStormNearestPlayer
Arguments: iPlotIndex — plot index of the storm
Input checks: No plot index check; skips players without cities, returns -1 if none.
Multiplayer: read-only, distance queries only. Risk: low (Pure query.). Confidence of the reading: medium.
HasAvailableBuildingForProduct
Arguments: ePlayer — player to check
Input checks: Returns false for player -1.
Multiplayer: read-only, city building scan. Risk: low (Pure query.). Confidence of the reading: high.
HasGreatWorkBeenCreated
Arguments: eWork — great work type
Input checks: No range check; plain list search.
Multiplayer: read-only, list lookup. Risk: low (Pure query.). Confidence of the reading: high.
HasIndustryOf
Arguments: ePlayer — player; eResource — resource type
Input checks: Returns false for player -1.
Multiplayer: read-only, list scan. Risk: low (Pure query.). Confidence of the reading: high.
HasResourceMonopolyOf
Arguments: ePlayer — player; eResource — luxury resource type
Input checks: Rejects -1 ids and out-of-range resources; only luxury class counts.
Multiplayer: read-only, computed. Risk: low (Pure query.). Confidence of the reading: medium.
IncrementGameStateLock
Writes
- lock counter at this+0x2a0
Side effects
- dispatches a bool(true) signal on the object at +0x280 +0x18f0 when the count becomes 1
Input checks: none; no overflow check
Preconditions
- must be paired with a decrement
- game thread
Multiplayer: unknown. Risk: high (unbalanced use leaves the game state locked). Confidence of the reading: medium.
Verified from the code
- increments int at +0x2a0
- calls ProtoSignal Dispatch(true) only when value reaches 1
- returns the new count
Inferred
- signal is a game-state-locked notification (e.g. for UI/network)
- a matching decrement dispatches false
Open questions
- what listens to the signal and effects on multiplayer sync
IsAI
Arguments: ePlayer — player id
Input checks: Range check ids below 0x41 and slot not -1.
Multiplayer: read-only, player type check. Risk: low (Pure query.). Confidence of the reading: high.
IsActive
Input checks: None.
Multiplayer: read-only, capability check. Risk: low (Pure query.). Confidence of the reading: high.
IsAiProcessing
Input checks: No input.
Multiplayer: read-only, diplomacy state query. Risk: low (Pure query.). Confidence of the reading: low.
IsBarbarian
Arguments: ePlayer — player id
Input checks: Range check ids below 0x41 and slot not -1.
Multiplayer: read-only, player type check. Risk: low (Pure query.). Confidence of the reading: high.
IsFreeCities
Arguments: ePlayer — player id
Input checks: Range check ids below 0x41 and slot not -1.
Multiplayer: read-only, player type check. Risk: low (Pure query.). Confidence of the reading: high.
IsMajor
Arguments: ePlayer — player id
Input checks: Range check ids below 0x41 and slot not -1.
Multiplayer: read-only, player type check. Risk: low (Pure query.). Confidence of the reading: high.
IsMinor
Arguments: ePlayer — player id
Input checks: Range check ids below 0x41 and slot not -1.
Multiplayer: read-only, player type check. Risk: low (Pure query.). Confidence of the reading: high.
IsSpecialtyDistrict
Arguments: eDistrict — district type
Input checks: Range and null check on definition.
Multiplayer: read-only, reads stored state only. Risk: low (pure getter). Confidence of the reading: high.
IsTerrainValid
Arguments: eEventType — random event type; eTerrain — terrain type to test
Input checks: Returns false if the event definition is not found; no terrain range check.
Multiplayer: read-only, definition lookup. Risk: low (Pure query.). Confidence of the reading: high.
IsValidObjectForSlot
Arguments: eSlot — great work slot type; eObject — great work object type
Input checks: No input range checks; false if no pair.
Multiplayer: read-only, definition lookup. Risk: low (Pure query.). Confidence of the reading: high.
MoveActiveStorms
Writes
- active storm entries (position, direction, turns) via VariantMap edit()
- random event schedule via RandomEvents::Edit
Side effects
- applies storm effects to plots/players
- sends storm notifications
Input checks: Bounds-checks storm index; skips missing event definitions.
Multiplayer: may-desync, moves storms and applies effects. Risk: high (Mutates synced climate state each turn.). Confidence of the reading: medium.
ResetPlayerTurnResourceConsumption
Arguments: ePlayer — player whose entry is reset
Writes
- resource consumption entries for the player (two int fields set to 0)
Input checks: No range check; silently does nothing if the player has no entry.
Multiplayer: may-desync, edits synced climate data. Risk: medium (Edits synced per-player data.). Confidence of the reading: medium.
SetAsObserver
Arguments: ePlayer — player slot to convert to observer
Writes
- Configuration player slot status (set to 4)
- Manager field at 0x2dac reset to 1000 when ePlayer is the local player
Side effects
- ConfigurationEvent sent for SlotStatus
- Processor::PlayerTypeChanged called
- Game::Edit()->SwapVisibility for local player
Input checks: Checks ePlayer<=0x40, a map entry not -1, and a flag at player+600; only acts if IsHuman. No null check on player pointer.
Multiplayer: may-desync, changes player slot and visibility state. Risk: high (changes player type configuration and visibility). Confidence of the reading: medium.
SetLocalPlayerTo
Arguments: ePlayer — player id to become local player
Writes
- local player id at this+0x2da8
- observer player id at this+0x2dac (only when current local is not -1 and differs)
Side effects
- Reporting::Event::Send hash 0xc0372152 when visibility-manager flag +0x2b is 0
- Game::Instance::RestoreVisibility recalculates visibility
Input checks: No range check on player id; returns true early only if it equals the previous local player and no other change needed.
Preconditions
- game thread
- local/UI context (affects visibility only)
Multiplayer: may-desync: local player is per-client state; changing it in gameplay script is not synced. Risk: medium (changes viewing perspective and visibility, unvalidated id). Confidence of the reading: medium.
Verified from the code
- writes this+0x2da8
- conditionally writes this+0x2dac
- calls RestoreVisibility
- returns true in all visible paths
Inferred
- 0x2dac is the observer/last-set slot
- event likely notifies UI of local player change
Open questions
- meaning of flag at visibility manager +0x2b
- decompiler mangled the call args so the Game::Instance::Edit invocation is uncertain
SetPaused
Arguments: gamePaused — new paused state
Writes
- paused flag at this+0x210
Side effects
- sends reporting event 0x562fd140
Input checks: None.
Multiplayer: may-desync, game flow state. Risk: medium (Pausing may stall other clients.). Confidence of the reading: high.