mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-25 22:59:12 +07:00
Fixed a rare diplomacy voting bug in one-more-turn mode (#5845)
* Fixed a rare bug where in one-more-turn mode after conquering all other civs, players could be asked to vote, despite having no one to vote for * Removed code duplication
This commit is contained in:
parent
f03918f610
commit
f14ec29468
@ -930,6 +930,8 @@ class CivilizationInfo {
|
||||
fun mayVoteForDiplomaticVictory() =
|
||||
getTurnsTillNextDiplomaticVote() == 0
|
||||
&& civName !in gameInfo.diplomaticVictoryVotesCast.keys
|
||||
// Only vote if there is someone to vote for, may happen in one-more-turn mode
|
||||
&& gameInfo.civilizations.any { it.isMajorCiv() && !it.isDefeated() && it != this }
|
||||
|
||||
fun diplomaticVoteForCiv(chosenCivName: String?) {
|
||||
if (chosenCivName != null) gameInfo.diplomaticVictoryVotesCast[civName] = chosenCivName
|
||||
@ -937,10 +939,11 @@ class CivilizationInfo {
|
||||
|
||||
fun shouldShowDiplomaticVotingResults() =
|
||||
flagsCountdown[CivFlags.ShowDiplomaticVotingResults.name] == 0
|
||||
&& gameInfo.civilizations.any { it.isMajorCiv() && !it.isDefeated() && it != this }
|
||||
|
||||
// Yes, this is the same function as above, but with a different use case so it has a different name.
|
||||
fun shouldCheckForDiplomaticVictory() =
|
||||
flagsCountdown[CivFlags.ShowDiplomaticVotingResults.name] == 0
|
||||
shouldShowDiplomaticVotingResults()
|
||||
|
||||
/** Modify gold by a given amount making sure it does neither overflow nor underflow.
|
||||
* @param delta the amount to add (can be negative)
|
||||
|
Loading…
Reference in New Issue
Block a user