]> git.pond.sub.org Git - empserver/commitdiff
Optimize assemble_dist_paths() for foreign distribution center
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 25 Feb 2011 18:40:08 +0000 (19:40 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 11 Apr 2011 20:29:13 +0000 (22:29 +0200)
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

index 781fd80f555cfc018dce9c43ad9322614ada66e7..266c6533f3511cef18f37034b7d9384f8af5f72c 100644 (file)
@@ -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. */