mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Fixed errors when cloning civ that should open policy picker
We should not be using get() functions for serializable fields that we want to clone!
This commit is contained in:
parent
5bcfcb3e8c
commit
2028c0569b
@ -30,8 +30,11 @@ class PolicyManager : IsPartOfGameInfoSerialization {
|
||||
var storedCulture = 0
|
||||
internal val adoptedPolicies = HashSet<String>()
|
||||
var numberOfAdoptedPolicies = 0
|
||||
|
||||
/** Indicates whether we shoudl *check* if policy is adoptible, and if so open */
|
||||
var shouldOpenPolicyPicker = false
|
||||
get() = field && canAdoptPolicy()
|
||||
|
||||
fun shouldOpenPolicyPicker() = shouldOpenPolicyPicker && canAdoptPolicy()
|
||||
|
||||
/** A [Map] pairing each [PolicyBranch] to its priority ([Int]). */
|
||||
val priorityMap: Map<PolicyBranch, Int>
|
||||
|
@ -54,8 +54,9 @@ 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.shouldOpenPolicyPicker ||
|
||||
worldScreen.viewingCiv.policies.freePolicies > 0)
|
||||
&& worldScreen.viewingCiv.policies.canAdoptPolicy()
|
||||
override fun action(worldScreen: WorldScreen) {
|
||||
worldScreen.game.pushScreen(PolicyPickerScreen(worldScreen.selectedCiv, worldScreen.canChangeState))
|
||||
worldScreen.viewingCiv.policies.shouldOpenPolicyPicker = false
|
||||
|
Loading…
Reference in New Issue
Block a user