From db9492cacb47fac753b56dc18e605be4a86dacc7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Jul 2022 09:13:46 +0300 Subject: [PATCH 21/21] Fix overzealous asserts against NoHome units See osdn #45196 Signed-off-by: Marko Lindqvist --- server/citytools.c | 3 ++- server/sanitycheck.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/citytools.c b/server/citytools.c index 25d130f471..b097e7b809 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -845,7 +845,8 @@ void transfer_city_units(struct player *pplayer, struct player *pvictim, continue; } - fc_assert(punit->homecity == pcity->id); + fc_assert(unit_has_type_flag(punit, UTYF_NOHOME) + || punit->homecity == pcity->id); fc_assert(unit_owner(punit) == pplayer); } unit_list_iterate_end; #endif /* FREECIV_DEBUG */ diff --git a/server/sanitycheck.c b/server/sanitycheck.c index 810f2e059e..0ef6139622 100644 --- a/server/sanitycheck.c +++ b/server/sanitycheck.c @@ -252,7 +252,9 @@ static bool check_city_good(struct city *pcity, const char *file, } unit_list_iterate(pcity->units_supported, punit) { - SANITY_CITY(pcity, punit->homecity == pcity->id); + SANITY_CITY(pcity, + unit_has_type_flag(punit, UTYF_NOHOME) + || punit->homecity == pcity->id); SANITY_CITY(pcity, unit_owner(punit) == pplayer); } unit_list_iterate_end; -- 2.35.1