yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.51k stars 1.57k forks source link

Game Ends in a Time Victory even if the option is turned off. #7191

Closed NoviceCoder2000 closed 2 years ago

NoviceCoder2000 commented 2 years ago

Platform Android OS

Version 4.1.8

Describe the bug As the title already suggests the game ends automatically even if you didn't turn on the time victory option, making games on longer game speed impossible to properly finish.

To Reproduce Steps to reproduce the behavior:

Additional context This is a game of mine of Korea at Turn 499. Modded, yes although I don't think these mods used were directly the cause of the problem.

Korea - Turn 499.txt

OptimizedForDensity commented 2 years ago

If anyone wants to open a PR to fix this, the issue is on line 58 of VictoryManager.kt

https://github.com/yairm210/Unciv/blob/0533c9eabade88adc3c9b65115288c645663af94/core/src/com/unciv/logic/civilization/VictoryManager.kt#L58

Changing civInfo.gameInfo.ruleSet.victories.key to civInfo.gameInfo.gameParameters.victoryTypes fixes this bug by only looking at the victory types that were enabled during game setup. However, this specific fix would cause the otherwise-harmless bug described in #7156 to cause crashes on any current or future games where someone has enabled a modded victory condition then unloaded the mod without disabling that modded victory condition. I tried to fix #7156 but was running into comodification issues and I'm putting off looking further into it until after I finish the modable game speeds PR.

JackRainy commented 2 years ago

Thank you for confirming my ideas. The PR is already there - #7197.