Resolved #8036 - resolved map latency when city-states exist

This commit is contained in:
Yair Morgenstern 2022-11-23 20:06:41 +02:00
parent c20ffb03a3
commit f3ce1c4dc5

View File

@ -652,7 +652,14 @@ class CityStateFunctions(val civInfo: CivilizationInfo) {
if (civInfo.isCityState()) return emptySequence()
return civInfo.getKnownCivs().asSequence().filter { it.isCityState() }
.flatMap { getCityStateBonuses(it.cityStateType, it.getDiplomacyManager(civInfo).relationshipLevel(), uniqueType) }
.flatMap {
// We don't use DiplomacyManager.getRelationshipLevel for performance reasons - it tries to calculate getTributeWillingness which is heavy
val relationshipLevel =
if (it.getAllyCiv() == civInfo.civName) RelationshipLevel.Ally
else if (it.getDiplomacyManager(civInfo).getInfluence() >= 30) RelationshipLevel.Friend
else RelationshipLevel.Neutral
getCityStateBonuses(it.cityStateType, relationshipLevel, uniqueType)
}
.filter { it.conditionalsApply(stateForConditionals) }
}