]> git.pond.sub.org Git - empserver/commitdiff
Optimize s_commod()'s harbor check for embarked land units
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 21 Mar 2011 19:39:47 +0000 (20:39 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 12 Apr 2011 19:51:31 +0000 (21:51 +0200)
src/lib/subs/supply.c

index b7adfd8519270c288a6d9636eb42f954bec16dd3..66de35267ff51b14aadb9cb9844fb32d335f394e 100644 (file)
@@ -319,17 +319,16 @@ s_commod(struct empobj *sink, short *vec,
        if (land.lnd_item[type] <= get_minimum(&land, type))
            continue;
 
-       getsect(land.lnd_x, land.lnd_y, &sect);
+       if (land.lnd_ship >= 0) {
+           getsect(land.lnd_x, land.lnd_y, &sect);
+           if (sect.sct_type != SCT_HARBR || sect.sct_effic < 2)
+               continue;
+       }
+
        move_cost = path_find(land.lnd_x, land.lnd_y, x, y, own, MOB_MOVE);
        if (move_cost < 0)
            continue;
 
-       if ((land.lnd_ship >= 0) && (sect.sct_type != SCT_HARBR))
-           continue;
-
-       if ((land.lnd_ship >= 0) && (sect.sct_effic < 2))
-           continue;
-
 #if 0
        /*
         * Recursive supply is disabled for now.  It can introduce