]> git.pond.sub.org Git - empserver/commit
Fix return fire ammunition use in fire command
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 19:00:48 +0000 (20:00 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 20:00:56 +0000 (21:00 +0100)
commitf89edc7ae6f1779eb1ddd32c9e0d9d9ce5ea7d43
tree8c9ede6950b42f5f4db23dfdb1e071852a38a8a2
parent942eddf533f61d674e57e3a176cadfaaecfbf27f
Fix return fire ammunition use in fire command

The old code let each defender fire on each target separately.  To
avoid charging ammo multiple times, it didn't update the defenders
after fire; it charged them in use_ammo() instead.  Bugs: not updating
the defender lost any shells fetched by automatic resupply, and
use_ammo() always charged one shell for gun fire, which was wrong for
most ships and land units.

Rewrite to let each defender fire once, updating it normally.  Reuse
the damage for the other targets.  This also yields the proper
probability distribution for damage.
src/lib/commands/mfir.c