From 16f3ddd9e378c8eb73fca745f3bfa5026868a680 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Jul 2022 09:09:00 +0300 Subject: [PATCH 56/56] Fix overzealous asserts against NoHome units See osdn #45196 Signed-off-by: Marko Lindqvist --- server/sanitycheck.c | 4 +++- server/unittools.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/sanitycheck.c b/server/sanitycheck.c index 31272187f0..751d1a58df 100644 --- a/server/sanitycheck.c +++ b/server/sanitycheck.c @@ -254,7 +254,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; diff --git a/server/unittools.c b/server/unittools.c index 4a23edb561..7240360231 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -1739,7 +1739,8 @@ bool place_unit(struct unit *punit, struct player *pplayer, unit_list_prepend(ptile->units, punit); maybe_make_contact(ptile, unit_owner(punit)); if (pcity) { - fc_assert(punit->homecity == pcity->id); + fc_assert(unit_has_type_flag(punit, UTYF_NOHOME) + || punit->homecity == pcity->id); fc_assert(city_owner(pcity) == pplayer); unit_list_prepend(pcity->units_supported, punit); /* update unit upkeep */ -- 2.35.1