Home › Dev CE (experimental) › TradeManager

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.

TradeManager

10 methods (Dev CE test build). this is found with the game's own ITradeManager instance resolver (plain).

Method Signature Purpose (AI-written, inferred) Tested Engine function Current
ClearTempRoutes TradeManager:ClearTempRoutes() → number Destroys all temporary routes in the manager's vector (+0x218) and clears it, returning the number cleared. plumbing ✓ — 0x38d6d0
DisableDomesticRoutesForPlayer TradeManager:DisableDomesticRoutesForPlayer(disablePlayer: integer) Removes all routes of the player to its own cities from the graph and cleans up each removed route. plumbing ✓ — 0x38e2c0
DisableInternationalMajorsRoutesForPlayer TradeManager:DisableInternationalMajorsRoutesForPlayer(disablePlayer: integer) Removes routes between the given player and every other major player (both directions) and cleans them up. plumbing ✓ — 0x38e3b0
DisableInternationalMinorsRoutesForPlayer TradeManager:DisableInternationalMinorsRoutesForPlayer(disablePlayer: integer) Removes routes between the given player and every other non-major player (city-states) in both directions and cleans them up. plumbing ✓ — 0x38e530
DoTurn TradeManager:DoTurn() Clears temporary routes and, if any were cleared, dispatches a no-argument game signal. plumbing ✓ — 0x38eec0
GetEarliestEndTurnForRoute TradeManager:GetEarliestEndTurnForRoute(startTurn: integer) → number Computes the earliest turn a route started on startTurn may end: start plus a game-speed-adjusted global duration, plus an era/government-specific extra duration when defined, at least start+1. plumbing ✓ — 0x38f720
HasActiveRoute TradeManager:HasActiveRoute(plotIndex: integer) → boolean Scans the graph's edge table for an active edge whose list of plot indices contains the given plot and returns true if any. plumbing ✓ — 0x386620
IsLandRouteAllowed TradeManager:IsLandRouteAllowed(originPlayer: integer, iX: integer, iY: integer) → boolean Checks whether the origin player may route over the plot at (iX,iY): false if plot or player invalid, otherwise tests a per-player counter that differs for the player's own territory versus other territory, allowed when counter below 1. plumbing ✓ — 0x38fd10
IsWaterRouteAllowed TradeManager:IsWaterRouteAllowed(originPlayer: integer) → boolean Returns whether the player can embark the UNIT_TRADER unit, used as the water-route permission. plumbing ✓ — 0x390040
RemoveEdgeByID TradeManager:RemoveEdgeByID(iID: integer) → boolean Removes the edge with the given ID from the trade graph: erases it from both vertex adjacency maps and the edge table, destroys it and returns it to the free list. plumbing ✓ — 0x386f30

Details

ClearTempRoutes

Writes - Temporary route vector end pointer

Input checks: None.

Multiplayer: may-desync, clears manager route list. Risk: low (Temp routes are normally local previews.). Confidence of the reading: medium.

DisableDomesticRoutesForPlayer

Arguments: disablePlayer — Player whose domestic routes are removed

Writes - Trade graph routes - Route state via CleanupRemovedRoute

Side effects - Cleanup of removed routes (reason code 7)

Input checks: Checks player ID < 0x41 and that the player exists; otherwise no-op.

Multiplayer: may-desync, removes trade routes. Risk: high (Cancels existing routes.). Confidence of the reading: medium.

DisableInternationalMajorsRoutesForPlayer

Arguments: disablePlayer — Player whose routes with majors are removed

Writes - Trade graph routes - Route state via CleanupRemovedRoute

Side effects - Cleanup of removed routes (reason code 7)

Input checks: Checks player ID < 0x41 and existing; skips itself and null/non-major players.

Multiplayer: may-desync, removes trade routes. Risk: high (Cancels existing routes.). Confidence of the reading: medium.

DisableInternationalMinorsRoutesForPlayer

Arguments: disablePlayer — Player whose routes with minors are removed

Writes - Trade graph routes - Route state via CleanupRemovedRoute

Side effects - Cleanup of removed routes (reason code 7)

Input checks: Checks player ID < 0x41 and existing; skips itself and major players.

Multiplayer: may-desync, removes trade routes. Risk: high (Cancels existing routes.). Confidence of the reading: medium.

DoTurn

Writes - Temporary route vector (via ClearTempRoutes)

Side effects - Dispatches game signal at game+0x280 +0x13b0 when routes were cleared

Input checks: None.

Multiplayer: may-desync, per-turn manager processing. Risk: low (Small turn hook.). Confidence of the reading: medium.

GetEarliestEndTurnForRoute

Arguments: startTurn — Turn the route starts

Input checks: None.

Multiplayer: read-only, computes from rules and era. Risk: low (Pure getter.). Confidence of the reading: medium.

HasActiveRoute

Arguments: plotIndex — Plot index to search for on active routes

Input checks: None.

Multiplayer: read-only, scans edge table. Risk: low (Pure check.). Confidence of the reading: medium.

IsLandRouteAllowed

Arguments: originPlayer — Player whose route would use the plot; iX — Plot X; iY — Plot Y

Input checks: Null plot and -1 player return false; coordinates not range checked beyond map lookup.

Multiplayer: read-only, inspects map and player counters. Risk: low (Pure check.). Confidence of the reading: medium.

IsWaterRouteAllowed

Arguments: originPlayer — Player to check

Input checks: No player validity check; missing trader type passes -1.

Multiplayer: read-only, checks embark ability. Risk: low (Pure check.). Confidence of the reading: medium.

RemoveEdgeByID

Arguments: iID — Edge ID to remove

Writes - Edge hash table, adjacency maps (+0xf0, +0x118), edge free list and count

Input checks: Returns false if the ID is not found.

Multiplayer: may-desync, mutates trade graph. Risk: high (Private graph edit; stale routes may reference it.). Confidence of the reading: medium.