From: Markus Armbruster Date: Fri, 25 Feb 2011 18:40:08 +0000 (+0100) Subject: Optimize assemble_dist_paths() for foreign distribution center X-Git-Tag: v4.3.27~103 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=6eecd9cdc86d4b019fcc055293664b69c4740b04 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. --- 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. */