mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Rename BaseUnit.techsAtWhichNoLongerAvailable() (#10663)
* Update BaseUnit.kt * Update BaseUnit.kt * Update RulesetValidator.kt * Update BaseUnit.kt
This commit is contained in:
parent
ca20a09a99
commit
8a03f9df12
@ -49,6 +49,7 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
var promotions = HashSet<String>()
|
||||
var obsoleteTech: String? = null
|
||||
fun techsThatObsoleteThis(): Sequence<String> = if (obsoleteTech == null) sequenceOf() else sequenceOf(obsoleteTech!!)
|
||||
fun techsAtWhichNoLongerAvailable(): Sequence<String> = techsThatObsoleteThis()
|
||||
fun isObsoletedBy(techName: String): Boolean = techsThatObsoleteThis().contains(techName)
|
||||
var upgradesTo: String? = null
|
||||
var replaces: String? = null
|
||||
@ -161,7 +162,7 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
for (requiredTech: String in requiredTechs())
|
||||
if (!civ.tech.isResearched(requiredTech))
|
||||
yield(RejectionReasonType.RequiresTech.toInstance("$requiredTech not researched"))
|
||||
for (obsoleteTech: String in techsThatObsoleteThis())
|
||||
for (obsoleteTech: String in techsAtWhichNoLongerAvailable())
|
||||
if (civ.tech.isResearched(obsoleteTech))
|
||||
yield(RejectionReasonType.Obsoleted.toInstance("Obsolete by $obsoleteTech"))
|
||||
|
||||
|
@ -658,7 +658,7 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
for (requiredTech: String in unit.requiredTechs())
|
||||
if (!ruleset.technologies.containsKey(requiredTech))
|
||||
lines += "${unit.name} requires tech ${requiredTech} which does not exist!"
|
||||
for (obsoleteTech: String in unit.techsThatObsoleteThis())
|
||||
for (obsoleteTech: String in unit.techsAtWhichNoLongerAvailable())
|
||||
if (!ruleset.technologies.containsKey(obsoleteTech))
|
||||
lines += "${unit.name} obsoletes at tech ${obsoleteTech} which does not exist!"
|
||||
if (unit.upgradesTo != null && !ruleset.units.containsKey(unit.upgradesTo!!))
|
||||
|
Loading…
Reference in New Issue
Block a user