From 6eecd9cdc86d4b019fcc055293664b69c4740b04 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 25 Feb 2011 19:40:08 +0100 Subject: [PATCH] Optimize assemble_dist_paths() for foreign distribution center You can't distribute to a foreign sector. This case is relatively rare. However, unsuccessful path search is relatively expensive, and the extra check doesn't really slow down the common case. --- src/lib/update/finish.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/update/finish.c b/src/lib/update/finish.c index 781fd80f5..266c6533f 100644 --- a/src/lib/update/finish.c +++ b/src/lib/update/finish.c @@ -140,6 +140,8 @@ assemble_dist_paths(double *import_cost) dist = getsectp(sp->sct_dist_x, sp->sct_dist_y); if (CANT_HAPPEN(!dist)) continue; + if (sp->sct_own != dist->sct_own) + continue; /* Now, get the best distribution path over roads */ /* Note we go from the dist center to the sector. This gives us the import path for that sector. */ -- 2.43.0