Resolved #446 - Buildings are now created when production is completed by Great Engineers, so production of the current turn can be added to the next construction

This commit is contained in:
Yair Morgenstern 2019-02-05 20:04:07 +02:00
parent 36ad17db99
commit 6856301504
2 changed files with 9 additions and 9 deletions

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 199
versionName "2.13.0"
versionCode 200
versionName "2.13.1"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View file

@ -2,7 +2,6 @@ package com.unciv.logic.city
import com.badlogic.gdx.graphics.Color
import com.unciv.logic.automation.Automation
import com.unciv.logic.civilization.PlayerType
import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tr
@ -124,10 +123,16 @@ class CityConstructions {
fun addProduction(productionToAdd: Int) {
if (!inProgressConstructions.containsKey(currentConstruction)) inProgressConstructions[currentConstruction] = 0
inProgressConstructions[currentConstruction] = inProgressConstructions[currentConstruction]!! + productionToAdd
val construction = getConstruction(currentConstruction)
val productionCost = construction.getProductionCost(cityInfo.civInfo.policies.adoptedPolicies)
if (inProgressConstructions[currentConstruction]!! >= productionCost) {
constructionComplete(construction)
}
}
fun nextTurn(cityStats: Stats) {
var construction = getConstruction(currentConstruction)
val construction = getConstruction(currentConstruction)
if(construction is SpecialConstruction) return
// Let's try to remove the building from the city, and see if we can still build it (we need to remove because of wonders etc.)
@ -137,15 +142,10 @@ class CityConstructions {
// We can't build this building anymore! (Wonder has been built / resource is gone / etc.)
cityInfo.civInfo.addNotification("[${cityInfo.name}] Cannot continue work on [$saveCurrentConstruction]", cityInfo.location, Color.BROWN)
Automation().chooseNextConstruction(this)
construction = getConstruction(currentConstruction)
} else
currentConstruction = saveCurrentConstruction
addProduction(Math.round(cityStats.production))
val productionCost = construction.getProductionCost(cityInfo.civInfo.policies.adoptedPolicies)
if (inProgressConstructions[currentConstruction]!! >= productionCost) {
constructionComplete(construction)
}
}
fun constructionComplete(construction: IConstruction) {