Fix a bug that causes exception when selecting special construction.

This commit is contained in:
Duan Tao
2019-09-25 12:22:37 +08:00
committed by Yair Morgenstern
parent 56f4d2d57b
commit e511385d12

View File

@ -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)