Home › Dev CE (experimental) › Player
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.
Player
75 methods (Dev CE test build). this is found with the game's own IPlayer instance resolver (virtual).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| AddAdditionalPillaging |
Player:AddAdditionalPillaging(ePlunder: integer, eImprovement: integer, eDistrict: integer, iAmount: integer) |
Appends a record (plunder, improvement, district, amount) to the player's additional-pillaging list. |
— |
— |
0x2f7390 |
| AddAgenda |
Player:AddAgenda(agenda: integer, visibility: integer) → boolean |
Adds a diplomatic agenda to a player in the first free slot, with its visibility, then initializes it and notifies. |
— |
Player::Instance::AddAgenda |
0x2f7400 |
| AddChopFeatureBehavior |
Player:AddChopFeatureBehavior(eFeature: integer, bBan: boolean, eYield: integer, iAmount: integer) |
Appends a rule describing what happens when this player chops a feature (ban it, or give a yield amount). |
— |
Player::Instance::AddChopFeatureBehavior |
0x2f7570 |
| AddCounterSpyYieldAwardPerLevel |
Player:AddCounterSpyYieldAwardPerLevel(eYield: integer, iAmount: integer, iPerXAmount: integer) |
Appends a (yield, amount, per-X) record to the counter-spy yield award list. |
— |
— |
0x2cf400 |
| AddDistrictAndBuildingsCreateUnitWithAbilityByClass |
Player:AddDistrictAndBuildingsCreateUnitWithAbilityByClass(eAbility: integer, eDistrict: integer, ePromotionClass: integer) |
Appends an (ability, district, promotion class) record to the player's list so units created in that district and its buildings get the ability. |
— |
— |
0x2c3be0 |
| AddDistrictCreateUnit |
Player:AddDistrictCreateUnit(eDistrict: integer, eUnit: integer) |
Appends a (district, unit hash) record to the district-create-unit list; looks up the unit definition and stores its hash field (+0x24). |
— |
— |
0x2c3c40 |
| AddDistrictCreateYield |
Player:AddDistrictCreateYield(eYield: integer, eDistrict: integer, iAmount: integer, bYieldBasedOnAppeal: boolean, bMustReplaceImprovement: boolean, eImprovement: integer) |
Appends a district yield record (yield, district, amount, appeal flag, replace-improvement flag, improvement) to the player's list. |
— |
— |
0x2c3d20 |
| AddSpecialAllowedImprovement |
Player:AddSpecialAllowedImprovement(eImprovement: integer) |
Appends an improvement type to the player's special-allowed improvements list. |
— |
— |
0x2f75e0 |
| ChangeCO2GenerationReduction |
Player:ChangeCO2GenerationReduction(eUsageType: integer, iDiscount: integer) |
Adds a discount to the CO2 generation reduction for a resource usage type. |
— |
Player::Instance::ChangeCO2GenerationReduction |
0x2f7720 |
| ChangeExtraCapitalPressureRadius |
Player:ChangeExtraCapitalPressureRadius(iChange: integer) |
Adds a delta to the extra capital pressure radius variable. |
— |
— |
0x26ef60 |
| ChangeFlatBonus |
Player:ChangeFlatBonus(eBonus: integer, iDelta: integer) |
Adds a signed delta to a per-government-bonus-type counter stored in the player's bonuses data. |
ran ±1, reversible ✓, no visible effect |
Player::Bonuses::ChangeFlatBonus |
0x261010 |
| ChangeIdentityPerTurnForTradeRouteOrigin |
Player:ChangeIdentityPerTurnForTradeRouteOrigin(xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point delta to the per-turn identity (cultural identity) contribution from trade route origins. |
ran ±1, reversible ✓, no visible effect |
Player::CulturalIdentity::ChangeIdentityPerTurnForTradeRouteOrigin |
0x26ef90 |
| ChangeRandomEventModifiedDamageOpposingPlayer |
Player:ChangeRandomEventModifiedDamageOpposingPlayer(iDelta: integer, eRandomEvent: integer) |
Adds a delta to the modified damage percent that a random event deals to opposing players, per random event type. |
ran ±1, reversible ✓, no visible effect |
Player::Instance::ChangeRandomEventModifiedDamageOpposingPlayer |
0x2f7760 |
| ChangeRandomEventNoUnitDamage |
Player:ChangeRandomEventNoUnitDamage(iDelta: integer, eRandomEvent: integer) |
Adds a delta to a counter that prevents unit damage from a random event type. |
ran ±1, reversible ✓, no visible effect |
Player::Instance::ChangeRandomEventNoUnitDamage |
0x2f77b0 |
| ChangeResolutionEffectRefundPercent |
Player:ChangeResolutionEffectRefundPercent(eResolution: integer, iWhichEffect: integer, iChange: integer) |
Adds a delta to the refund percent for a particular effect of a World Congress resolution, creating a record if none exists. |
ran ±1, reversible ✓, no visible effect |
Player::Congress::ChangeResolutionEffectRefundPercent |
0x26c4e0 |
| ChangeSpyCapacity |
Player:ChangeSpyCapacity(iDelta: integer) |
Changes the player's spy capacity; non-major players are forced to 0. |
ran ±1, reversible ✓, no visible effect |
Player::Espionage::ChangeSpyCapacity |
0x2cf7a0 |
| ChangeTargetCitySpyYieldPercent |
Player:ChangeTargetCitySpyYieldPercent(eYield: integer, iPercent: integer) |
Adds a percentage to the yield bonus for spies targeting cities, per yield type, creating an entry if absent. |
— |
Player::Espionage::ChangeTargetCitySpyYieldPercent |
0x2cf800 |
| ChangeWantsCongressToMeet |
Player:ChangeWantsCongressToMeet(ab: boolean) |
Assigns the wants-congress-to-meet boolean variable and sends a Reporting event. |
— |
— |
0x26c590 |
| ChangeYieldRate |
Player:ChangeYieldRate(eYield: integer, iAmount: integer) |
Adds a per-turn rate change for culture, gold, science or faith by forwarding to the matching subsystem. |
ran ±1, reversible ✓, no visible effect |
Player::Instance::ChangeYieldRate |
0x2f7800 |
| CheckNotifications |
Player:CheckNotifications() |
Sends two fixed-hash notifications to the owning player; no conditions visible in the decompilation. |
— |
— |
0x2cf8f0 |
| DoEndTurn |
Player:DoEndTurn() |
Runs end-of-turn processing for the player's Units, Cities and Culture subsystems in that order. |
— |
— |
0x3449b0 |
| DoTurn |
Player:DoTurn() |
Compares the player's diplomatic victory points (clamped by the tracked value's bounds, shifted right by 8) to the stored value and, if different, sends a notification with the difference and stores the new value. |
— |
— |
0x26c620 |
| DoTurnActivate |
Player:DoTurnActivate(bFirstTime: boolean) |
Runs start-of-turn processing for a player: research, taxes, deals, culture, religion, diplomacy, cities, congress, espionage, units, governors, trade and stats, then per-city turn activation. The decompilation is truncated, so the tail is not visible. |
— |
— |
0x344a30 |
| DoTurnDeactivate |
Player:DoTurnDeactivate() |
Runs turn deactivation: records diplomatic visibility levels for major players, then AI control, cities and resources turn deactivation. |
— |
— |
0x344fc0 |
| GetAvoidedRandomEvents |
Player:GetAvoidedRandomEvents(eEvent: integer) → boolean |
Returns true if the event type is in the player's avoided random event list. |
— |
— |
0x2f7d60 |
| GetCapitalPressureRadius |
Player:GetCapitalPressureRadius() → number |
Returns the extra radius plus a global parameter (+0xd8), floored at 0. |
— |
— |
0x26efc0 |
| GetChopExtraYield |
Player:GetChopExtraYield(eFeature: integer, eYield: integer) → number |
Finds the record for feature and yield in the chop yield list and returns its extra amount, else 0. |
— |
— |
0x2f7dc0 |
| GetControlType |
Player:GetControlType() → number |
Looks up the player's configuration and returns 1 (AI) if the player is not human, else 0 (human). |
— |
— |
0x2f7ea0 |
| GetCounterSpyYieldAwardPerLevel |
Player:GetCounterSpyYieldAwardPerLevel(eYield: integer) → number |
Sums amount/perX fixed-point (8-bit fraction) over entries matching the yield and writes it to the return buffer; the yield argument arrives in a register not shown as a named parameter, so the decompilation is partly misleading. |
— |
— |
0x2d03c0 |
| GetDistrictCannotBeBuiltAdjacentToCity |
Player:GetDistrictCannotBeBuiltAdjacentToCity(eDistrict: integer) → boolean |
Returns true if the per-district counter at +0x198 is positive. |
— |
— |
0x2c43f0 |
| GetDistrictCreationUnit |
Player:GetDistrictCreationUnit(eDistrict: integer) → number |
Finds the district in the create-unit list and returns the type of the unit definition it references, or -1. |
— |
— |
0x2c4410 |
| GetFavor |
Player:GetFavor() → number |
Returns the diplomatic favor balance of this player, read from the player's Congress object. |
— |
— |
0x2f7f00 |
| GetMilitaryDomainDistrict |
Player:GetMilitaryDomainDistrict(eDomain: integer) → number |
Scans district definitions for one whose index is unlocked for the player and whose domain name maps to the requested domain; returns its type or -1. |
— |
— |
0x2c4520 |
| GetNumDistrictsOfType |
Player:GetNumDistrictsOfType(eDistrict: integer, includePillaged: boolean, includeIncomplete: boolean) → number |
Counts the player's districts of a type, optionally including pillaged and incomplete ones. |
— |
— |
0x2c45b0 |
| GetPromotionGlobalDefenseBonus |
Player:GetPromotionGlobalDefenseBonus() → number |
Sums the +0x93c defense bonus of the player's non-dead spy units (unit flag 0x1ba bit 2) standing on plots owned by that player. |
— |
— |
0x2d05f0 |
| GetPromotionGlobalOffenseBonus |
Player:GetPromotionGlobalOffenseBonus() → number |
Sums the +0x938 offense bonus of the player's non-dead spy units standing on plots owned by that player. |
— |
— |
0x2d06c0 |
| GetRandomEventModifiedDamageOpposingPlayer |
Player:GetRandomEventModifiedDamageOpposingPlayer(eRandomEvent: integer) → number |
Returns the stored modified damage value for a random event, from a per-event int array on the player. |
— |
— |
0x2f8060 |
| GetRandomEventNoUnitDamage |
Player:GetRandomEventNoUnitDamage(eRandomEvent: integer) → boolean |
Returns true if the per-event int stored for this random event is positive, meaning the event does no unit damage for this player. |
— |
— |
0x2f80a0 |
| GetResolutionEffectRefundPercent |
Player:GetResolutionEffectRefundPercent(eResolution: integer, iWhichEffect: integer) → number |
Sums the refund entries matching a resolution and effect index, clamps the total to 0..100 and returns it. |
— |
— |
0x26cfb0 |
| GetRevealedFeature |
Player:GetRevealedFeature(eFeatureType: integer) → boolean |
Returns whether a feature type has been revealed to this player, from a per-feature byte array. |
— |
— |
0x2f8100 |
| GetSpecialAllowedProject |
Player:GetSpecialAllowedProject(eImprovement: integer) → boolean |
Returns true if the project's allow counter is positive; for an out-of-range project it falls back to a general counter at 0x5a8. |
— |
— |
0x2f8170 |
| GetSpyNameIndex |
Player:GetSpyNameIndex(eOpponent: integer) → number |
Finds a spy unit of this player on a plot owned by eOpponent that is running a listening-post operation and returns its citizen name index, else -1. |
— |
— |
0x2d07e0 |
| GetVisibilityForAgenda |
Player:GetVisibilityForAgenda(agenda: integer) → number |
Searches a list of agendas on the player and returns the paired diplomatic visibility level for the given agenda. |
— |
— |
0x2f8200 |
| GetYieldRate |
Player:GetYieldRate(eYield: integer) → number |
Returns the per-turn yield for culture, gold, science or faith by calling the matching subsystem; any other yield gives 0. The decompile also shows a Government find from the yield, likely a decompiler artifact. |
— |
— |
0x2f8240 |
| HasAnyRequiredFeatures |
Player:HasAnyRequiredFeatures() → boolean |
Returns true if any feature has a positive count in the player's required-feature array. |
— |
— |
0x2c4730 |
| HasEscapingSpy |
Player:HasEscapingSpy() → boolean |
Returns true if any of the player's spy units has the escaping flag (+0x959) set. |
— |
— |
0x2d09f0 |
| HasFoundAnyNewContinent |
Player:HasFoundAnyNewContinent() → boolean |
Counts continents flagged as found by this player and returns true if more than one is flagged. |
— |
— |
0x2f83f0 |
| HasFoundContinent |
Player:HasFoundContinent(eContinentType: integer) → boolean |
Returns whether a given continent is flagged as found by this player. |
— |
— |
0x2f8430 |
| HasThisRequiredFeatureForSpecialtyDistrict |
Player:HasThisRequiredFeatureForSpecialtyDistrict(eFeature: integer, eDistrict: integer) → boolean |
If the district is a specialty district per Rules::Economic, returns whether the feature's count is positive. |
— |
— |
0x2c4780 |
| IsAgendaAllowed |
Player:IsAgendaAllowed(agenda: integer) → boolean |
Checks the player's agendas; returns false if any of them lists the given agenda in one of two exclusion lists of its definition, else true. |
— |
— |
0x2f96b0 |
| IsChopBanned |
Player:IsChopBanned(eFeature: integer) → boolean |
Searches a list of feature/flag entries on the player and returns true if the feature has a nonzero ban flag. |
— |
— |
0x2f97c0 |
| IsSimultaneousTurns |
Player:IsSimultaneousTurns() → boolean |
Returns false for non-human players; otherwise depends on the current phase turn mode: for one mode the per-player flag at 0x2a0, for another mode true. |
— |
— |
0x2f98c0 |
| IsTrackingSpy |
Player:IsTrackingSpy() → boolean |
Scans all players' spy units from other players that are on plots owned by this player and have the +0x959 flag; returns true if one is found. |
— |
— |
0x2d1260 |
| IsValid |
Player:IsValid() → boolean |
Returns true if the player's valid flag (0x83a) is set and its configuration has a civilization type. |
— |
— |
0x2f9950 |
| RecomputeCost |
Player:RecomputeCost(eDistrict: integer) → number |
Recomputes and caches the production cost of a district type for this player, using the district's cost progression model, escalation, era/handicap production rate, and game speed. Returns the new cost. |
— |
Player::Districts::RecomputeCost |
0x2c4f10 |
| RemoveAdditionalPillaging |
Player:RemoveAdditionalPillaging(ePlunder: integer, eImprovement: integer, eDistrict: integer, iAmount: integer) |
Removes the first entry matching plunder, improvement, district and amount from the player's additional-pillaging list by rebuilding the list without it. |
— |
— |
0x2f9f00 |
| RemoveAvoidedRandomEvents |
Player:RemoveAvoidedRandomEvents(eEventRemove: integer) |
If the value is in the player's avoided random events list, updates the dirty-variable set and decrements the count at 0x3f8; the list entry itself is not erased in this code. |
— |
— |
0x2fa0a0 |
| RemoveCapturedSpy |
Player:RemoveCapturedSpy(eOwner: integer, iNameIndex: integer) |
Rebuilds the captured-spy list without the entry matching owner and name index. |
— |
— |
0x2d1830 |
| RemoveChopFeatureBehavior |
Player:RemoveChopFeatureBehavior(eFeature: integer, bBan: boolean, eYield: integer) |
Removes a matching chop-feature rule from the player's rule list by copying the list, clearing it, and re-adding non-matching rules. |
— |
Player::Instance::RemoveChopFeatureBehavior |
0x2fa1e0 |
| RemoveCounterSpyYieldAwardPerLevel |
Player:RemoveCounterSpyYieldAwardPerLevel(eYield: integer, iAmount: integer, iPerXAmount: integer) |
Rebuilds the counter-spy yield award list, dropping one entry matching yield and amount/perX (the match logic uses && on negated conditions, so it may drop an unintended entry). |
— |
— |
0x2d19b0 |
| RemoveDistrictAddNavalUnits |
Player:RemoveDistrictAddNavalUnits(eDistrict: integer) |
If the value is in the player's district-adds-naval-units list, updates the dirty-variable set and decrements the count at 0x510; the list entry itself is not erased in this code. |
— |
— |
0x2fa330 |
| RemoveDistrictAndBuildingsCreateUnitWithAbilityByClass |
Player:RemoveDistrictAndBuildingsCreateUnitWithAbilityByClass(eAbility: integer, eDistrict: integer, ePromotionClass: integer) |
Removes the first list entry matching (ability, district, promotion class) by shifting the rest down. |
— |
— |
0x2c5330 |
| RemoveDistrictCreateUnit |
Player:RemoveDistrictCreateUnit(eDistrict: integer) |
Removes the first create-unit entry for a district by shifting later entries down. |
— |
— |
0x2c53f0 |
| RemoveDistrictCreateYield |
Player:RemoveDistrictCreateYield(eYield: integer, eDistrict: integer) |
Removes the first yield entry matching yield and district, shifting later entries down. |
— |
— |
0x2c54b0 |
| RemoveFoundForeignContinentCityAddUnitClasses |
Player:RemoveFoundForeignContinentCityAddUnitClasses(eUnitClass: integer) |
If the value is in the player's foreign-continent-city unit class list, updates the dirty-variable set and decrements the count at 0x4e8; the list entry itself is not erased in this code. |
— |
— |
0x2fa470 |
| RemoveSpecialAllowedImprovement |
Player:RemoveSpecialAllowedImprovement(eImprovement: integer) |
Rebuilds the player's special-allowed improvement list at 0x380 without the first matching entry. |
— |
— |
0x2fa5b0 |
| SetAlive |
Player:SetAlive(bIsAlive: boolean) |
Sets whether a player is alive, re-initializes alive state and player lists, and on a change fires a revive signal and a reporting event. |
— |
Player::Instance::SetAlive |
0x2fa9a0 |
| SetAvoidedRandomEvents |
Player:SetAvoidedRandomEvents(eEvent: integer) |
Appends a random event type to the player's avoided random events list (ignoring -1). |
— |
— |
0x2faa80 |
| SetCanEverZone |
Player:SetCanEverZone() |
Rebuilds the can-ever-zone district array (+0x1d8) sized to the district definitions, using the player's civilization and leader definitions to mark districts and their dependent entries (decompilation truncated). |
— |
— |
0x2c5a40 |
| SetDistrictUnlockCivic |
Player:SetDistrictUnlockCivic(eDistrict: integer, eCivic: integer) |
Appends a (district, civic) record to the unlock-civic list. |
— |
— |
0x2c5da0 |
| SetDistrictUnlockTech |
Player:SetDistrictUnlockTech(eDistrict: integer, eTech: integer) |
Appends a (district, tech) record to the unlock-tech list. |
— |
— |
0x2c5df0 |
| SetHasEncountered |
Player:SetHasEncountered(eUnit: integer, bNewValue: boolean) |
Sets the per-unit-type encountered flag for this player. |
— |
— |
0x2faaf0 |
| SetHasFoundContinent |
Player:SetHasFoundContinent(eContinentType: integer, bRevealed: boolean) |
Sets the found flag of a continent for this player. |
— |
— |
0x2fab20 |
| SetRevealedFeature |
Player:SetRevealedFeature(eFeatureType: integer, bRevealed: boolean) |
Sets the revealed flag of a feature type for this player. |
— |
— |
0x2fad10 |
| UpdateWithEscapeResult |
Player:UpdateWithEscapeResult(iNameIndex: integer, eOperation: integer, eTarget: integer, cityID: integer, eEscapeResult: integer, iNewLevel: integer) |
Finds the most recent record matching name index, operation, target, city; sets its escape result and raises its level to iNewLevel if higher. |
— |
— |
0x2d2530 |
Details
AddAdditionalPillaging
Arguments: ePlunder — plunder type; eImprovement — improvement type; eDistrict — district type; iAmount — amount, must be positive
Writes
- player pillaging list (+0x5e0)
Input checks: Requires plunder != -1, amount > 0 and an improvement or district.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent list). Confidence of the reading: high.
AddAgenda
Arguments: agenda — agenda to add; visibility — how visible the agenda is
Writes
- agenda list at this+0x478
- visibility list at this+0x4a0
Side effects
- InitializeAgenda
- Reporting::Event 0x7124e66b (player id, agenda)
- agenda-added signal
Input checks: Returns false when the agenda is not allowed or already in list; reuses an empty (-1) slot or appends.
Preconditions
- gameplay state
Multiplayer: may-desync: must be applied identically. Risk: low (guarded and bounded). Confidence of the reading: high.
Verified from the code
- returns false for duplicates and disallowed agendas
- stores visibility parallel to agenda
- dispatches signal
Inferred
- vector type names in decompile are misleading
AddChopFeatureBehavior
Arguments: eFeature — feature being chopped; bBan — true to forbid chopping; eYield — yield granted; iAmount — yield amount
Writes
- 16-byte rule appended to vector in VariantMap at this+0x5b0
Side effects
- vector may reallocate
Input checks: None; yield and amount are only stored when bBan is false (otherwise uninitialised stack values are stored).
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: medium (no duplicate check; stores uninitialised fields when ban is true). Confidence of the reading: medium.
Verified from the code
- pushes record containing feature, ban flag, yield, amount
- yield/amount copied only when ban is false
Inferred
- Pairs with RemoveChopFeatureBehavior
Open questions
- Which code consumes these records
AddCounterSpyYieldAwardPerLevel
Arguments: eYield — yield type awarded; iAmount — amount awarded (inferred); iPerXAmount — divisor (per X levels) (inferred)
Writes
- counter-spy yield award list (+0x1b8)
Input checks: No validation.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent list). Confidence of the reading: medium.
AddDistrictAndBuildingsCreateUnitWithAbilityByClass
Arguments: eAbility — unit ability to grant (inferred); eDistrict — district type (inferred); ePromotionClass — promotion class of units that receive it (inferred)
Writes
- player districts list at +0x260 (appended 12-byte entry)
Input checks: No validation, no duplicate check.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent modifier list). Confidence of the reading: medium.
AddDistrictCreateUnit
Arguments: eDistrict — district that creates the unit; eUnit — unit type created
Writes
- player create-unit list (+0x230)
Input checks: Unit index range-checked but a null definition is dereferenced; no duplicate check (a find loop result is unused).
Multiplayer: may-desync, writes synchronised player vector. Risk: high (invalid unit index can crash). Confidence of the reading: medium.
AddDistrictCreateYield
Arguments: eYield — yield type (inferred); eDistrict — district type (inferred); iAmount — yield amount (inferred); bYieldBasedOnAppeal — whether yield depends on appeal (inferred); bMustReplaceImprovement — whether district must replace an improvement (inferred); eImprovement — improvement type involved (inferred)
Writes
- player district yield list (+0x200, 20-byte entry)
Input checks: No validation; no duplicate check.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent modifier list). Confidence of the reading: medium.
AddSpecialAllowedImprovement
Arguments: eImprovement — improvement type to allow
Writes
- special allowed improvement list (+0x380)
Input checks: No validation, no duplicate check.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent list). Confidence of the reading: high.
ChangeCO2GenerationReduction
Arguments: eUsageType — resource usage type (0-3); iDiscount — amount added
Writes
- int array element at VariantMap this+0x610
Input checks: Ignored silently when usage type >= 4 (unsigned).
Preconditions
- gameplay state only
- climate/CO2 feature present
Multiplayer: may-desync: direct state write. Risk: low (bounds checked against constant 4). Confidence of the reading: high.
Verified from the code
- check < 4
- adds delta to element
Inferred
- Four usage categories
ChangeExtraCapitalPressureRadius
Arguments: iChange — amount to add to the extra radius
Writes
- extra capital pressure radius variable (+0x90/+0xa0)
Input checks: None.
Multiplayer: may-desync, writes player cultural identity state. Risk: medium (affects loyalty pressure). Confidence of the reading: high.
ChangeFlatBonus
Arguments: eBonus — government bonus type; iDelta — amount added to the counter
Writes
- int array element indexed by bonus type in VariantMap at this+0xa8 (flat bonus total)
Side effects
- marks the networked/auto variable as edited
Input checks: Silently returns if the type index is 0xffffffff; the index is otherwise not range-checked against the array size (crash risk for out-of-range index).
Preconditions
- gameplay state only
- valid Bonuses object for a player
Multiplayer: may-desync: direct state write; must run identically on all clients. Risk: medium (unchecked array index and no recalculation or notification). Confidence of the reading: high.
Verified from the code
- Calls Types::GetIndex then FAutoVariable edit at this+0xa8
- adds param to int element at index*4
- no bounds check besides -1
Inferred
- Counter is read elsewhere by government bonus calculation
Open questions
- What reads this array and whether any dirty flags are needed
ChangeIdentityPerTurnForTradeRouteOrigin
Arguments: xChange — delta in 24.8 fixed point (raw/256)
Writes
- auto variable at this+0xa8 (value mirror at this+0xb8) identity per turn for trade route origin
Side effects
- assignment through an auto-variable setter (marks changed)
Input checks: None; any delta accepted.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (simple additive stat). Confidence of the reading: high.
Verified from the code
- reads int at this+0xb8, adds *param, writes via MoveAssignmentDo to this+0xa8
Inferred
- Is the value used per route origin city
Open questions
- Exact consumer of the value
ChangeRandomEventModifiedDamageOpposingPlayer
Arguments: iDelta — change; eRandomEvent — random event type
Writes
- int array element in VariantMap at this+0x450
Input checks: Ignores -1 and indices >= stored size.
Preconditions
- gameplay state only
- random events enabled
Multiplayer: may-desync: direct state write. Risk: low (bounds checked). Confidence of the reading: medium.
Verified from the code
- index checked against this+0x470
- adds delta to element
Inferred
- unit of damage (percent) is guessed from name
ChangeRandomEventNoUnitDamage
Arguments: iDelta — change; eRandomEvent — random event type
Writes
- int array element in VariantMap at this+0x428
Input checks: Ignores -1 and indices >= stored size.
Preconditions
- gameplay state only
- random events enabled
Multiplayer: may-desync: direct state write. Risk: low (bounds checked). Confidence of the reading: medium.
Verified from the code
- index checked against this+0x448
- adds delta to element
Inferred
- nonzero counter means immunity
ChangeResolutionEffectRefundPercent
Arguments: eResolution — resolution type; iWhichEffect — which effect of the resolution (index); iChange — amount added to the refund percent
Writes
- vector of (resolution, effect, refund percent) triples at this+0x268: either an existing entry's third field is incremented or a new entry appended
Side effects
- vector may reallocate
Input checks: No validation of resolution or effect index; no clamp on percent.
Preconditions
- valid Congress object
Multiplayer: may-desync: player state mutation; must run identically on all clients. Risk: low (unclamped integer in a vector entry). Confidence of the reading: medium.
Verified from the code
- linear search for matching (resolution, effect) pair
- adds to matching entry or appends new 12-byte entry
Inferred
- entry size 12 bytes = three ints
- meaning of refund from the function name
Open questions
- how the refund is consumed
- whether Lua object is player-level rather than CongressManager
ChangeSpyCapacity
Arguments: iDelta — change to spy capacity
Writes
- spy capacity auto variable at this+0xe0 (value at this+0xf0)
Side effects
- auto-variable assignment
Input checks: No clamping; non-major players always set to 0; negative results are not clamped here.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (simple stat; negative capacity possible). Confidence of the reading: high.
Verified from the code
- IsMajor check on owner at this+0x90
- new = old+delta for majors else 0
Inferred
- Capacity gates number of spies
ChangeTargetCitySpyYieldPercent
Arguments: eYield — yield type; iPercent — percent change
Writes
- vector of (yield, percent) pairs in VariantMap at this+0x1e8
Side effects
- may grow the vector
Input checks: Returns silently if yield is -1; otherwise searches for matching entry and appends one if missing.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (simple list mutation). Confidence of the reading: medium.
Verified from the code
- Types::GetIndex on yield
- linear search over 8-byte entries
- adds to second int or pushes new pair
Inferred
- Entries are yield/percent pairs
Open questions
- Odd end-pointer check against this+0x200 purpose
ChangeWantsCongressToMeet
Arguments: ab — new wants-congress-to-meet value
Writes
- Congress wants-to-meet auto-variable (+0x298)
Side effects
- sends a Reporting event (hash 0x23aceece)
Input checks: None.
Multiplayer: may-desync, writes synchronised congress variable. Risk: medium (changes congress state). Confidence of the reading: medium.
ChangeYieldRate
Arguments: eYield — yield (culture, gold, science, faith only); iAmount — whole-number rate change
Writes
- Culture rate change
- Treasury gold rate change
- Techs science rate change
- Religion faith rate change
Side effects
- calls SetCultureRateChange / SetGoldRateChange / SetScienceRateChange / SetFaithRateChange
Input checks: Other yield types silently ignored; amount multiplied by 256 (converted to fixed point).
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (only four yields handled). Confidence of the reading: high.
Verified from the code
- four-way branch on yield
- delta scaled by 0x100 added to current value then setter called
Inferred
- rate-change is a per-turn modifier
CheckNotifications
Side effects
- sends two player notifications (hashes 0x23d49db5, 0x652183a2)
Input checks: None.
Multiplayer: may-desync, issues notifications unconditionally. Risk: low (notification send only). Confidence of the reading: low.
DoEndTurn
Writes
- delegated: units, cities (city healing) and culture end-of-turn state
Side effects
- calls Player::Units::DoEndTurn, Cities::DoEndTurn, Culture::DoEndTurn
Input checks: None; subsystem pointers are not null checked.
Multiplayer: may-desync, runs end-of-turn game logic. Risk: medium (drives the player's end-of-turn processing). Confidence of the reading: medium.
DoTurn
Writes
- stored diplomatic victory points (+0x2b0 variable)
Side effects
- sends a player notification with localized text and the point difference
Input checks: Does nothing when the difference is zero.
Multiplayer: may-desync, per-turn state update and notification. Risk: medium (per-turn processing). Confidence of the reading: medium.
DoTurnActivate
Arguments: bFirstTime — true on the first activation of the turn; the main block is skipped when false
Writes
- research, treasury, culture, religion, diplomacy, cities, units, trade, stats and per-city turn state (delegated)
Side effects
- dispatches a unit signal on the game, calculates score, runs improvement captures and placement rules
Input checks: Only checks bFirstTime and barbarian status; no null checks.
Multiplayer: may-desync, runs full start-of-turn game logic. Risk: high (drives all start-of-turn processing; calling twice would double-apply yields). Confidence of the reading: low.
DoTurnDeactivate
Writes
- delegated: diplomacy visibility record, AI control, cities, resources
Side effects
- calls Diplomacy::RecordVisibilityLevels (majors only), AI Control DoTurnDeactivate, Cities and Resources DoTurnDeactivate
Input checks: Only the IsMajor check gates the diplomacy call; no null checks.
Multiplayer: may-desync, runs turn deactivation logic. Risk: medium (delegates to several subsystems that change state). Confidence of the reading: medium.
GetAvoidedRandomEvents
Arguments: eEvent — random event type
Input checks: None.
Multiplayer: read-only, list scan. Risk: low (getter). Confidence of the reading: high.
GetCapitalPressureRadius
Input checks: Floors the sum at 0.
Multiplayer: read-only, pure getter. Risk: low (getter). Confidence of the reading: high.
GetChopExtraYield
Arguments: eFeature — feature type chopped; eYield — yield type
Input checks: None.
Multiplayer: read-only, list scan. Risk: low (getter). Confidence of the reading: high.
GetControlType
Input checks: None needed; uses the player id stored at offset 0xd8.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetCounterSpyYieldAwardPerLevel
Arguments: eYield — yield type (inferred)
Input checks: Skips entries whose divisor is not positive.
Multiplayer: read-only, list scan, writes only the return slot. Risk: low (getter). Confidence of the reading: low.
GetDistrictCannotBeBuiltAdjacentToCity
Arguments: eDistrict — district type
Input checks: Rejects -1; no upper range check.
Multiplayer: read-only, pure getter. Risk: low (getter, unchecked upper index). Confidence of the reading: high.
GetDistrictCreationUnit
Arguments: eDistrict — district type
Input checks: Returns -1 when absent.
Multiplayer: read-only, list lookup. Risk: low (getter). Confidence of the reading: medium.
GetFavor
Input checks: None; Congress object is dereferenced without a null check.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetMilitaryDomainDistrict
Arguments: eDomain — domain type (land, sea, air)
Input checks: Returns -1 on no match.
Multiplayer: read-only, definition scan. Risk: low (getter). Confidence of the reading: medium.
GetNumDistrictsOfType
Arguments: eDistrict — district type to count; includePillaged — count pillaged districts too; includeIncomplete — count districts whose complete flag (+0x3f8) is zero
Input checks: No validation of eDistrict.
Multiplayer: read-only, list scan. Risk: low (getter). Confidence of the reading: high.
GetPromotionGlobalDefenseBonus
Input checks: Checks unit definition index; skips units with null plot.
Multiplayer: read-only, unit scan. Risk: low (getter). Confidence of the reading: medium.
GetPromotionGlobalOffenseBonus
Input checks: Same checks as defense variant.
Multiplayer: read-only, unit scan. Risk: low (getter). Confidence of the reading: medium.
GetRandomEventModifiedDamageOpposingPlayer
Arguments: eRandomEvent — random event type index into the per-event array
Input checks: Checks for -1 (none) and index below array size; returns 0 otherwise.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetRandomEventNoUnitDamage
Arguments: eRandomEvent — random event type index into the per-event array
Input checks: Checks for -1 and index below array size; returns false otherwise.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetResolutionEffectRefundPercent
Arguments: eResolution — resolution type to match; iWhichEffect — effect index to match
Input checks: No input validation; unmatched returns 0.
Multiplayer: read-only, list scan only. Risk: low (getter). Confidence of the reading: high.
GetRevealedFeature
Arguments: eFeatureType — feature type index into the revealed flag array
Input checks: Checks for -1 and index below array size; returns false otherwise.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetSpecialAllowedProject
Arguments: eImprovement — project type index (named eImprovement but typed ProjectTypes)
Input checks: Range checked; out-of-range or invalid falls back to the general counter instead of returning false.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetSpyNameIndex
Arguments: eOpponent — player owning the plot where the spy is
Input checks: Returns -1 if no match.
Multiplayer: read-only, unit scan. Risk: low (getter). Confidence of the reading: medium.
GetVisibilityForAgenda
Arguments: agenda — agenda type to look up in the player's agenda list
Input checks: No range check; linear search, returns -1 when not found.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetYieldRate
Arguments: eYield — yield type to query (inferred)
Input checks: Unsupported yields return 0; subsystem pointers are not null checked. Decompile is partly mangled.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: medium.
HasAnyRequiredFeatures
Input checks: None.
Multiplayer: read-only, array scan. Risk: low (getter). Confidence of the reading: medium.
HasEscapingSpy
Input checks: None.
Multiplayer: read-only, unit scan. Risk: low (getter). Confidence of the reading: medium.
HasFoundAnyNewContinent
Input checks: None; iterates the byte array at 0x368.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
HasFoundContinent
Arguments: eContinentType — continent index into the found flag array
Input checks: Checks for -1 and index below array size; returns false otherwise.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
HasThisRequiredFeatureForSpecialtyDistrict
Arguments: eFeature — feature type; eDistrict — district type, must be specialty
Input checks: Rejects feature -1; no upper range check.
Multiplayer: read-only, array lookup. Risk: low (getter). Confidence of the reading: high.
IsAgendaAllowed
Arguments: agenda — agenda type being tested
Input checks: Skips -1 agenda entries; assumes valid definition for others.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: medium.
IsChopBanned
Arguments: eFeature — feature type to look up in the ban list
Input checks: None; linear search of 16-byte entries.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
IsSimultaneousTurns
Input checks: Non-human returns false; unknown turn mode returns false. Turn mode hashes are compared as constants.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: medium.
IsTrackingSpy
Input checks: Requires valid positions (> -9999).
Multiplayer: read-only, scan of all players' units. Risk: low (getter). Confidence of the reading: medium.
IsValid
Input checks: None; reads own configuration slot.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
RecomputeCost
Arguments: eDistrict — district type
Writes
- per-district cost array at this+0x110 (index eDistrict)
Side effects
- calls Economic::ComputeCostEscalation and AdjustForGameSpeed
Input checks: definition index range-checked but a null definition pointer is later dereferenced (invalid id risk); result clamped to at least 1
Preconditions
- valid district id
- owning player set (this+0x90)
Multiplayer: safe-deterministic. Risk: medium (invalid district id leads to null dereference; floats used but game-logic deterministic). Confidence of the reading: medium.
Verified from the code
- switch on cost progression model: count of districts, tech/civic percent (min of the two), city/state field, or average-constructable based formulas
- final cost = game-speed-adjusted escalated cost times a production-rate factor, minimum 1
- stores result in array at +0x110
Inferred
- model cases map to names such as per-district, tech/civic percent, per-city
- factor depends on era and difficulty handicap setting
Open questions
- exact mapping of switch cases to model names
- float constants not shown
RemoveAdditionalPillaging
Arguments: ePlunder — plunder type of the entry to remove; eImprovement — improvement type of the entry; eDistrict — district type of the entry; iAmount — amount of the entry
Writes
- additional pillaging entry list at 0x5e0 (one matching entry removed)
Side effects
- allocates and frees a temporary copy of the list
Input checks: No validation; nothing is removed if no entry matches (the list is just rebuilt).
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: medium.
RemoveAvoidedRandomEvents
Arguments: eEventRemove — random event type to remove
Writes
- count at 0x3f8 decremented, dirty-variable set updated
Input checks: Returns early if the count is 0 or the value is not in the list; no range check.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: medium.
RemoveCapturedSpy
Arguments: eOwner — owner of the captured spy; iNameIndex — spy name index
Writes
- captured spy list (+0xf8) rebuilt
Input checks: List is rebuilt unchanged if no match.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (list rebuild). Confidence of the reading: medium.
RemoveChopFeatureBehavior
Arguments: eFeature — feature; bBan — ban flag of the rule; eYield — yield of the rule
Writes
- rule vector in VariantMap at this+0x5b0 rebuilt
Side effects
- temporary heap allocation freed at end
Input checks: No validation; the keep test is feature differs OR (ban differs AND yield differs), so matching rules require same feature and (ban equal or yield equal).
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: medium (rebuilds list; removal matching is loose (ban or yield match removes)). Confidence of the reading: medium.
Verified from the code
- copies existing entries to a temp buffer
- resets size to begin
- re-adds entries failing the match condition
- frees temp buffer
Inferred
- Probably removes all matching rules, not just the first
Open questions
- Whether offsets 0x5c0/0x5c8 are the same vector as at 0x5b0 value
RemoveCounterSpyYieldAwardPerLevel
Arguments: eYield — yield type; iAmount — amount to match; iPerXAmount — per-X value to match
Writes
- counter-spy yield award list (+0x1b8)
Input checks: No validation.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (possible faulty match). Confidence of the reading: medium.
RemoveDistrictAddNavalUnits
Arguments: eDistrict — district type to remove
Writes
- count at 0x510 decremented, dirty-variable set updated
Input checks: Returns early if the count is 0 or the value is not in the list; no range check.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: medium.
RemoveDistrictAndBuildingsCreateUnitWithAbilityByClass
Arguments: eAbility — ability to match (inferred); eDistrict — district to match (inferred); ePromotionClass — promotion class to match (inferred)
Writes
- player districts list at +0x260 (entry removed)
Input checks: No-op if no match.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent modifier list). Confidence of the reading: medium.
RemoveDistrictCreateUnit
Arguments: eDistrict — district to remove
Writes
- player create-unit list (+0x230)
Input checks: No-op if absent; end compare uses +0x248 (possibly a stale pointer).
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent modifier list). Confidence of the reading: medium.
RemoveDistrictCreateYield
Arguments: eYield — yield type to match; eDistrict — district to match
Writes
- player district yield list (+0x200)
Input checks: No-op if absent.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent modifier list). Confidence of the reading: medium.
RemoveFoundForeignContinentCityAddUnitClasses
Arguments: eUnitClass — unit promotion class to remove
Writes
- count at 0x4e8 decremented, dirty-variable set updated
Input checks: Returns early if the count is 0 or the value is not in the list; no range check.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: medium.
RemoveSpecialAllowedImprovement
Arguments: eImprovement — improvement type to remove from the list
Writes
- special-allowed improvement list at 0x380 (one matching entry removed)
Side effects
- allocates and frees temporary buffers
Input checks: No validation; if the improvement is absent the list is just rewritten unchanged.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: medium.
SetAlive
Arguments: bIsAlive — new alive state
Writes
- player alive flag (this+600) via InitializeAliveState
- player manager lists rebuilt
Side effects
- SetPlayerRevived when becoming alive
- signal dispatch on revive
- Reporting::Event 0xa0a8f479 with alive state and player id
Input checks: No validation; always re-initializes lists even if state unchanged. Events only on change.
Preconditions
- gameplay state
- valid player
Multiplayer: may-desync: global player lists changed. Risk: high (changes player life state and global lists). Confidence of the reading: medium.
Verified from the code
- compares old and new flag
- calls InitializeAliveState and Manager::InitializeLists unconditionally
- revive path calls SetPlayerRevived and dispatches a signal
Inferred
- signal declared with Unit parameter but passed the player
Open questions
- what InitializeAliveState does for death
SetAvoidedRandomEvents
Arguments: eEvent — random event type to add to the avoided list
Writes
- avoided random events list at 0x3d8 (appended)
Input checks: Ignores -1; does not check for duplicates or range.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: high.
SetCanEverZone
Writes
- can-ever-zone variable (+0x1d8) resized and filled
Input checks: Handles missing civilization/leader definitions by skipping the fill.
Multiplayer: may-desync, rebuilds synchronised player array. Risk: medium (bulk rebuild; decompilation truncated). Confidence of the reading: low.
SetDistrictUnlockCivic
Arguments: eDistrict — district to unlock; eCivic — civic that unlocks it
Writes
- player unlock-civic list (+0x2c0)
Input checks: No validation, no duplicate check; despite Set, it appends.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent list). Confidence of the reading: medium.
SetDistrictUnlockTech
Arguments: eDistrict — district to unlock; eTech — tech that unlocks it
Writes
- player unlock-tech list (+0x290)
Input checks: No validation, no duplicate check; despite Set, it appends.
Multiplayer: may-desync, writes synchronised player vector. Risk: medium (persistent list). Confidence of the reading: medium.
SetHasEncountered
Arguments: eUnit — unit type index into the encountered flag array; bNewValue — new encountered flag value
Writes
- encountered-unit flag array at 0x308
Input checks: No bounds or -1 check on eUnit; an invalid index writes out of range.
Multiplayer: may-desync, writes synchronised player state. Risk: high (unchecked index into array). Confidence of the reading: medium.
SetHasFoundContinent
Arguments: eContinentType — continent index; bRevealed — new found flag value
Writes
- found-continent flag array at 0x358
Input checks: Checks for -1 and index below array size; otherwise ignored.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: high.
SetRevealedFeature
Arguments: eFeatureType — feature type index; bRevealed — new revealed flag value
Writes
- revealed-feature flag array at 0x330
Input checks: Checks for -1 and index below array size; otherwise ignored.
Multiplayer: may-desync, writes synchronised player state. Risk: medium (writes synchronised player state). Confidence of the reading: high.
UpdateWithEscapeResult
Arguments: iNameIndex — spy name index; eOperation — operation type; eTarget — target player; cityID — target city id; eEscapeResult — escape result to store; iNewLevel — level to store if higher
Writes
- matching record result (+0x188 list)
Side effects
- sends Reporting event 0x81c5bd7e19087a58
Input checks: No-op if no match.
Multiplayer: may-desync, writes synchronised list. Risk: medium (state change plus event). Confidence of the reading: medium.