From 24605b99a73ccbb5edd13afc5d8c9dd817be4852 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 12 Jun 2022 10:44:43 +0300 Subject: [PATCH 11/11] Editor: Disallow creation of more than one unit of unique type Reported by Alexandro Ignatiev See osdn #44793 Signed-off-by: Marko Lindqvist --- server/edithand.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/edithand.c b/server/edithand.c index f86153a408..48d56caeb5 100644 --- a/server/edithand.c +++ b/server/edithand.c @@ -486,6 +486,15 @@ void handle_edit_unit_create(struct connection *pc, int owner, int tile, return; } + if (utype_has_flag(punittype, UTYF_UNIQUE)) { + if (utype_player_already_has_this_unique(pplayer, punittype)) { + return; + } + if (count > 1) { + return; + } + } + if (is_non_allied_unit_tile(ptile, pplayer) || (tile_city(ptile) && !pplayers_allied(pplayer, city_owner(tile_city(ptile))))) { -- 2.35.1