Home › Dev CE (experimental) › CityDistricts

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.

CityDistricts

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

Method Signature Purpose (AI-written, inferred) Tested Engine function Current
AreAnyPillaged CityDistricts:AreAnyPillaged(eDistrictType: integer) → boolean Checks whether any district of the given type belonging to this city is pillaged. plumbing ✓
this ✓ (oracle)
— 0x11e080
DestroyAll CityDistricts:DestroyAll() Destroys every district belonging to this city by walking its district id list from the end and destroying each instance. plumbing ✓
this ✓ (oracle)
City::Districts::DestroyAll 0x11e3f0
GetNumAllowedDistricts CityDistricts:GetNumAllowedDistricts() → number Number of districts the city may have: ceil(population / divisor from game parameters) plus a bonus field; returns 1 if the divisor is not positive. plumbing ✓
this ✓ (oracle)
— 0x11eae0
HasDistrictOfMilitaryDomain CityDistricts:HasDistrictOfMilitaryDomain(eDomain: integer) → boolean Checks whether the city has an active district whose definition's military domain matches the given domain. plumbing ✓
this ✓ (oracle)
— 0x11ef20

Details

AreAnyPillaged

Arguments: eDistrictType — district type to look for

Input checks: No range check on type; skips missing districts.

Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: high.

DestroyAll

Writes - city district id list count at this+0x18 (decremented for stale ids) - indirectly removes district instances via City::Districts::Destroy

Side effects - calls City::Districts::Destroy for each found district (which may fire its own events) - stale ids with no matching district are just dropped from the count

Input checks: Silent return if the city pointer is null. Stale ids (district not found) are discarded. Owner id from the city is used unchecked to index the player array.

Preconditions - city must have a valid owner - gameplay state only - game thread

Multiplayer: safe-deterministic. Risk: medium (Destroys districts; relies on Destroy shrinking the list or the loop never terminates.). Confidence of the reading: medium.

Verified from the code - Returns immediately when this+0x0 is null - Loops while the count at this+0x18 is nonzero, looking up the last id via Player::Districts::Find - If Find returns null the count is decremented, else Destroy(this, instance) is called

Inferred - Destroy removes the id from the list (otherwise infinite loop) - this+0x0 is the City instance

Open questions - Whether Destroy leaves the city city-center district handling to the caller

GetNumAllowedDistricts

Input checks: Guards against divisor below 1.

Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: high.

HasDistrictOfMilitaryDomain

Arguments: eDomain — domain type to match (land/sea/air)

Input checks: Bounds-checks definition index; no range check on domain.

Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.