Home › Dev CE (experimental) › Territory

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.

Territory

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

Method Signature Purpose (AI-written, inferred) Tested Engine function Current
ChangeFeatureCount Territory:ChangeFeatureCount(eFeature: integer, iChange: integer) Adds a delta to the per-feature plot count of a territory and to its total feature count. plumbing: not run (no live object) — 0x2c6c0
ChangePlotCount Territory:ChangePlotCount(iChange: integer) Adds a delta to the territory plot count and recomputes the two averages (+0x58/+0x5c divided by count) into +0x60/+0x64, or sets them to -1 when count is not positive. plumbing: not run (no live object) — 0x2c720
SetIsLake Territory:SetIsLake(bIsLake: boolean) Sets the territory is-lake flag (byte at +0x20); also calls Types::GetIndex on a constant hash whose result is unused. plumbing: not run (no live object) — 0x2ce30
SetIsSea Territory:SetIsSea(bIsSea: boolean) Sets whether a map territory is a sea territory. plumbing: not run (no live object) Map::Territory::Instance::SetIsSea 0x2ce60

Details

ChangeFeatureCount

Arguments: eFeature — feature type to adjust; iChange — amount added to the counters

Writes - territory per-feature count array entry - territory total feature count (+0x1c)

Input checks: Ignores -1 and feature indices beyond the array; iChange not checked.

Multiplayer: may-desync, writes map territory state. Risk: medium (raw counter edit can desync territory statistics). Confidence of the reading: high.

ChangePlotCount

Arguments: iChange — amount added to the plot count

Writes - territory plot count (+8) - territory averages at +0x60 and +0x64

Input checks: Guards division by zero; iChange not range checked.

Multiplayer: may-desync, writes map territory state. Risk: medium (raw counter edit). Confidence of the reading: medium.

SetIsLake

Arguments: bIsLake — new lake flag

Writes - territory lake flag (+0x20)

Input checks: None.

Multiplayer: may-desync, writes map territory state. Risk: medium (changes territory classification). Confidence of the reading: medium.

SetIsSea

Arguments: bIsSea — new sea flag

Writes - sea flag byte at this+0x21

Side effects - calls Types::GetIndex with a constant hash (result unused)

Input checks: none

Preconditions - valid territory instance

Multiplayer: safe-deterministic. Risk: low (single flag write). Confidence of the reading: high.

Verified from the code - stores bool at this+0x21 - calls Types::GetIndex(0x74d79f02) and discards result

Inferred - GetIndex call is a leftover or lazily initialised lookup

Open questions - whether other territory caches are updated elsewhere