Home › Dev CE (experimental) › Deal

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.

Deal

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

Method Signature Purpose (AI-written, inferred) Tested Engine function Current
DoTurn Deal:DoTurn(ePlayer: integer) If the deal is active, calls a virtual per-turn handler on each item belonging to the given player and then removes expired items. plumbing: not run (no live object) — 0x57e9d0
IsExpired Deal:IsExpired() → boolean True if every item in the deal reports itself expired (virtual call); an empty deal counts as expired. plumbing: not run (no live object) — 0x57f270
RemoveExpiredItems Deal:RemoveExpiredItems() Walks the items of a deal, removes those that report themselves expired, logs them, and dispatches a signal the first time an expired item implies a war ended. plumbing: not run (no live object) Diplomacy::Deal::Instance::RemoveExpiredItems 0x57f3f0

Details

DoTurn

Arguments: ePlayer — player whose items get the turn update

Writes - Deal item list via RemoveExpiredItems and item virtual handler

Side effects - Virtual item turn callback per matching item

Input checks: No validation; skipped if active flag (0xc) is zero.

Multiplayer: may-desync, changes deal items. Risk: high (affects ongoing deals and may expire them). Confidence of the reading: medium.

IsExpired

Input checks: None.

Multiplayer: read-only, reads deal items only. Risk: low (pure getter). Confidence of the reading: high.

RemoveExpiredItems

Writes - deal item list (this+0x10..0x18) via Deal::Instance::RemoveItem

Side effects - writes lines to the deal log file - dispatches a three-argument signal (player, player, item) on a Game signal object, once per call - removes items (which may have its own side effects)

Input checks: Null log file is tolerated. Iteration continues using the iterator returned by RemoveItem.

Preconditions - game thread - deal manager initialised

Multiplayer: safe-deterministic. Risk: medium (Removes deal items and fires a signal; private method, depends on deal state.). Confidence of the reading: medium.

Verified from the code - Calls a virtual method at vtable+0x80 on each item to decide expiry - Logs 'Removing expired Deal Items' header once and each item description - Checks IsAtWar between the item's two players; if at war and not yet signalled, determines which side started it and dispatches the signal - Calls RemoveItem for expired items

Inferred - Signal likely indicates a war ending or peace deal expiring; exact signal name unknown - Virtual at +0x80 is IsExpired

Open questions - Semantics of the dispatched signal and its parameter order - Whether the at-war check means 'war should end'