Home › Dev CE (experimental) › PlayerTrade
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.
PlayerTrade
37 methods (Dev CE test build). this is found with the game's own IPlayerTrade instance resolver (virtual).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| ChangeCityStateDistrictTradeRouteBonus ✓ |
PlayerTrade:ChangeCityStateDistrictTradeRouteBonus(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point amount to the trade route yield bonus for routes to a city state district, per yield. |
plumbing ✓ effect ✓ (GetFoodSurplus, GetTurnsUntilGrowth) |
Player::Trade::ChangeCityStateDistrictTradeRouteBonus |
0x33c180 |
| ChangeDestinationYieldForAllyRoute |
PlayerTrade:ChangeDestinationYieldForAllyRoute(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point amount to the destination yield for routes to allied players, per yield. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeDestinationYieldForAllyRoute |
0x33c1e0 |
| ChangeDestinationYieldForSuzerainRoute |
PlayerTrade:ChangeDestinationYieldForSuzerainRoute(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point amount to the destination yield for routes to city states the player is suzerain of, per yield. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeDestinationYieldForSuzerainRoute |
0x33c240 |
| ChangeDestinationYieldModifier |
PlayerTrade:ChangeDestinationYieldModifier(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point modifier to the destination yield of trade routes, per yield. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeDestinationYieldModifier |
0x33c2a0 |
| ChangeDestinationYieldPerImprovementAtDestination |
PlayerTrade:ChangeDestinationYieldPerImprovementAtDestination(eYield: integer, eImprovement: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point amount to the yield trade routes get per improvement of a given type at the destination, per yield. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeDestinationYieldPerImprovementAtDestination |
0x33c300 |
| ChangeDestinationYieldPerTerrainForDomestic ✓ |
PlayerTrade:ChangeDestinationYieldPerTerrainForDomestic(eYield: integer, eTerrain: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a fixed-point amount to the yield domestic trade routes get per terrain type at the destination, per yield. |
plumbing ✓ effect ✓ (GetFoodSurplus, GetTurnsUntilGrowth) |
Player::Trade::ChangeDestinationYieldPerTerrainForDomestic |
0x33c390 |
| ChangeDestinationYieldPerTerrainForInternational |
PlayerTrade:ChangeDestinationYieldPerTerrainForInternational(eYield: integer, eTerrain: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-terrain destination-yield bonus for international trade routes (a yield-by-terrain table on the player's Trade object). |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeDestinationYieldPerTerrainForInternational |
0x33c420 |
| ChangeDomesticTradeDisabledCount |
PlayerTrade:ChangeDomesticTradeDisabledCount(iDelta: integer) |
Adds a delta to the counter that disables domestic trade routes for the player; on the 0 to positive transition it tells the trade manager to disable existing domestic routes. |
plumbing ✓ ⚠ ran ±1, not fully reversible (lasting side effects): GetGoldYield, GetFoodSurplus, GetTurnsUntilGrowth |
Player::Trade::ChangeDomesticTradeDisabledCount |
0x33c4b0 |
| ChangeExtraWaterRangeRefuel |
PlayerTrade:ChangeExtraWaterRangeRefuel(iChange: integer) |
Adds iChange to the extra water-range-refuel value of the trade component and sends an event. |
plumbing ✓ |
— |
0x33c520 |
| ChangeFlatYieldBonus ✓ |
PlayerTrade:ChangeFlatYieldBonus(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the flat per-route yield bonus for a given yield type on the player's trade routes. |
plumbing ✓ effect ✓ (GetFoodSurplus, GetTurnsUntilGrowth) |
Player::Trade::ChangeFlatYieldBonus |
0x33c570 |
| ChangeFlatYieldBonusForCityState ✓ |
PlayerTrade:ChangeFlatYieldBonusForCityState(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the flat yield bonus given for trade routes to city-states. |
plumbing ✓ effect ✓ (GetFoodSurplus, GetTurnsUntilGrowth) |
Player::Trade::ChangeFlatYieldBonusForCityState |
0x33c5d0 |
| ChangeFlatYieldBonusForDomestic |
PlayerTrade:ChangeFlatYieldBonusForDomestic(eYield: integer, bIntercontinental: boolean, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the flat yield bonus for domestic trade routes, in one of two arrays chosen by whether the route is intercontinental. |
plumbing ✓ |
Player::Trade::ChangeFlatYieldBonusForDomestic |
0x33c630 |
| ChangeFlatYieldBonusForInternational |
PlayerTrade:ChangeFlatYieldBonusForInternational(eYield: integer, bIntercontinental: boolean, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the flat yield bonus for international trade routes, in one of two arrays chosen by the intercontinental flag. |
plumbing ✓ |
Player::Trade::ChangeFlatYieldBonusForInternational |
0x33c6c0 |
| ChangeImprovedRouteLevel |
PlayerTrade:ChangeImprovedRouteLevel(iChange: integer) |
Adds a delta to the player's improved trade route level. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeImprovedRouteLevel |
0x33c750 |
| ChangeInternationalMajorsTradeDisabledCount |
PlayerTrade:ChangeInternationalMajorsTradeDisabledCount(iDelta: integer) |
Adds a delta to the counter that disables international trade routes with major civs; on the 0 to positive transition it tells the trade manager to disable such routes. |
plumbing ✓ ⚠ ran ±1, not fully reversible (lasting side effects): GetGoldYield |
Player::Trade::ChangeInternationalMajorsTradeDisabledCount |
0x33c780 |
| ChangeInternationalMinorsTradeDisabledCount |
PlayerTrade:ChangeInternationalMinorsTradeDisabledCount(iDelta: integer) |
Adds a delta to the counter that disables international trade routes with minor civs (city-states); on the 0 to positive transition it tells the trade manager to disable such routes. |
plumbing ✓ ⚠ ran ±1, not fully reversible (lasting side effects): GetFaithYield, GetGoldYield, GetX, GetY, HasPendingOperations, GetCultureYield |
Player::Trade::ChangeInternationalMinorsTradeDisabledCount |
0x33c7f0 |
| ChangeInternationalYieldModifier |
PlayerTrade:ChangeInternationalYieldModifier(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the percentage-style yield modifier applied to international trade route yields. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeInternationalYieldModifier |
0x33c860 |
| ChangeInternationalYieldPerImprovementAtOrigin |
PlayerTrade:ChangeInternationalYieldPerImprovementAtOrigin(eYield: integer, eImprovement: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-improvement yield bonus at the origin of international routes (improvement-by-yield table). |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeInternationalYieldPerImprovementAtOrigin |
0x33c8c0 |
| ChangeOriginYieldForAllyRoute |
PlayerTrade:ChangeOriginYieldForAllyRoute(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the yield granted to the origin for routes to an ally. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeOriginYieldForAllyRoute |
0x33c950 |
| ChangeOriginYieldForSuzerainRoute |
PlayerTrade:ChangeOriginYieldForSuzerainRoute(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the origin yield granted for routes to city-states the player is suzerain of. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeOriginYieldForSuzerainRoute |
0x33c9b0 |
| ChangeOriginYieldModifier |
PlayerTrade:ChangeOriginYieldModifier(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the modifier applied to yields the origin city receives from its trade routes. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeOriginYieldModifier |
0x33ca10 |
| ChangeOriginYieldPerImprovementAtDestination |
PlayerTrade:ChangeOriginYieldPerImprovementAtDestination(eYield: integer, eImprovement: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-improvement yield bonus that the origin receives based on improvements at the route destination. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeOriginYieldPerImprovementAtDestination |
0x33ca70 |
| ChangeOriginYieldPerTerrainForDomestic |
PlayerTrade:ChangeOriginYieldPerTerrainForDomestic(eYield: integer, eTerrain: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-terrain origin yield bonus for domestic trade routes. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeOriginYieldPerTerrainForDomestic |
0x33cb00 |
| ChangeOriginYieldPerTerrainForInternational |
PlayerTrade:ChangeOriginYieldPerTerrainForInternational(eYield: integer, eTerrain: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-terrain origin yield bonus for international trade routes. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeOriginYieldPerTerrainForInternational |
0x33cb90 |
| ChangeOutgoingRouteCapacity ✓ |
PlayerTrade:ChangeOutgoingRouteCapacity(iChange: integer) |
Adds a delta to the player's outgoing trade route capacity and sends an event. |
plumbing ✓ effect ✓ (GetOutgoingRouteCapacity) |
Player::Trade::ChangeOutgoingRouteCapacity |
0x33cc20 |
| ChangePerSpecialtyDistrictYieldBonusForDomestic |
PlayerTrade:ChangePerSpecialtyDistrictYieldBonusForDomestic(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-specialty-district yield bonus for domestic trade routes. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangePerSpecialtyDistrictYieldBonusForDomestic |
0x33cc80 |
| ChangePerSpecialtyDistrictYieldBonusForInternational |
PlayerTrade:ChangePerSpecialtyDistrictYieldBonusForInternational(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the per-specialty-district yield bonus for international trade routes. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangePerSpecialtyDistrictYieldBonusForInternational |
0x33cce0 |
| ChangeYieldBonusForProgressDifference |
PlayerTrade:ChangeYieldBonusForProgressDifference(iTechsCivicsPerYield: integer) |
Overwrites the yield-bonus-for-progress-difference field at +0x4e0 with the passed value (despite the name Change, the code assigns the value). |
plumbing ✓ |
— |
0x33cd40 |
| ChangeYieldPerFollower |
PlayerTrade:ChangeYieldPerFollower(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the yield-per-religious-follower bonus applied to trade routes. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeYieldPerFollower |
0x33cd70 |
| ChangeYieldPerPathTile |
PlayerTrade:ChangeYieldPerPathTile(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the yield granted per tile along a trade route path. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeYieldPerPathTile |
0x33cdc0 |
| ChangeYieldPerTradingPostInForeignCity |
PlayerTrade:ChangeYieldPerTradingPostInForeignCity(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the yield granted per trading post the player has in foreign cities. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeYieldPerTradingPostInForeignCity |
0x33ce10 |
| ChangeYieldPerTradingPostInOwnCity |
PlayerTrade:ChangeYieldPerTradingPostInOwnCity(eYield: integer, xChange: number (fixed point, 1/256 steps)) |
Adds a signed amount to the yield granted per trading post present in the player's own cities. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Trade::ChangeYieldPerTradingPostInOwnCity |
0x33ce60 |
| CheckCapacityNotification |
PlayerTrade:CheckCapacityNotification() |
Compares current trade route capacity with the last remembered value and, if capacity grew and routes are free, sends a notification; then stores the new value. |
plumbing ✓ |
— |
0x33ceb0 |
| DoTurnActivate |
PlayerTrade:DoTurnActivate() |
For each alive unit of the player that is a trader (flag 0x40 on its definition) and not on an active route, asks the Trade Manager to update paths for the idle trader. |
plumbing ✓ |
— |
0x33d4d0 |
| GetDestinationYieldModifier |
PlayerTrade:GetDestinationYieldModifier(eYield: integer) → number |
Returns the destination yield modifier for the given yield from a per-yield array, defaulting to 1.0 (0x100) when out of range. |
plumbing ✓ |
— |
0x33d620 |
| GetInternationalYieldModifier |
PlayerTrade:GetInternationalYieldModifier(eYield: integer) → number |
Returns the international trade yield modifier for the given yield, defaulting to 1.0 (0x100) when out of range. |
plumbing ✓ |
— |
0x33da30 |
| GetOriginYieldModifier |
PlayerTrade:GetOriginYieldModifier(eYield: integer) → number |
Returns the origin yield modifier for the given yield, defaulting to 1.0 (0x100) when out of range. |
plumbing ✓ |
— |
0x33dbb0 |
Details
ChangeCityStateDistrictTradeRouteBonus
Arguments: eYield — yield type index; xChange — delta raw/256
Writes
- array element in VariantMap at this+0x3c0
Input checks: Unsigned bound check; invalid yield silently ignored.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (bounds checked). Confidence of the reading: high.
Verified from the code
- bounds check
- adds delta to element
Inferred
- Read pointer (0x3d0) and edit pointer (0x3c0) refer to same storage
ChangeDestinationYieldForAllyRoute
Arguments: eYield — yield type index; xChange — delta raw/256
Writes
- array element in VariantMap at this+0x420
Input checks: Unsigned bound check; invalid yield silently ignored.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (bounds checked). Confidence of the reading: high.
Verified from the code
- bounds check
- adds delta to element
ChangeDestinationYieldForSuzerainRoute
Arguments: eYield — yield type index; xChange — delta raw/256
Writes
- array element in VariantMap at this+0x480
Input checks: Unsigned bound check; invalid yield silently ignored.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (bounds checked). Confidence of the reading: high.
Verified from the code
- bounds check
- adds delta to element
ChangeDestinationYieldModifier
Arguments: eYield — yield type index; xChange — delta raw/256
Writes
- array element in VariantMap at this+0x618
Input checks: Unsigned bound check; invalid yield silently ignored.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (bounds checked). Confidence of the reading: high.
Verified from the code
- bounds check
- adds delta to element
Inferred
- modifier is a percent-like multiplier from name
ChangeDestinationYieldPerImprovementAtDestination
Arguments: eYield — yield type index; eImprovement — improvement type index; xChange — delta raw/256
Writes
- 2D table element (improvement row of 0x20 bytes, yield column) in VariantMap at this+0x6a8
Input checks: Both indices bounds checked (improvement against table, yield against yield definitions); invalid silently ignored. If row's inner array is too short, the add goes to a fallback slot in the row header region.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: medium (fallback write path when inner array shorter than yield index). Confidence of the reading: medium.
Verified from the code
- two bounds checks
- inner row indexed with bounds check, else adds to a default slot at row+0x18
Inferred
- row is a small vector with a default value
Open questions
- Meaning of the default slot
ChangeDestinationYieldPerTerrainForDomestic
Arguments: eYield — yield type index; eTerrain — terrain type index; xChange — delta raw/256
Writes
- 2D table element (terrain row, yield column) in VariantMap at this+0x738
Input checks: Both indices bounds checked; invalid silently ignored. Short inner array falls back to a default slot.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: medium (fallback write path when inner array shorter than yield index). Confidence of the reading: medium.
Verified from the code
- two bounds checks
- inner row indexed with bounds check, else adds to a default slot at row+0x18
Inferred
- Domestic scope is from the name only
Open questions
- Meaning of the default slot
ChangeDestinationYieldPerTerrainForInternational
Arguments: eYield — yield column to modify; eTerrain — terrain row to modify; xChange — delta added to the stored value (raw/256); passed by pointer in the ABI
Writes
- 2D table at this+0x798 (terrain x yield, FAutoVariable) incremented by xChange
Side effects
- calls edit() on the auto-variable, marking synced state dirty
Input checks: Silent no-op if terrain index >= row count or yield index >= yield definition count. If the yield index is beyond the inner row length the add goes to a dummy slot instead of crashing. xChange pointer is not checked.
Preconditions
- gameplay Lua state
- valid Trade object of a player
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change to a modifier table). Confidence of the reading: high.
Verified from the code
- terrain index checked against rows of 0x20 bytes
- yield index checked against GetYieldDefinitions count
- adds *param to the stored int
- table is edited through FAutoVariable::edit at this+0x798
Inferred
- bonus applies to destination end of international routes, from the name
- the value is a yield amount in FixedPoint units
Open questions
- where the table is consumed when computing route yields
ChangeDomesticTradeDisabledCount
Arguments: iDelta — amount added to the disabled counter
Writes
- int auto-variable at this+0x840 (counter value at this+0x850)
- trade manager route state for the player
Side effects
- Trade::Manager::DisableDomesticRoutesForPlayer when the counter goes from <=0 to >0, which cancels or disables existing routes
Input checks: None on delta; counter may go negative. Owner pointer is dereferenced unchecked on the transition.
Preconditions
- gameplay Lua state only
- owner player must be set
Multiplayer: may-desync: cancels routes in the shared trade manager. Risk: medium (can cancel existing trade routes; unchecked owner deref). Confidence of the reading: medium.
Verified from the code
- adds delta to counter at this+0x850
- calls the manager disable function only if old value < 1 and new value > 0
Inferred
- re-enabling is handled elsewhere, no call on the decrement path here
Open questions
- whether routes are restored when the counter returns to zero
ChangeExtraWaterRangeRefuel
Arguments: iChange — Delta added to the extra water refuel range
Writes
- Extra water refuel range at +0x120/+0x130
Side effects
- Sends an event (hash 0x39a17bf7) for the owning player
Input checks: Zero change is ignored; no range limits on the result.
Multiplayer: may-desync, writes player trade state. Risk: medium (Small state change with an event). Confidence of the reading: high.
ChangeFlatYieldBonus
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x210 (FAutoVariable) element += xChange
Side effects
- edit() on auto-variable marks state dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- index bound is vector size at this+0x220/0x228 (4-byte elements)
- value read from the cached vector, written through edit() at this+0x210
- result is current + change
Inferred
- bonus is applied to all route kinds, from the name
Open questions
- consumer of the value; whether the read vector and the edited storage are always identical
ChangeFlatYieldBonusForCityState
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x270 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- same pattern as ChangeFlatYieldBonus on arrays at 0x270/0x280/0x288
Inferred
- applies to routes whose destination is a city-state, from the name
Open questions
- consumer of the value
ChangeFlatYieldBonusForDomestic
Arguments: eYield — yield index; bIntercontinental — false selects the array at 0x240, true selects the array at 0x330; xChange — delta (raw/256)
Writes
- per-yield array at this+0x240 (same-continent) or this+0x330 (intercontinental) element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= length of the chosen array. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- bool picks between two (auto-variable, vector) pairs
- bound check uses the chosen vector
Inferred
- bool name from Linux debug info; meaning of the two arrays inferred from it
Open questions
- consumer of the arrays
ChangeFlatYieldBonusForInternational
Arguments: eYield — yield index; bIntercontinental — false selects array at 0x300, true selects array at 0x360; xChange — delta (raw/256)
Writes
- per-yield array at this+0x300 or this+0x360 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= length of the chosen array. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- identical structure to the Domestic variant with different offsets
Inferred
- which array is for which case follows the parameter name
Open questions
- consumer of the arrays
ChangeImprovedRouteLevel
Arguments: iChange — amount added to the level
Writes
- int auto-variable at this+0xd8 (value at this+0xe8 plus change)
Side effects
- none visible; auto-variable assign likely marks state dirty
Input checks: Does nothing when the delta is 0. No other checks.
Preconditions
- gameplay Lua state only
Multiplayer: may-desync: direct state write. Risk: low (simple counter). Confidence of the reading: high.
Verified from the code
- early return when iChange is 0
- stores this+0xe8 + iChange into the variable at this+0xd8
Inferred
- consumed by route yield calculations
Open questions
- where the level is read
ChangeInternationalMajorsTradeDisabledCount
Arguments: iDelta — amount added to the disabled counter
Writes
- int auto-variable at this+0x810 (counter value at this+0x820)
- trade manager route state for the player
Side effects
- Trade::Manager::DisableInternationalMajorsRoutesForPlayer when the counter goes from <=0 to >0
Input checks: None on delta; counter may go negative. Owner pointer dereferenced unchecked on the transition.
Preconditions
- gameplay Lua state only
- owner player must be set
Multiplayer: may-desync: cancels routes in the shared trade manager. Risk: medium (can cancel existing trade routes; unchecked owner deref). Confidence of the reading: medium.
Verified from the code
- adds delta to counter at this+0x820
- calls the manager disable function only if old value < 1 and new value > 0
Inferred
- re-enabling handled elsewhere
Open questions
- whether routes return when the counter reaches zero
ChangeInternationalMinorsTradeDisabledCount
Arguments: iDelta — amount added to the disabled counter
Writes
- int auto-variable at this+0x828 (counter value at this+0x838)
- trade manager route state for the player
Side effects
- Trade::Manager::DisableInternationalMinorsRoutesForPlayer when the counter goes from <=0 to >0
Input checks: None on delta; counter may go negative. Owner pointer dereferenced unchecked on the transition.
Preconditions
- gameplay Lua state only
- owner player must be set
Multiplayer: may-desync: cancels routes in the shared trade manager. Risk: medium (can cancel existing trade routes; unchecked owner deref). Confidence of the reading: medium.
Verified from the code
- adds delta to counter at this+0x838
- calls the manager disable function only if old value < 1 and new value > 0
Inferred
- re-enabling handled elsewhere
Open questions
- whether routes return when the counter reaches zero
ChangeInternationalYieldModifier
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x5b8 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x5b8 edited by index with bound check
Inferred
- value is a multiplier or percent modifier, from the name
Open questions
- exact unit (percent vs fraction) of the stored value
ChangeInternationalYieldPerImprovementAtOrigin
Arguments: eYield — yield column; eImprovement — improvement row; xChange — delta (raw/256)
Writes
- 2D table at this+0x6d8 (improvement x yield) incremented by xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent no-op if improvement index >= row count or yield index >= yield definition count; inner out-of-range yield writes to a dummy slot. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- same 2D pattern as the terrain variant using table at 0x6d8
Inferred
- meaning of 'per improvement at origin' from the name
Open questions
- how the consumer counts improvements
ChangeOriginYieldForAllyRoute
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x3f0 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x3f0 edited by index with bound check
Inferred
- applies to routes with an allied destination, from the name
Open questions
- consumer of the value
ChangeOriginYieldForSuzerainRoute
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x450 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x450 edited by index with bound check
Inferred
- suzerain meaning from the name
Open questions
- consumer of the value
ChangeOriginYieldModifier
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x5e8 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x5e8 edited by index with bound check
Inferred
- unit of the modifier (percent vs fraction) not shown
Open questions
- exact unit and consumer
ChangeOriginYieldPerImprovementAtDestination
Arguments: eYield — yield column; eImprovement — improvement row; xChange — delta (raw/256)
Writes
- 2D table at this+0x678 (improvement x yield) incremented by xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent no-op if improvement index >= row count or yield index >= yield definition count; inner out-of-range yield writes to a dummy slot. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- 2D table at 0x678 edited with the same pattern as other per-X tables
Inferred
- origin/destination semantics from the name
Open questions
- how improvements are counted by the consumer
ChangeOriginYieldPerTerrainForDomestic
Arguments: eYield — yield column; eTerrain — terrain row; xChange — delta (raw/256)
Writes
- 2D table at this+0x708 (terrain x yield) incremented by xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent no-op if terrain index >= row count or yield index >= yield definition count; inner out-of-range yield writes to a dummy slot. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- 2D table at 0x708 with bound checks on both indices
Inferred
- what terrain is counted (path or destination) is not visible here
Open questions
- which tiles the consumer counts
ChangeOriginYieldPerTerrainForInternational
Arguments: eYield — yield column; eTerrain — terrain row; xChange — delta (raw/256)
Writes
- 2D table at this+0x768 (terrain x yield) incremented by xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent no-op if terrain index >= row count or yield index >= yield definition count; inner out-of-range yield writes to a dummy slot. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- 2D table at 0x768 with bound checks on both indices
Inferred
- what terrain is counted is not visible here
Open questions
- which tiles the consumer counts
ChangeOutgoingRouteCapacity
Arguments: iChange — delta to route capacity
Writes
- outgoing route capacity at this+0xa0 (auto-variable at this+0x90)
Side effects
- sends Reporting::Event 0xa5423bfe with owner id
Input checks: No-op if iChange is 0. No clamp, so the result can go negative.
Preconditions
- gameplay state
Multiplayer: safe-deterministic. Risk: low (Simple integer add). Confidence of the reading: high.
Verified from the code
- no-op for zero
- no lower clamp
- event sent after write
Inferred
- this is the modifier behind the trade route capacity displayed in UI
ChangePerSpecialtyDistrictYieldBonusForDomestic
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x2a0 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x2a0 edited by index with bound check
Inferred
- 'per specialty district' counting happens in the consumer
Open questions
- consumer
ChangePerSpecialtyDistrictYieldBonusForInternational
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x2d0 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x2d0 edited by index with bound check
Inferred
- 'per specialty district' counting happens in the consumer
Open questions
- consumer
ChangeYieldBonusForProgressDifference
Arguments: iTechsCivicsPerYield — Value assigned to the field; the code does not add it to the old value (inferred)
Writes
- Yield bonus for tech/civic progress difference at +0x4e0
Input checks: No validation.
Multiplayer: may-desync, writes player trade state. Risk: low (Simple assignment). Confidence of the reading: medium.
ChangeYieldPerFollower
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x588 element += xChange (edited storage read-modify-write)
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- bound from vector at 0x598/0x5a0, element incremented in the edit() storage of 0x588
Inferred
- follower meaning from the name
Open questions
- which religion's followers the consumer counts
ChangeYieldPerPathTile
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x558 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x558 edited by index with bound check
Inferred
- per path tile semantics from the name
Open questions
- consumer
ChangeYieldPerTradingPostInForeignCity
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x4f8 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x4f8 edited by index with bound check
Inferred
- foreign-city meaning from the name
Open questions
- consumer
ChangeYieldPerTradingPostInOwnCity
Arguments: eYield — yield index; xChange — delta (raw/256)
Writes
- per-yield array at this+0x528 element += xChange
Side effects
- edit() marks synced variable dirty
Input checks: Silent return if yield index >= array length. xChange pointer not checked.
Preconditions
- gameplay Lua state
- valid Trade object
- game thread
Multiplayer: may-desync: mutates synced game state; only safe when run identically on all clients. Risk: low (bounds-checked additive change). Confidence of the reading: high.
Verified from the code
- array at this+0x528 edited by index with bound check
Inferred
- own-city meaning from the name
Open questions
- consumer
CheckCapacityNotification
Writes
- Remembered capacity value at +0xa8
Side effects
- May send a notification (hash 0xcce487d2) to the owning player
Input checks: No validation.
Multiplayer: may-desync, writes player state and sends a notification. Risk: low (Only a notification and a remembered value). Confidence of the reading: high.
DoTurnActivate
Writes
- Trade manager path data for idle traders
Side effects
- Trade manager recomputes paths
Input checks: Skips units that are dead or have no definition.
Multiplayer: may-desync, edits trade manager state. Risk: medium (Alters shared trade manager data). Confidence of the reading: medium.
GetDestinationYieldModifier
Arguments: eYield — Yield type index (passed in a register, decompiler lost its name) (inferred)
Input checks: Range checked; falls back to 1.0.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
GetInternationalYieldModifier
Arguments: eYield — Yield type index (passed in a register, decompiler lost its name) (inferred)
Input checks: Range checked; falls back to 1.0.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
GetOriginYieldModifier
Arguments: eYield — Yield type index (passed in a register, decompiler lost its name) (inferred)
Input checks: Range checked; falls back to 1.0.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.