mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-19 20:28:56 +07:00
Continuation of d2541e6
, to better fit coding standards (everything worked fine)
I reallly like the way you did this, so I'm making it enabled by default =D
This commit is contained in:
@ -5,7 +5,7 @@ import com.unciv.logic.GameSaver
|
||||
class GameSettings {
|
||||
var showWorkedTiles: Boolean = false
|
||||
var showResourcesAndImprovements: Boolean = true
|
||||
var checkForDueUnits: Boolean = false
|
||||
var checkForDueUnits: Boolean = true
|
||||
var language: String = "English"
|
||||
var resolution: String = "1050x700"
|
||||
var tutorialsShown = ArrayList<String>()
|
||||
|
@ -300,14 +300,12 @@ class CivilizationInfo {
|
||||
units=newList
|
||||
}
|
||||
|
||||
fun getDueUnits() = getCivUnits().filter { it.due }
|
||||
|
||||
fun hasDueUnits() = getDueUnits().isNotEmpty()
|
||||
fun getDueUnits() = getCivUnits().filter { it.due && it.isIdle() }
|
||||
|
||||
fun shouldOpenTechPicker() = tech.freeTechs != 0
|
||||
|| tech.currentTechnology()==null && cities.isNotEmpty()
|
||||
|
||||
fun shouldGoToDueUnit() = UnCivGame.Current.settings.checkForDueUnits && hasDueUnits()
|
||||
fun shouldGoToDueUnit() = UnCivGame.Current.settings.checkForDueUnits && getDueUnits().isNotEmpty()
|
||||
|
||||
fun getNextDueUnit(selectedUnit: MapUnit?): MapUnit? {
|
||||
val dueUnits = getDueUnits()
|
||||
|
@ -36,7 +36,6 @@ class MapUnit {
|
||||
var attacksThisTurn = 0
|
||||
var promotions = UnitPromotions()
|
||||
var due: Boolean = true
|
||||
get() = field && isIdle()
|
||||
|
||||
//region pure functions
|
||||
fun clone(): MapUnit {
|
||||
|
@ -228,8 +228,9 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
// cycle through units not yet done
|
||||
if (currentPlayerCiv.shouldGoToDueUnit()) {
|
||||
currentPlayerCiv.getNextDueUnit(bottomBar.unitTable.selectedUnit)?.let {
|
||||
tileMapHolder.setCenterPosition(it.currentTile.position)
|
||||
val nextDueUnit = currentPlayerCiv.getNextDueUnit(bottomBar.unitTable.selectedUnit)
|
||||
if(nextDueUnit!=null) {
|
||||
tileMapHolder.setCenterPosition(nextDueUnit.currentTile.position)
|
||||
shouldUpdate=true
|
||||
return@onClick
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class WorldScreenOptionsTable(screen:WorldScreen) : PopupTable(screen){
|
||||
else addButton("Show") { settings.showResourcesAndImprovements = true; update() }
|
||||
|
||||
add("Check for idle units".toLabel())
|
||||
addButton(if(settings.checkForDueUnits) "Yes" else "No") {
|
||||
addButton(if(settings.checkForDueUnits) "Yes".tr() else "No".tr()) {
|
||||
settings.checkForDueUnits = !settings.checkForDueUnits
|
||||
update()
|
||||
}
|
||||
|
Reference in New Issue
Block a user