From 9dc1d5b4f1552a10d734652bec232ef9776f1b35 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sun, 24 Nov 2024 11:59:42 +0200 Subject: [PATCH] console: Don't allow adding cities to spectator/barbarian (will crash) --- core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt b/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt index 6ce68e5cea33e..951378711b753 100644 --- a/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt +++ b/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt @@ -13,6 +13,8 @@ internal class ConsoleCityCommands : ConsoleCommandNode { "add" to ConsoleAction("city add ") { 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")