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:
parent
b8002d5603
commit
6eecd9cdc8
1 changed files with 2 additions and 0 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue