From e511385d12a86858b2f179191dabf729fad6b62f Mon Sep 17 00:00:00 2001 From: Duan Tao Date: Wed, 25 Sep 2019 12:22:37 +0800 Subject: [PATCH] Fix a bug that causes exception when selecting special construction. --- core/src/com/unciv/logic/city/CityConstructions.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index e10d33d006..1010e4aead 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -115,8 +115,11 @@ class CityConstructions { else return 0 } - fun getRemainingWork(constructionName: String) = - getConstruction(constructionName).getProductionCost(cityInfo.civInfo) - getWorkDone(constructionName) + fun getRemainingWork(constructionName: String): Int { + val constr = getConstruction(constructionName) + if (constr is SpecialConstruction) return 0 + return constr.getProductionCost(cityInfo.civInfo) - getWorkDone(constructionName) + } fun turnsToConstruction(constructionName: String): Int { val workLeft = getRemainingWork(constructionName)