Can now adopt policies in Scenario Editor mode by double-clicking

This commit is contained in:
Yair Morgenstern 2020-08-13 18:11:21 +03:00
parent 88d72f0f39
commit 25b434cb29
3 changed files with 11 additions and 4 deletions

View file

@ -109,7 +109,7 @@ class PolicyManager {
fun adopt(policy: Policy, branchCompletion: Boolean = false) {
if (!branchCompletion) {
if (!branchCompletion && !civInfo.gameInfo.gameParameters.godMode) {
if (freePolicies > 0) freePolicies--
else {
val cultureNeededForNextPolicy = getCultureNeededForNextPolicy()

View file

@ -71,9 +71,10 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
if (savedGame.toLowerCase().endsWith("scenario"))
scenarioSelectBox.items.add(savedGame)
}
scenarioSelectBox.onChange { selectSavedGameAsScenario(scenarioSelectBox.selected) }
scenarioSelectBox.items = scenarioSelectBox.items // it doesn't register them until you do this.
scenarioSelectBox.selected = scenarioMapSelectBox.items.first()
// needs to be after the item change, so it doesn't activate before we choose the Scenario maptype
scenarioSelectBox.onChange { selectSavedGameAsScenario(scenarioSelectBox.selected) }
scenarioOptionsTable.add("{Scenario file}:".toLabel()).left()
scenarioOptionsTable.add(scenarioSelectBox)
@ -83,6 +84,7 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
mapParameters.type = MapType.custom
mapParameters.name = mapFileSelectBox.selected
mapTypeSpecificTable.add(savedMapOptionsTable)
newGameScreen.gameSetupInfo.gameParameters.godMode = false
newGameScreen.unlockTables()
newGameScreen.updateTables()
} else if (mapTypeSelectBox.selected.value == MapType.scenarioMap) {
@ -103,6 +105,7 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
} else { // generated map
mapParameters.name = ""
mapParameters.type = generatedMapOptionsTable.mapTypeSelectBox.selected.value
newGameScreen.gameSetupInfo.gameParameters.godMode = false
mapTypeSpecificTable.add(generatedMapOptionsTable)
newGameScreen.unlockTables()
newGameScreen.updateTables()

View file

@ -42,11 +42,10 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
}
else game.setScreen(PolicyPickerScreen(worldScreen)) // update policies
}
if(!UncivGame.Current.worldScreen.canChangeState)
rightSideButton.disable()
topTable.row().pad(30f)
for (branch in viewingCiv.gameInfo.ruleSet.policyBranches.values) {
@ -92,6 +91,11 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
} else {
rightSideButton.enable()
}
if (viewingCiv.gameInfo.gameParameters.godMode && pickedPolicy == policy
&& viewingCiv.policies.isAdoptable(policy)) {
viewingCiv.policies.adopt(policy)
game.setScreen(PolicyPickerScreen(worldScreen))
}
pickedPolicy = policy
val policyText = mutableListOf<String>()
policyText += policy.name