Linting of unused new function shouldOpenPolicyPicker() (#9969)

This commit is contained in:
SomeTroglodyte 2023-08-24 23:10:40 +02:00 committed by GitHub
parent 53748a40d7
commit 066c698117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -29,7 +29,7 @@ class CityFounder {
city.isOriginalCapital = civInfo.citiesCreated == 0
if (city.isOriginalCapital) {
civInfo.hasEverOwnedOriginalCapital = true
// if you have some culture before the 1st city is found, you may want to adopt the 1st policy
// if you have some culture before the 1st city is founded, you may want to adopt the 1st policy
civInfo.policies.shouldOpenPolicyPicker = true
}
civInfo.citiesCreated++

View File

@ -31,10 +31,11 @@ class PolicyManager : IsPartOfGameInfoSerialization {
internal val adoptedPolicies = HashSet<String>()
var numberOfAdoptedPolicies = 0
/** Indicates whether we shoudl *check* if policy is adoptible, and if so open */
/** Indicates whether we should *check* if policy is adoptible, and if so open */
var shouldOpenPolicyPicker = false
fun shouldOpenPolicyPicker() = shouldOpenPolicyPicker && canAdoptPolicy()
/** Used by NextTurnAction.PickPolicy.isChoice */
fun shouldShowPolicyPicker() = (shouldOpenPolicyPicker || freePolicies > 0) && canAdoptPolicy()
/** A [Map] pairing each [PolicyBranch] to its priority ([Int]). */
val priorityMap: Map<PolicyBranch, Int>

View File

@ -54,9 +54,7 @@ enum class NextTurnAction(protected val text: String, val color: Color) {
},
PickPolicy("Pick a policy", Color.VIOLET) {
override fun isChoice(worldScreen: WorldScreen) =
(worldScreen.viewingCiv.policies.shouldOpenPolicyPicker ||
worldScreen.viewingCiv.policies.freePolicies > 0)
&& worldScreen.viewingCiv.policies.canAdoptPolicy()
worldScreen.viewingCiv.policies.shouldShowPolicyPicker()
override fun action(worldScreen: WorldScreen) {
worldScreen.game.pushScreen(PolicyPickerScreen(worldScreen.selectedCiv, worldScreen.canChangeState))
worldScreen.viewingCiv.policies.shouldOpenPolicyPicker = false