When unable to support units, they disband one by one instead of all at the same time

This commit is contained in:
Yair Morgenstern
2018-07-15 19:51:27 +03:00
parent 68781ed5f7
commit da3d749547
2 changed files with 4 additions and 5 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 99
versionName "2.6.2"
versionCode 101
versionName "2.6.3.1"
}
buildTypes {
release {

View File

@ -190,11 +190,10 @@ class CivilizationInfo {
policies.endTurn(nextTurnStats.culture.toInt())
if(!isBarbarianCivilization() && gold < -100){
// disband units until there are none left OR the gold values are normal
val unitUpkeepBeforeDisbands = getUnitUpkeep()
if(!isBarbarianCivilization() && gold < -100){
var civMilitaryUnits = getCivUnits().filter { it.getBaseUnit().unitType!=UnitType.Civilian }
while(nextTurnStats.gold.toInt() - unitUpkeepBeforeDisbands + getUnitUpkeep() < 0
if(nextTurnStats.gold.toInt() < 0
&& civMilitaryUnits.isNotEmpty()){
val unitToDisband = civMilitaryUnits.first()
unitToDisband.removeFromTile()