mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Console: Show available commands on empty command
This commit is contained in:
parent
7dc54dab03
commit
df8f7c6bdd
@ -17,9 +17,8 @@ interface ConsoleCommandNode:ConsoleCommand{
|
||||
val subcommands: HashMap<String, ConsoleCommand>
|
||||
|
||||
override fun handle(console: DevConsolePopup, params: List<String>): String? {
|
||||
if (params.isEmpty())
|
||||
return "Available commands: " + subcommands.keys.joinToString()
|
||||
val handler = subcommands[params[0]] ?: return "Invalid command"
|
||||
if (params.isEmpty()) return "Available commands: " + subcommands.keys.joinToString()
|
||||
val handler = subcommands[params[0]] ?: return "Invalid command. Available commands: " + subcommands.keys.joinToString()
|
||||
return handler.handle(console, params.drop(1))
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,6 @@ class DevConsolePopup(val screen: WorldScreen) : Popup(screen) {
|
||||
|
||||
private fun handleCommand(): String? {
|
||||
val params = getParams(textField.text)
|
||||
if (params.isEmpty()) return "No command"
|
||||
return ConsoleCommandRoot().handle(this, params)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user