Home › Dev CE (experimental) › CityGrowth
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.
CityGrowth
14 methods (Dev CE test build). this is found with the game's own ICityGrowth instance resolver (plain).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| AddGrowth |
CityGrowth:AddGrowth(xGrowth: number (fixed point, 1/256 steps)) |
Adds food growth to a city; grows population when it crosses the threshold and shrinks it when stored food goes negative. |
plumbing ✓ this ✓ (oracle) |
City::Growth::AddGrowth |
0x123160 |
| ChangeFeatureAppealModifier |
CityGrowth:ChangeFeatureAppealModifier(eFeature: integer, iChange: integer) |
Adds a delta to the appeal modifier a city gets for a specific feature type, creating the entry if missing and removing it if the total returns to zero. |
plumbing ✓ ran ±1, reversible ✓, no visible effect this ✓ (oracle) |
City::Growth::ChangeFeatureAppealModifier |
0x123370 |
| DoCityGrowth |
CityGrowth:DoCityGrowth() |
Per-turn city growth step: computes food surplus (food yield minus consumption), applies growth modifier, adds it via AddGrowth, and sends starvation, stagnation, housing and amenity notifications (each throttled to once per 10 turns). |
plumbing ✓ this ✓ (oracle) |
— |
0x123460 |
| GetAmenitiesLostFromWarWeariness |
CityGrowth:GetAmenitiesLostFromWarWeariness() → number |
Returns amenities this city loses to war weariness, from the owner's diplomacy state. |
plumbing ✓ this ✓ (oracle) |
— |
0x123fb0 |
| GetAmenitiesNeeded |
CityGrowth:GetAmenitiesNeeded() → number |
Returns amenities the city needs for its population from the economic rules. |
plumbing ✓ this ✓ (oracle) |
— |
0x123fe0 |
| GetFeatureAppealModifier |
CityGrowth:GetFeatureAppealModifier(eFeature: integer) → number |
Looks up the city's stored appeal modifier for a feature type; 0 if none. |
plumbing ✓ this ✓ (oracle) |
— |
0x124010 |
| GetHappinessGrowthModifier |
CityGrowth:GetHappinessGrowthModifier() → number |
Growth modifier from happiness: amenity surplus mapped to a happiness level then to a growth modifier. |
plumbing ✓ this ✓ (oracle) |
— |
0x124110 |
| GetHousingGrowthModifier |
CityGrowth:GetHousingGrowthModifier() → number |
Growth modifier from housing: housing from water, buildings, improvements and districts passed to the surplus-reduction rule. |
plumbing ✓ this ✓ (oracle) |
— |
0x1245e0 |
| GetLoyaltyGrowthModifier |
CityGrowth:GetLoyaltyGrowthModifier() → number |
Growth modifier from the city's loyalty level, read from the loyalty level definition; 1.0 (0x100) if no level. |
plumbing ✓ this ✓ (oracle) |
— |
0x124660 |
| GetOccupationGrowthModifier |
CityGrowth:GetOccupationGrowthModifier() → number |
Returns the global occupation growth modifier parameter converted to fixed point. |
plumbing ✓ this ✓ (oracle) |
— |
0x1246f0 |
| GetOtherGrowthModifier |
CityGrowth:GetOtherGrowthModifier() → number |
Other growth modifier: player growth-rate setting times 0.01 plus the city's own extra modifier field at 0x84. |
plumbing ✓ this ✓ (oracle) |
— |
0x124750 |
| GetTurnsUntilStarvation |
CityGrowth:GetTurnsUntilStarvation() → number |
Turns until the city's stored food runs out given a negative surplus; -1 if not starving or population is 1 or less, 1 if no stored food. |
plumbing ✓ this ✓ (oracle) |
— |
0x124a80 |
| HasDroughtPrevention |
CityGrowth:HasDroughtPrevention() → boolean |
Checks whether the city has a district or a worked improvement (flagged in XP2 definitions) that prevents drought. |
plumbing ✓ this ✓ (oracle) |
— |
0x124c70 |
| RemoveFeatureAppealModifier |
CityGrowth:RemoveFeatureAppealModifier(eFeature: integer) |
Removes the city's appeal modifier entry for a feature by swapping in the last entry. |
plumbing ✓ this ✓ (oracle) |
— |
0x124e10 |
Details
AddGrowth
Arguments: xGrowth — food amount to add (raw/256)
Writes
- stored growth at this+0x80
- city population via ChangePopulation(+1/-1)
Side effects
- City::Instance::ChangePopulation
Input checks: Negative stored food with population greater than 1 starves one pop and resets; population 1 clamps to 0. Excess after growth is capped just below the threshold.
Preconditions
- valid city
- game thread
Multiplayer: safe-deterministic. Risk: medium (changes population). Confidence of the reading: high.
Verified from the code
- adds param to stored food
- growth when stored >= threshold*256: subtract threshold, +1 pop, cap
- negative path: -1 pop if pop>1, reset to threshold plus amount floored at 0
Inferred
- field at +0x80 is stored food in FixedPoint
ChangeFeatureAppealModifier
Arguments: eFeature — feature type; iChange — amount to add to the modifier
Writes
- vector of (feature, modifier) pairs at this+0x8 (size at +0x18, capacity at +0x10): append, update, or remove entry
Side effects
- calls RemoveFeatureAppealModifier when the sum would be zero
- may grow the vector (allocation)
Input checks: None on the feature id; any value is stored. No recalculation of appeal is triggered here.
Preconditions
- game thread
Multiplayer: safe-deterministic. Risk: low (Small list update; no appeal refresh visible.). Confidence of the reading: medium.
Verified from the code
- Linear search of an 8-byte (feature,int) pair list
- If not found: appends new pair (growing vector if full)
- If found and existing value equals -iChange: calls RemoveFeatureAppealModifier
- Otherwise adds iChange to the stored value
Inferred
- Entries are used to modify per-feature appeal calculation in the city
Open questions
- Who recomputes appeal after this change
DoCityGrowth
Writes
- Growth food accumulator (via AddGrowth)
- Last-notification turn fields at 0x88, 0x8c, 0x90, 0x94
Side effects
- Reporting::Notification::Send for starving, no-growth, housing and amenity warnings
Input checks: No argument validation; notification throttled by game turn.
Multiplayer: may-desync, changes city population food. Risk: high (drives population growth and sends notifications). Confidence of the reading: medium.
GetAmenitiesLostFromWarWeariness
Input checks: None; assumes valid owner.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: high.
GetAmenitiesNeeded
Input checks: None.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: high.
GetFeatureAppealModifier
Arguments: eFeature — feature type to look up
Input checks: No range check; linear search.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: high.
GetHappinessGrowthModifier
Input checks: None.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.
GetHousingGrowthModifier
Input checks: None.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.
GetLoyaltyGrowthModifier
Input checks: Bounds-checks definition index.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.
GetOccupationGrowthModifier
Input checks: None.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.
GetOtherGrowthModifier
Input checks: None.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.
GetTurnsUntilStarvation
Input checks: Population 1 or less returns -1.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: high.
HasDroughtPrevention
Input checks: Null checks on definitions and plots.
Multiplayer: read-only, reads city/district state only. Risk: low (pure getter). Confidence of the reading: medium.
RemoveFeatureAppealModifier
Arguments: eFeature — feature type whose entry is removed
Writes
- Growth feature appeal modifier array (0x8, count 0x18)
Input checks: No check that the feature was found: if absent, the search pointer is at end and the code still shrinks the list and writes past it.
Multiplayer: may-desync, alters growth modifier data. Risk: medium (missing-entry case corrupts the list). Confidence of the reading: medium.