Home › Dev CE (experimental) › CityBuildQueue
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.
CityBuildQueue
37 methods (Dev CE test build). this is found with the game's own ICityBuildQueue instance resolver (plain).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| AddDistrictBuildingModifier |
CityBuildQueue:AddDistrictBuildingModifier(eDistrictType: integer, iModifier: integer) |
Appends a (district, modifier) pair to the build queue's district building modifier list. |
plumbing ✓ |
— |
0xf5030 |
| ChangeProductionModifier |
CityBuildQueue:ChangeProductionModifier(eBuilding: integer, iDelta: integer) |
Adds a percent delta to the production modifier for a project (the entry shares this signature with building and district overloads that fold to the same code). Stored as 24.8 fixed point. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
City::BuildQueue::ChangeProductionModifier |
0x949730 |
| DoBuilds |
CityBuildQueue:DoBuilds() |
Per-turn production processing: calculates yields for the current production, resets a city yield array and related field, and adds progress. The decompilation is truncated, so the rest is not visible. |
plumbing ✓ |
— |
0xfc330 |
| DoTurnActivate |
CityBuildQueue:DoTurnActivate() |
Adds the pending value at 0x1f8 to the value at 0x1f4, clears the pending value and runs DoBuilds. |
plumbing ✓ |
— |
0xfc690 |
| GetAdjacentCityRiverBuildingProductionMultiplierCalclulated |
CityBuildQueue:GetAdjacentCityRiverBuildingProductionMultiplierCalclulated(eBuilding: integer) → number |
Returns a production multiplier for a building if a stored plot is adjacent to the city and a river edge lies in that direction; otherwise 1.0 (0x100). |
plumbing ✓ |
— |
0xfc770 |
| GetBestFormationFor |
CityBuildQueue:GetBestFormationFor(eUnit: integer) → number |
Returns the best military formation the city can train for a unit: 2 (corps/army tier) if trainable, else 1 if trainable at tier 1, else 0. |
plumbing ✓ |
— |
0xfc970 |
| GetCurrentBuildProgress |
CityBuildQueue:GetCurrentBuildProgress() → number |
Returns accumulated progress of the current production item, choosing the progress array by item kind (unit, building, district, project). |
plumbing ✓ |
— |
0xfcf90 |
| GetCurrentProductionBuilding |
CityBuildQueue:GetCurrentProductionBuilding() → number |
Returns the building type currently in production, or -1 if the current item is not a building. |
plumbing ✓ |
— |
0xfd080 |
| GetCurrentProductionDistrict |
CityBuildQueue:GetCurrentProductionDistrict() → number |
Returns the district type currently in production, or -1 if the current item is not a district. |
plumbing ✓ |
— |
0xfd0b0 |
| GetCurrentProductionTypeModifier |
CityBuildQueue:GetCurrentProductionTypeModifier() → number |
Returns the type modifier hash stored on the current item when the item kind is 0 (unit), else -1. |
plumbing ✓ |
— |
0xfd340 |
| GetCurrentProductionUnit |
CityBuildQueue:GetCurrentProductionUnit() → number |
Returns the unit type currently in production, or -1 if the current item is not a unit. |
plumbing ✓ |
— |
0xfd370 |
| GetDistrictProductionCost |
CityBuildQueue:GetDistrictProductionCost(eDistrict: integer, eFeatureToRemove: integer, eResourceToHarvest: integer) → number |
Returns the production cost of a district for this city, from the existing district if it has a positive cost, else from the player's district cost; adds half a builder's cost if removing a feature with no yield list. |
plumbing ✓ |
— |
0xfd470 |
| GetDistrictZonedAtLocation |
CityBuildQueue:GetDistrictZonedAtLocation(iPlotIndex: integer) → number |
Returns the district type that has been zoned at a given plot index in this city's queue, or -1 if none. |
plumbing ✓ |
— |
0xfd5a0 |
| GetExtraUnitCopy |
CityBuildQueue:GetExtraUnitCopy(eUnit: integer) → number |
Returns how many extra copies of a unit the queue grants: the queue's own per-unit counter plus the owning player's per-unit counter. |
plumbing ✓ |
— |
0xfd750 |
| GetProductionYield |
CityBuildQueue:GetProductionYield() → number |
Returns the owning city's production yield by forwarding to City::Instance::GetYield; the yield type argument is not set in the decompilation (taken from a leftover register), so the shown code may be incomplete. |
plumbing ✓ |
— |
0xfdb10 |
| GetProjectProductionCost |
CityBuildQueue:GetProjectProductionCost(eProject: integer) → number |
Computes the production cost of a project for this city's owner: uses defense-damage based cost for flagged projects, else base cost with cost-progression escalation (tech/civic percent or cost group), then game speed adjustment. |
plumbing ✓ |
— |
0xfdca0 |
| GetProjectProductionMultiplier |
CityBuildQueue:GetProjectProductionMultiplier(eProject: integer) → number |
Returns a FixedPoint production multiplier for a project: base value from a per-index array, scaled by a government-linked array entry when the project's hero class and government are found. The decompilation reads params from registers and is partly garbled. |
plumbing ✓ |
— |
0xfde60 |
| GetTotalDistrictBuildingModifier |
CityBuildQueue:GetTotalDistrictBuildingModifier(eDistrictType: integer) → number |
Sums all stored modifier values for the given district type from the queue's (district, value) list and returns the total as FixedPoint (values scaled by 1/256-style float conversion). |
plumbing ✓ |
— |
0xfe1e0 |
| GetUnitArmyProductionCost |
CityBuildQueue:GetUnitArmyProductionCost(eUnit: integer) → number |
Computes army-formation production cost of a unit: 3x base unit cost minus a per-unit discount fraction from the queue. |
plumbing ✓ |
— |
0xfea70 |
| GetUnitCorpsProductionCost |
CityBuildQueue:GetUnitCorpsProductionCost(eUnit: integer) → number |
Computes corps-formation production cost of a unit: 2x base unit cost minus a per-unit discount fraction from the queue. |
plumbing ✓ |
— |
0xfeaf0 |
| GetUnitProductionCost |
CityBuildQueue:GetUnitProductionCost(eUnit: integer, eMilitaryFormation: integer) → number |
Returns the production cost of a unit in standard, corps or army formation, with an optional percent reduction from the player (for non-naval-class formation types when the player's yield type is production and a reduction is set). |
plumbing ✓ |
— |
0xfeb80 |
| GetUnitResourceCost |
CityBuildQueue:GetUnitResourceCost(eUnit: integer, eMilitaryFormation: integer) → number |
Returns the strategic resource cost of building a unit in a formation, with corps/army discount, a city-level reduction percentage and a minimum of 1; 0 if the unit has no resource requirement. |
plumbing ✓ |
— |
0xfec80 |
| GetValidFeatureForDistrict |
CityBuildQueue:GetValidFeatureForDistrict(eValidDistrict: integer, eValidFeature: integer) → boolean |
Searches the queue's modifier-granted list of (district, feature) pairs for a match. |
plumbing ✓ |
— |
0xff430 |
| GetValidFeatureForWonder |
CityBuildQueue:GetValidFeatureForWonder(eFeature: integer) → boolean |
Looks up a per-feature flag array to see if wonders may be built on that feature. |
plumbing ✓ |
— |
0xff470 |
| GetZoningPlot |
CityBuildQueue:GetZoningPlot(eDistrict: integer) → number |
Returns the plot index recorded as the zoning (planned district) plot for a district type. |
plumbing ✓ |
— |
0xff490 |
| IsConstructionPlotRiver |
CityBuildQueue:IsConstructionPlotRiver(eBuilding: integer) → boolean |
Checks whether the plot where a building is being constructed has a river (flag byte at plot+0x37 > 0). |
plumbing ✓ |
— |
0xff870 |
| IsConstructionPlotValidAdjacentNaturalWonder |
CityBuildQueue:IsConstructionPlotValidAdjacentNaturalWonder(eBuilding: integer) → number |
Iterates neighbors of the building's construction plot with a lambda that checks the queue's building list against adjacent natural wonders; returns a FixedPoint that defaults to 1.0 (0x100). The lambda body is not visible, so the exact result semantics are unclear. |
plumbing ✓ |
— |
0xff8e0 |
| IsValidDomainForUnit |
CityBuildQueue:IsValidDomainForUnit(eUnit: integer) → boolean |
Checks whether the city can build a unit by domain; only sea units (DOMAIN_SEA) are further tested via City::Instance::CanBuildUnitsOfDomain. |
plumbing ✓ |
— |
0xff9f0 |
| IsZoningPlotRiver |
CityBuildQueue:IsZoningPlotRiver(eDistrict: integer) → boolean |
Checks whether the zoning plot of a district has a river (plot flag byte +0x37 > 0). |
plumbing ✓ |
— |
0xffa70 |
| IsZoningPlotValidAdjacentNaturalWonder |
CityBuildQueue:IsZoningPlotValidAdjacentNaturalWonder(eDistrict: integer) → number |
Iterates neighbors of a district's zoning plot with a lambda against the queue's building list; returns a FixedPoint defaulting to 1.0 (0x100). Lambda body not visible so exact semantics unclear. |
plumbing ✓ |
— |
0xffae0 |
| RemoveAll |
CityBuildQueue:RemoveAll() |
Removes every entry from the city's build queue: calls OnRemoveFrontEntry, clears the node vector, and sends a queue-changed event. |
plumbing ✓ |
— |
0x103450 |
| RemoveAllIncompleteBuildings |
CityBuildQueue:RemoveAllIncompleteBuildings() |
Iterates all building definitions and calls JustRemoveBuilding for each to drop incomplete buildings from the queue (protected method). |
plumbing ✓ |
— |
0x1034d0 |
| RemoveDistrictBuildingModifier |
CityBuildQueue:RemoveDistrictBuildingModifier(eDistrictType: integer, iModifier: integer) |
Removes the first (district, value) pair matching both arguments from the queue's district-building-modifier list, shifting later entries down. |
plumbing ✓ |
— |
0x103670 |
| RemoveDistrictDependentBuildings |
CityBuildQueue:RemoveDistrictDependentBuildings(eDistrict: integer) |
Iterates building definitions and removes from the queue each building whose prerequisite district equals the given one (protected). |
plumbing ✓ |
— |
0x1037b0 |
| RemoveModifierValidFeatureDistricts |
CityBuildQueue:RemoveModifierValidFeatureDistricts(eNewDistrict: integer, eNewFeature: integer) |
Removes all (district, feature) pairs matching the arguments from the modifier-granted valid feature-district list, shrinking its count. |
plumbing ✓ |
— |
0x1039c0 |
| SetDistrictPercentComplete |
CityBuildQueue:SetDistrictPercentComplete(eDistrict: integer, iPercent: integer) |
Sets a district's construction progress to a given percent of its cost, using the existing district's cost or the player's computed cost. |
plumbing ✓ |
City::BuildQueue::SetDistrictPercentComplete |
0x1046f0 |
| SetModifierValidFeatureDistricts |
CityBuildQueue:SetModifierValidFeatureDistricts(eNewDistrict: integer, eNewFeature: integer) |
Appends a (district, feature) pair to the modifier-granted valid feature-district list, growing the vector when full. |
plumbing ✓ |
— |
0x1047b0 |
Details
AddDistrictBuildingModifier
Arguments: eDistrictType — district type the modifier applies to; iModifier — modifier value
Writes
- district building modifier list (0x3b8..0x3c8)
Input checks: no validation; duplicates are appended
Multiplayer: may-desync, modifies synchronised city state. Risk: medium (modifies synchronised city state). Confidence of the reading: medium.
ChangeProductionModifier
Arguments: iDelta — percent change
Writes
- per-item modifier int array at this+0x2f0 (indexed by type)
Side effects
- none
Input checks: returns silently for type -1; no bounds check on index otherwise
Preconditions
- valid index into the modifier array
Multiplayer: safe-deterministic. Risk: medium (unchecked array index). Confidence of the reading: medium.
Verified from the code
- Linux debug info lists three overloads (building, district, project) sharing this address
- scales delta by a constant and stores fixed point added to array element at +0x2f0 + 4*index
Inferred
- same code used for all three overloads due to identical code folding
- constant is probably 0.01
Open questions
- whether a given overload uses a separate array in the real build (folded here)
DoBuilds
Writes
- city yield array (city offset 0x6e0)
- city field at 2000 set to -1
- build progress via AddProgress (not visible)
Side effects
- calls CalculateYield and AddProgress
Input checks: unknown due to truncated decompilation
Multiplayer: may-desync, adds production progress. Risk: high (advances production in synchronised state). Confidence of the reading: low.
DoTurnActivate
Writes
- accumulated value (0x1f4)
- pending value (0x1f8)
Side effects
- calls DoBuilds
Input checks: none
Multiplayer: may-desync, modifies synchronised city state. Risk: high (modifies synchronised city state). Confidence of the reading: medium.
GetAdjacentCityRiverBuildingProductionMultiplierCalclulated
Arguments: eBuilding — building type used to look up a plot in a per-building array (inferred)
Input checks: returns 1.0 when stored multiplier <= 1.0, plot missing or not adjacent
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: medium.
GetBestFormationFor
Arguments: eUnit — unit type to test
Input checks: delegates to CanTrain; no extra checks
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetCurrentBuildProgress
Input checks: returns 0 if queue is empty or kind is unknown
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetCurrentProductionBuilding
Input checks: returns -1 if the queue is empty or kind is not building
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetCurrentProductionDistrict
Input checks: returns -1 if queue empty or kind is not district
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetCurrentProductionTypeModifier
Input checks: returns -1 if queue empty or kind is not 0
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: medium.
GetCurrentProductionUnit
Input checks: returns -1 if queue empty or kind is not unit
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetDistrictProductionCost
Arguments: eDistrict — district type; eFeatureToRemove — feature removed during construction; eResourceToHarvest — resource harvested (not used in the shown code) (inferred)
Input checks: checks district index range; -1 feature skipped
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: medium.
GetDistrictZonedAtLocation
Arguments: iPlotIndex — plot index to look up
Input checks: no range check on plot index; bounded by district definitions
Multiplayer: read-only, pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetExtraUnitCopy
Arguments: eUnit — unit type index
Input checks: Returns 0 if eUnit is >= the queue's array size; player array bounds-checked, no null check on player.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetProductionYield
Input checks: None visible.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: medium.
GetProjectProductionCost
Arguments: eProject — project type index
Input checks: Returns -1 if eProject is out of range or has no definition; no player null check.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetProjectProductionMultiplier
Arguments: eProject — project type index (inferred)
Input checks: Null-checks hero class, government and its sub-pointer; index not range-checked in visible code.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: low.
GetTotalDistrictBuildingModifier
Arguments: eDistrictType — district type index to match
Input checks: No validation; unmatched district gives 0.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: medium.
GetUnitArmyProductionCost
Arguments: eUnit — unit type (resolved via Types::GetIndex)
Input checks: Returns -1 if Types::GetIndex returns invalid.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetUnitCorpsProductionCost
Arguments: eUnit — unit type (resolved via Types::GetIndex)
Input checks: Returns -1 if Types::GetIndex returns invalid.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetUnitProductionCost
Arguments: eUnit — unit type index; eMilitaryFormation — formation: <=0 standard, 1 corps, 2 army
Input checks: Checks unit definition exists and formation >= -1; formation > 2 returns 0.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetUnitResourceCost
Arguments: eUnit — unit type index; eMilitaryFormation — formation type (1-2 apply discount)
Input checks: Returns 0 if unit definition missing or no resource requirement.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetValidFeatureForDistrict
Arguments: eValidDistrict — district type; eValidFeature — feature type
Input checks: No validation; linear search of list.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetValidFeatureForWonder
Arguments: eFeature — feature type index
Input checks: Out-of-range feature returns false.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
GetZoningPlot
Arguments: eDistrict — district type index
Input checks: Out-of-range returns -1.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
IsConstructionPlotRiver
Arguments: eBuilding — building type index
Input checks: Out-of-range returns false; null plot returns false.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
IsConstructionPlotValidAdjacentNaturalWonder
Arguments: eBuilding — building type index
Input checks: Range check on building; null map and plot handled.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: low.
IsValidDomainForUnit
Arguments: eUnit — unit type index
Input checks: False for out-of-range/missing definition.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
IsZoningPlotRiver
Arguments: eDistrict — district type index
Input checks: Out-of-range returns false; null plot returns false.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.
IsZoningPlotValidAdjacentNaturalWonder
Arguments: eDistrict — district type index
Input checks: Range check on district; null map/plot handled.
Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: low.
RemoveAll
Writes
- build queue entries (cleared)
- front entry state via OnRemoveFrontEntry
Side effects
- Reporting::Event::Send with city id (event hash 0x92492f56)
Input checks: Does nothing if the queue is already empty; no other checks.
Multiplayer: may-desync: clears queue of synchronised city state. Risk: high (wipes city production queue). Confidence of the reading: high.
RemoveAllIncompleteBuildings
Writes
- build queue / incomplete building progress (via JustRemoveBuilding)
Input checks: No checks; relies on JustRemoveBuilding.
Multiplayer: may-desync: edits city build state. Risk: medium (bulk removal of queued buildings). Confidence of the reading: medium.
RemoveDistrictBuildingModifier
Arguments: eDistrictType — district type to match; iModifier — modifier value to match
Writes
- district building modifier list at +0x3b8 (one entry removed)
Input checks: No range checks; no-op if no exact pair matches.
Multiplayer: may-desync: alters production modifier state. Risk: medium (modifies city production modifiers). Confidence of the reading: high.
RemoveDistrictDependentBuildings
Arguments: eDistrict — district type whose dependent buildings are removed
Writes
- build queue entries for buildings requiring that district
Input checks: No checks; skips buildings without a district requirement.
Multiplayer: may-desync: edits city build queue. Risk: medium (removes queued items). Confidence of the reading: high.
RemoveModifierValidFeatureDistricts
Arguments: eNewDistrict — district type to match; eNewFeature — feature type to match
Writes
- valid feature-district list at +0x378 and count at +0x388
Input checks: No validation; no-op if no match.
Multiplayer: may-desync: alters placement rules in synchronised city state. Risk: medium (edits placement-validity data). Confidence of the reading: high.
SetDistrictPercentComplete
Arguments: eDistrict — district type; iPercent — percent of cost completed
Writes
- district progress array at this+0x248 (value = cost*percent/100 in 24.8 fixed point)
Side effects
- none
Input checks: silently ignores district ids outside definitions or with null definition; percent not clamped
Preconditions
- owning city set at this+0x1e8
Multiplayer: safe-deterministic. Risk: low (guarded; only sets progress). Confidence of the reading: high.
Verified from the code
- range and null check on definition
- uses existing district's stored cost if the district exists else Player::Districts::GetCost
- stores ((cost*percent)/100)<<8
Inferred
- array at +0x248 is district production progress
Open questions
- whether percent above 100 is handled elsewhere
SetModifierValidFeatureDistricts
Arguments: eNewDistrict — district type; eNewFeature — feature type
Writes
- valid feature-district list at +0x378, count at +0x388 (capacity at +0x380)
Input checks: No duplicate or range checks.
Multiplayer: may-desync: alters placement rules in synchronised city state. Risk: medium (edits placement-validity data). Confidence of the reading: high.