console: Don't allow adding cities to spectator/barbarian (will crash)
Some checks failed
Conflict marking / main (push) Failing after 9s
Detekt / detekt (ubuntu-latest) (push) Failing after 2m12s
Build and test / Check code and run unit tests (push) Failing after 7m30s
Generate mkdocs from docs folder / deploy (push) Failing after 1m35s
Close stale issues and PRs / stale (push) Successful in 40s
Docker / build (push) Failing after 2m4s

This commit is contained in:
yairm210
2024-11-24 11:59:42 +02:00
parent d816b50cd9
commit 9dc1d5b4f1

View File

@ -13,6 +13,8 @@ internal class ConsoleCityCommands : ConsoleCommandNode {
"add" to ConsoleAction("city add <civName>") { console, params ->
val civ = console.getCivByName(params[0])
if (!civ.isMajorCiv() && !civ.isCityState)
throw ConsoleErrorException("Can only add cities to major civs or city states")
val selectedTile = console.getSelectedTile()
if (selectedTile.isCityCenter())
throw ConsoleErrorException("Tile already contains a city center")