mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-01 10:25:57 +07:00
Fix policy counting in global politics (#8045)
Counting of social policies was only correct for completed branches: 6 Incompleted branches with only 1 SP were hidden, and those with N>1 SP displayed N-1.
This commit is contained in:
parent
f3ce1c4dc5
commit
002dcd763b
@ -75,7 +75,7 @@ class PolicyManager : IsPartOfGameInfoSerialization {
|
||||
}
|
||||
|
||||
/** A [Set] of all [PolicyBranch]es. */
|
||||
private val branches: Set<PolicyBranch>
|
||||
val branches: Set<PolicyBranch>
|
||||
get() = civInfo.gameInfo.ruleSet.policyBranches.values.toSet()
|
||||
|
||||
fun clone(): PolicyManager {
|
||||
|
@ -15,6 +15,7 @@ import com.unciv.logic.civilization.WonderInfo
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
|
||||
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
|
||||
import com.unciv.models.ruleset.Policy.PolicyBranchType
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.trade.DiplomacyScreen
|
||||
import com.unciv.ui.utils.AutoScrollPane
|
||||
@ -133,10 +134,14 @@ class GlobalPoliticsOverviewTable (
|
||||
|
||||
private fun getPoliciesTable(civ: CivilizationInfo): Table {
|
||||
val policiesTable = Table(skin)
|
||||
for (policy in civ.policies.branchCompletionMap) {
|
||||
if (policy.value != 0)
|
||||
policiesTable.add("[${policy.key.name}]: ${policy.value}".toLabel()).row()
|
||||
}
|
||||
for (branch in civ.policies.branches)
|
||||
if (civ.policies.isAdopted(branch.name)) {
|
||||
val count = 1 + branch.policies.count {
|
||||
it.policyBranchType != PolicyBranchType.BranchComplete &&
|
||||
civ.policies.isAdopted(it.name)
|
||||
}
|
||||
policiesTable.add("[${branch.name}]: ${count}".toLabel()).row()
|
||||
}
|
||||
return policiesTable
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user