]> git.pond.sub.org Git - empserver/commitdiff
Don't resupply supply unit after use as supply source
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 15 Feb 2009 06:30:23 +0000 (07:30 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 17 Feb 2009 18:30:35 +0000 (19:30 +0100)
Running supply recursively here is problematic, because it can draw
supplies from the outer supply's destination, which can then end up
with less than it asked for.

Serving as supply source never puts a unit that is in supply out of
supply.  So, the recursive supply here denies the sink its supplies to
put a supply unit somewhere else back in supply.  That's robbing Peter
to pay Paul.  Drop it.

src/lib/subs/supply.c

index 1a10d19a85023b801e026674656386f40653feac..ce5bf89465757ea4ae5d4e8c4f2108ef9db4448c 100644 (file)
@@ -353,10 +353,6 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
 
        if (can_move >= wanted) {
            land.lnd_item[type] -= wanted;
 
        if (can_move >= wanted) {
            land.lnd_item[type] -= wanted;
-
-           /* resupply the supply unit */
-           resupply_commod(&land, type);
-
            land.lnd_mobil -= roundavg(wanted * weight * move_cost);
 
            if (actually_doit)
            land.lnd_mobil -= roundavg(wanted * weight * move_cost);
 
            if (actually_doit)