]> git.pond.sub.org Git - empserver/commit
fire: Check land unit guns earlier, drop useless checks
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 7 Jan 2014 20:48:37 +0000 (21:48 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 19 Jan 2014 09:17:00 +0000 (10:17 +0100)
commit075704276e8b27f6e8ffc3c5c4f7b93c1c918d62
tree621339efbe1014083b2fc33bad5c58538dacd79c
parent196a1292b00ab3d548e825383d873c85d151b3a5
fire: Check land unit guns earlier, drop useless checks

We check all necessary conditions for being able to fire before
prompting for a target.  Except for land unit guns.  Clean that up.

fort_fire(), shp_fire() or lnd_fire() fail only when the fort, ship or
land unit can't fire.  If that happens, our checking is incomplete.
Oops then.

We recheck some of the necessary conditions after getting the target.
However, because the command fails when the firing sector, ship or
land unit has changed since the first check, these rechecks can't
fail.  Drop them.

Note that the rechecks were just as useless before commit 66165f3
fixed fire to fail on change, because they rechecked the unchanged
cached copy instead of the possibly changed original.

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