Fix automatic supply of defending and reacting units
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 14 Feb 2009 17:37:34 +0000 (18:37 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 17 Feb 2009 18:30:35 +0000 (19:30 +0100)
commit5ea0d19c20966e516b2bfc047fb9a1fdb7f6a900
treebeb6505db1237df7c4d8bb58ec3839bca3e18227
parent07561b4772ab5b43cc80425c0f06326022b1f3d1
Fix automatic supply of defending and reacting units

Being in supply is relevant for defending and reacting units.  The
code used has_supply() to check that.

Contrary to its name, has_supply() does not check whether the land
unit has enough supplies to be in supply, but whether it has or could
draw enough.  So, defending and reacting units did not actually draw
any missing supplies.

Fix that in get_dlist() and att_reacting_units() by calling
resupply_all(), then checking with new lnd_in_supply() instead of
has_supply().  The fix of att_reacting_units() is complicated by the
fact that it is also used in the strength command, and should keep not
drawing supplies there.

Rename has_supply() to lnd_could_be_supplied().  Replace its uses
immediately after resupply_all() by lnd_in_supply().
include/prototypes.h
src/lib/commands/load.c
src/lib/commands/stre.c
src/lib/commands/supp.c
src/lib/subs/attsub.c
src/lib/subs/supply.c