]> git.pond.sub.org Git - empserver/commit
fire: Fix damage and ammunition use of return fire
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 14 May 2016 17:53:02 +0000 (19:53 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 2 Jul 2017 15:45:44 +0000 (17:45 +0200)
commitbd9fbca9954990020898b9646631162f89f5e861
treed8467c435d3e467a9c7bd4ebb718dfc9c01da05a
parent7fddee401ffc424361e75e4073058d864e651f3a
fire: Fix damage and ammunition use of return fire

quiet_bigdef() runs for each attacker.  It lets each eligible defender
fire at most once.  The first time a defender is eligible, it fires
and is saved in the list of defenders, along with its firing damage.
If it's eligible again for a later attacker, it's found in the list of
defenders, and the damage is reused.  The list of defenders searched
with search_flist().  Unfortunately, search_flist() compares only uid,
not type, and therefore can return a previously found defender of
another type.

If there are multiple attackers and multiple defenders with the same
uid, total damage can be off, damage can be spread to attackers out of
range, and defenders may not be charged shells.  Abuse is possible,
but complicated to set up, and probably not worth the trouble.

Broken in commit f89edc7, v4.3.12.  Fix by comparing the type as well.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/mfir.c