Closed HaneulCheong closed 2 years ago
Here's the code around the line 98 of the source code's com.unciv.logic.civilization.CityStateFunctions.kt
:
fun giveMilitaryUnitToPatron(receivingCiv: CivilizationInfo) {
val cities = NextTurnAutomation.getClosestCities(receivingCiv, civInfo)
val city = cities.city1
val uniqueUnit = civInfo.gameInfo.ruleSet.units[civInfo.cityStateUniqueUnit]
// If the receiving civ has discovered the required tech and not the obsolete tech for our unique, always give them the unique
val militaryUnit = if (uniqueUnit != null && receivingCiv.tech.isResearched(uniqueUnit.requiredTech!!)
&& (uniqueUnit.obsoleteTech == null || !receivingCiv.tech.isResearched(uniqueUnit.obsoleteTech!!))) uniqueUnit
// Otherwise pick at random
else city.cityConstructions.getConstructableUnits()
.filter { !it.isCivilian() && it.isLandUnit() && it.uniqueTo==null }
.toList().random() // <<<< Line 98!!
// . . .
}
The following units were on the construction list in Eagle Rock
According to the code:
Thus I suspect this is what happened internally:
It should also be noted that the game seems to accept only one city-state unique unit. This might also be part of the crash.
val uniqueUnit = civInfo.gameInfo.ruleSet.units[civInfo.cityStateUniqueUnit]
Have you posted this to the main Unciv bug report line? I think the other devs would like to see this.
As for the "one unique unit" thing you noticed, that might be referring to the unique unit that city-states can give as a gift. I'm hoping that they haven't lost the ability to have unique units of their own.
Just confirmed the game proceeding to next turn without an issue in 4.0.0. This issue seems solved with https://github.com/yairm210/Unciv/pull/6393.
Platform Windows 64-bit
Version Base Game: 3.19.18 Mod: 6a66397f995536a30ebbe4b7d94eb0e268ec0c34
Describe the bug Game crashes when Almaty attempts to gift a unit to the Patriots under a certain unknown condition. Here's the stack trace:
To Reproduce
Expected behavior Almaty successfully gifts a unit to the Patriots.
Additional context