mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-12 08:49:22 +07:00
#3050 - Added "automated workers don't replace improvements" setting
This commit is contained in:
@ -342,6 +342,7 @@ Move units with a single tap =
|
||||
Show tutorials =
|
||||
Auto-assign city production =
|
||||
Auto-build roads =
|
||||
Automated workers replace improvements =
|
||||
Show minimap =
|
||||
Show pixel units =
|
||||
Show pixel improvements =
|
||||
|
@ -147,13 +147,14 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
val city = tile.getCity()
|
||||
if (city == null || city.civInfo != civInfo)
|
||||
return false
|
||||
if (tile.improvement != null && !UncivGame.Current.settings.automatedWorkersReplaceImprovements)
|
||||
return false
|
||||
|
||||
if (tile.improvement == null) {
|
||||
if (tile.improvementInProgress != null) return true
|
||||
val chosenImprovement = chooseImprovement(tile, civInfo)
|
||||
if (chosenImprovement != null && tile.canBuildImprovement(chosenImprovement, civInfo)) return true
|
||||
}
|
||||
else if(!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo)
|
||||
} else if (!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo)
|
||||
&& tile.getTileResource().improvement != tile.improvement
|
||||
&& tile.canBuildImprovement(chooseImprovement(tile, civInfo)!!, civInfo))
|
||||
return true
|
||||
@ -214,9 +215,6 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
return unit.civInfo.gameInfo.ruleSet.tileImprovements[improvementString] // For mods, the tile improvement may not exist, so don't assume.
|
||||
}
|
||||
private fun isImprovementOnFeatureAllowed(tile: TileInfo, civInfo: CivilizationInfo): Boolean {
|
||||
// Old hardcoded logic amounts to:
|
||||
//return tile.terrainFeature == Constants.forest && tile.getTileResource().improvement == "Camp"
|
||||
|
||||
// routine assumes the caller ensured that terrainFeature and resource are both present
|
||||
val resourceImprovementName = tile.getTileResource().improvement
|
||||
?: return false
|
||||
|
@ -23,6 +23,8 @@ class GameSettings {
|
||||
var showTutorials: Boolean = true
|
||||
var autoAssignCityProduction: Boolean = true
|
||||
var autoBuildingRoads: Boolean = true
|
||||
var automatedWorkersReplaceImprovements = true
|
||||
|
||||
var showMinimap: Boolean = true
|
||||
var showPixelUnits: Boolean = false
|
||||
var showPixelImprovements: Boolean = true
|
||||
|
@ -109,6 +109,7 @@ class WorldScreenOptionsPopup(val worldScreen:WorldScreen) : Popup(worldScreen)
|
||||
}
|
||||
}
|
||||
addYesNoRow ("Auto-build roads", settings.autoBuildingRoads) { settings.autoBuildingRoads = it }
|
||||
addYesNoRow ("Automated workers replace improvements", settings.automatedWorkersReplaceImprovements) { settings.automatedWorkersReplaceImprovements = it }
|
||||
addYesNoRow ("Order trade offers by amount", settings.orderTradeOffersByAmount) { settings.orderTradeOffersByAmount = it }
|
||||
|
||||
addAutosaveTurnsSelectBox()
|
||||
|
Reference in New Issue
Block a user