mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 13:27:22 -04:00
Can now play an entire scenario with no improvements or techs defined
This commit is contained in:
parent
7382d4f8e8
commit
5084bb6f9e
@ -283,6 +283,8 @@ class CivilizationInfo {
|
||||
}
|
||||
|
||||
fun getEra(): String {
|
||||
// For scenarios with no techs
|
||||
if (gameInfo.ruleSet.technologies.isEmpty()) return "None"
|
||||
if(tech.researchedTechnologies.isEmpty())
|
||||
return gameInfo.ruleSet.getEras().first()
|
||||
val maxEraOfTech = tech.researchedTechnologies
|
||||
|
@ -124,6 +124,7 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick
|
||||
}
|
||||
|
||||
private fun Table.addEraSelectBox() {
|
||||
if (ruleset.technologies.isEmpty()) return // scenario with no techs
|
||||
val eras = ruleset.technologies.values.map { it.era() }.distinct()
|
||||
addSelectBox("{Starting Era}:", eras, gameParameters.startingEra)
|
||||
{ gameParameters.startingEra = it }
|
||||
|
@ -27,14 +27,15 @@ class UnitContextMenu(val tileMapHolder: WorldMapHolder, val selectedUnit: MapUn
|
||||
onMoveButtonClick()
|
||||
}
|
||||
|
||||
addButton(
|
||||
ImageGetter.getImprovementIcon("Road"),
|
||||
"Construct road",
|
||||
BuildLongRoadAction(selectedUnit, targetTile)
|
||||
)
|
||||
// Basic scenarios sommetimes don't have roads
|
||||
if (selectedUnit.civInfo.gameInfo.ruleSet.tileImprovements.containsKey("Road"))
|
||||
addButton(
|
||||
ImageGetter.getImprovementIcon("Road"),
|
||||
"Construct road",
|
||||
BuildLongRoadAction(selectedUnit, targetTile)
|
||||
)
|
||||
|
||||
pack()
|
||||
|
||||
}
|
||||
|
||||
fun addButton(icon: Actor, label: String, action: MapUnitAction) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user