mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Resolved #9874 - free buildings are converted to civ-specific replacements
This commit is contained in:
parent
bbf2f2ff89
commit
5e7f49dac8
@ -104,21 +104,24 @@ class CivConstructions : IsPartOfGameInfoSerialization {
|
||||
.mapValues { unique -> unique.value.sumOf { it.params[1].toInt() } }
|
||||
|
||||
for ((building, amount) in buildingsUniquesData) {
|
||||
addFreeBuildings(building, amount)
|
||||
val civBuildingEquivalent = civInfo.getEquivalentBuilding(building)
|
||||
addFreeBuildings(civBuildingEquivalent, amount)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addFreeBuildings(building: String, amount: Int) {
|
||||
private fun addFreeBuildings(building: Building, amount: Int) {
|
||||
|
||||
for (city in civInfo.cities.take(amount)) {
|
||||
if (freeSpecificBuildingsProvided[building]?.contains(city.id) == true || city.cityConstructions.containsBuildingOrEquivalent(building)) continue
|
||||
if (freeSpecificBuildingsProvided[building.name]?.contains(city.id) == true
|
||||
|| city.cityConstructions.containsBuildingOrEquivalent(building.name)) continue
|
||||
|
||||
(city.cityConstructions.getConstruction(building) as INonPerpetualConstruction).postBuildEvent(city.cityConstructions)
|
||||
building.postBuildEvent(city.cityConstructions)
|
||||
|
||||
if (!freeSpecificBuildingsProvided.containsKey(building))
|
||||
freeSpecificBuildingsProvided[building] = hashSetOf()
|
||||
freeSpecificBuildingsProvided[building]!!.add(city.id)
|
||||
if (!freeSpecificBuildingsProvided.containsKey(building.name))
|
||||
freeSpecificBuildingsProvided[building.name] = hashSetOf()
|
||||
freeSpecificBuildingsProvided[building.name]!!.add(city.id)
|
||||
|
||||
addFreeBuilding(city.id, building)
|
||||
addFreeBuilding(city.id, building.name)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user