square-bracket-containing promotions are addable via visible name in dev console

This commit is contained in:
yairm210
2024-09-15 15:19:10 +03:00
parent b71b9db197
commit 1c5375f6a2
2 changed files with 2 additions and 1 deletions

View File

@ -76,7 +76,7 @@ internal class CliInput(
override fun equals(other: Any?): Boolean = when {
this === other -> true
other is CliInput -> compareTo(other) == 0
other is String -> compareTo(other, method) == 0
other is String -> compareTo(other.replace("[","").replace("]",""), method) == 0
else -> false
}

View File

@ -37,6 +37,7 @@ internal class ConsoleUnitCommands : ConsoleCommandNode {
val promotions = console.getSelectedUnit().promotions.promotions
val options = console.gameInfo.ruleset.unitPromotions.keys.asSequence()
.filter { it !in promotions }
.map { it.replace("[","").replace("]","") }
.asIterable()
return getAutocompleteString(params.lastOrNull().orEmpty(), options, console)
}