fix market capacity

This commit is contained in:
2026-04-28 22:17:36 +03:00
parent 1717de8373
commit 0ef0bef036
3 changed files with 15 additions and 2 deletions

View File

@@ -75,6 +75,7 @@ function gatherState() {
// ---- Market / Trade capacity -----------------------------------------
let marketCapacity = 0;
let availableTradeCapacity = 0;
try {
const marketLevel = buildings.market ?? 0;
const gd = uw.GameData?.buildingData?.market;
@@ -82,6 +83,7 @@ function gatherState() {
if (buildings.trade_office && buildings.trade_office > 0) {
marketCapacity += (uw.GameData?.buildingData?.trade_office?.capacity_extra_per_level || 500) * marketLevel;
}
availableTradeCapacity = town.getAvailableTradeCapacity?.() ?? marketCapacity;
} catch (e) { log(`market capacity lookup failed: ${e}`); }
// ---- Coordinates & sea zone -----------------------------------------
@@ -176,6 +178,7 @@ function gatherState() {
iron: res.iron,
storage: storageCapacity,
market_capacity: marketCapacity,
available_trade_capacity: availableTradeCapacity,
population: res.population,
points: town.getPoints?.() ?? 0,
god: town.god?.() ?? null,