mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 12:54:06 -04:00
Fixed mod compatibility autochanges
Tested by forcing a new Deciv game to load with a much older mod version
This commit is contained in:
parent
ebfdbb8c4a
commit
92b71102e1
@ -39,7 +39,7 @@ object BackwardCompatibility {
|
||||
|
||||
private fun GameInfo.removeUnitsAndPromotions() {
|
||||
for (tile in tileMap.values) {
|
||||
for (unit in tile.getUnits()) {
|
||||
for (unit in tile.getUnits().toList()) {
|
||||
if (!ruleset.units.containsKey(unit.name)) tile.removeUnit(unit)
|
||||
|
||||
for (promotion in unit.promotions.promotions.toList())
|
||||
|
@ -564,8 +564,8 @@ object UnitAutomation {
|
||||
// Our main attack target is the closest city, but we're fine with deviating from that a bit
|
||||
var enemyCitiesByPriority = closestEnemyCity.civ.cities
|
||||
.associateWith { it.getCenterTile().aerialDistanceTo(closestEnemyCity.getCenterTile()) }
|
||||
.filterNot { it.value > 10 } // anything 10 tiles away from the target is irrelevant
|
||||
.asSequence().sortedBy { it.value }.map { it.key } // sort the list by closeness to target - least is best!
|
||||
.asSequence().filterNot { it.value > 10 } // anything 10 tiles away from the target is irrelevant
|
||||
.sortedBy { it.value }.map { it.key } // sort the list by closeness to target - least is best!
|
||||
|
||||
if (unit.baseUnit.isRanged()) // ranged units don't harm capturable cities, waste of a turn
|
||||
enemyCitiesByPriority = enemyCitiesByPriority.filterNot { it.health == 1 }
|
||||
|
@ -883,7 +883,7 @@ open class Tile : IsPartOfGameInfoSerialization {
|
||||
if (resource != null && resource !in ruleset.tileResources)
|
||||
resource = null
|
||||
if (improvement != null && improvement !in ruleset.tileImprovements)
|
||||
removeImprovement()
|
||||
improvement = null
|
||||
}
|
||||
|
||||
/** If the unit isn't in the ruleset we can't even know what type of unit this is! So check each place
|
||||
|
@ -62,6 +62,8 @@ object ImageGetter {
|
||||
atlases["game"] = atlas
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Required every time the ruleset changes, in order to load mod-specific images */
|
||||
fun setNewRuleset(ruleset: Ruleset) {
|
||||
ImageGetter.ruleset = ruleset
|
||||
|
Loading…
x
Reference in New Issue
Block a user