From 97ce68997d4d6555ca77b42ed659c7116c269b78 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 30 Sep 2023 01:42:12 +0300 Subject: [PATCH 52/52] Limit extra iteration on get_tile_infrastructure_set() For better performance, do not iterate over all extras but only over those with correct rmcause. See osdn #48525 Signed-off-by: Marko Lindqvist --- common/map.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/map.c b/common/map.c index 81d4b1cc34..75f245e171 100644 --- a/common/map.c +++ b/common/map.c @@ -105,9 +105,8 @@ bv_extras get_tile_infrastructure_set(const struct tile *ptile, BV_CLR_ALL(pspresent); - extra_type_iterate(pextra) { - if (is_extra_removed_by(pextra, ERM_PILLAGE) - && tile_has_extra(ptile, pextra)) { + extra_type_by_rmcause_iterate(ERM_PILLAGE, pextra) { + if (tile_has_extra(ptile, pextra)) { struct tile *missingset = tile_virtual_new(ptile); bool dependency = FALSE; @@ -131,7 +130,7 @@ bv_extras get_tile_infrastructure_set(const struct tile *ptile, count++; } } - } extra_type_iterate_end; + } extra_type_by_rmcause_iterate_end; if (pcount) { *pcount = count; -- 2.40.1