mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 23:10:39 -04:00
Resolved #782 - Wonders are no longer built twice under "race conditions"
This commit is contained in:
parent
95a3a65c34
commit
a54f68528f
@ -21,7 +21,7 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 243
|
versionCode 244
|
||||||
versionName "2.16.7"
|
versionName "2.16.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +143,8 @@ class CityConstructions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun constructIfEnough(){
|
fun constructIfEnough(){
|
||||||
|
stopUnbuildableConstruction()
|
||||||
|
|
||||||
val construction = getConstruction(currentConstruction)
|
val construction = getConstruction(currentConstruction)
|
||||||
if(construction is SpecialConstruction) return
|
if(construction is SpecialConstruction) return
|
||||||
|
|
||||||
@ -154,10 +156,16 @@ class CityConstructions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun endTurn(cityStats: Stats) {
|
fun endTurn(cityStats: Stats) {
|
||||||
val construction = getConstruction(currentConstruction)
|
stopUnbuildableConstruction()
|
||||||
if(construction is SpecialConstruction) return
|
|
||||||
|
|
||||||
|
if(getConstruction(currentConstruction) !is SpecialConstruction)
|
||||||
|
addProductionPoints(Math.round(cityStats.production))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun stopUnbuildableConstruction() {
|
||||||
// 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.)
|
// 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.)
|
||||||
|
val construction = getConstruction(currentConstruction)
|
||||||
|
|
||||||
val saveCurrentConstruction = currentConstruction
|
val saveCurrentConstruction = currentConstruction
|
||||||
currentConstruction = ""
|
currentConstruction = ""
|
||||||
if (!construction.isBuildable(this)) {
|
if (!construction.isBuildable(this)) {
|
||||||
@ -166,8 +174,6 @@ class CityConstructions {
|
|||||||
chooseNextConstruction()
|
chooseNextConstruction()
|
||||||
} else
|
} else
|
||||||
currentConstruction = saveCurrentConstruction
|
currentConstruction = saveCurrentConstruction
|
||||||
|
|
||||||
addProductionPoints(Math.round(cityStats.production))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun constructionComplete(construction: IConstruction) {
|
fun constructionComplete(construction: IConstruction) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user