mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-05 15:59:50 +07:00
Code cleanup
This commit is contained in:
@ -862,12 +862,5 @@ class CityInfo {
|
||||
// Note that we don't query religion here, as those only have local effects
|
||||
}
|
||||
|
||||
// Get all uniques that don't apply to only this city
|
||||
fun getAllUniquesWithNonLocalEffects(): Sequence<Unique> {
|
||||
return cityConstructions.builtBuildingUniqueMap.getAllUniques()
|
||||
.filter { !it.isLocalEffect }
|
||||
// Note that we don't query religion here, as those only have local effects
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
@ -373,16 +373,7 @@ class CivilizationInfo {
|
||||
|
||||
fun hasResource(resourceName: String): Boolean = getCivResourcesByName()[resourceName]!! > 0
|
||||
|
||||
// This function should be removed and replaced by marking where uniques originate from, hopefully.
|
||||
fun getCivWideBuildingUniques(cityItIsFor: CityInfo): Sequence<Unique> =
|
||||
cities.asSequence().flatMap {
|
||||
city ->
|
||||
if (city == cityItIsFor)
|
||||
city.getAllUniquesWithNonLocalEffects().filter { !it.isAntiLocalEffect }
|
||||
else city.getAllUniquesWithNonLocalEffects()
|
||||
}
|
||||
|
||||
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? =
|
||||
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? =
|
||||
StateForConditionals(this)) = getMatchingUniques(uniqueType, stateForConditionals).any()
|
||||
fun hasUnique(unique: String) = getMatchingUniques(unique).any()
|
||||
|
||||
|
@ -181,8 +181,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
||||
|
||||
@Suppress("RemoveRedundantQualifierName") // make it clearer Building inherits Stats
|
||||
for (unique in getMatchingUniques(UniqueType.StatsWithResource))
|
||||
if (civInfo.hasResource(unique.params[1])
|
||||
&& Stats.isStats(unique.params[0]))
|
||||
if (civInfo.hasResource(unique.params[1]))
|
||||
stats.add(unique.stats)
|
||||
|
||||
if (!isWonder)
|
||||
|
Reference in New Issue
Block a user