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.
This commit is contained in:
Markus Armbruster 2011-02-25 19:40:08 +01:00
parent b8002d5603
commit 6eecd9cdc8

View file

@ -140,6 +140,8 @@ assemble_dist_paths(double *import_cost)
dist = getsectp(sp->sct_dist_x, sp->sct_dist_y); dist = getsectp(sp->sct_dist_x, sp->sct_dist_y);
if (CANT_HAPPEN(!dist)) if (CANT_HAPPEN(!dist))
continue; continue;
if (sp->sct_own != dist->sct_own)
continue;
/* Now, get the best distribution path over roads */ /* Now, get the best distribution path over roads */
/* Note we go from the dist center to the sector. This gives /* Note we go from the dist center to the sector. This gives
us the import path for that sector. */ us the import path for that sector. */