]> git.pond.sub.org Git - empserver/commit
Factor out common ship gun fire code into shp_fire()
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 2 Mar 2008 10:59:56 +0000 (11:59 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 19:25:37 +0000 (20:25 +0100)
commit22c6fd8bf6277149dcc860d073b8dfc7e88355be
tree7781f3983633fce93b14d46058f5743269d5f711
parenta3ad623b2aabb6c04be4e3ab1cbcd0e8eba6be80
Factor out common ship gun fire code into shp_fire()

This takes care of a number of bugs / inconsistencies:

* Ships with zero firing range could return fire and fire support, but
  not fire actively or interdict.  Fix by testing for gun limit
  instead in multifire() and mission().  No ships in the stock game
  are affected.

* Required gun crew was inconsistent: multifire() let N military fire
  max(1,floor(N/2)) guns for active fire.  Ditto perform_mission() for
  interdiction.  quiet_bigdef() let them fire N guns for returning gun
  fire.  Ditto sd() for firing support and firing at boarding parties.
  fire_dchrg() let them fire floor(N/2) for returning fire to
  torpedoes.  Unify to let N military fire floor((N+1)/2) guns.

* Shell use was inconsistent: sd() and perform_mission() used one
  shell per gun, everything else one per two guns.  Unify to one shell
  per two guns.

* Shell resupply bugs: multifire() got two shells regardless of actual
  ammo use.  quiet_bigdef() got one shell (but use_ammo() uses only
  one, which is a bug).  sd() and perform_mission() resupplied before
  checking all other requirements and could thus get more shells than
  actually needed.
include/ship.h
src/lib/commands/mfir.c
src/lib/commands/miss.c
src/lib/commands/torp.c
src/lib/subs/fortdef.c
src/lib/subs/landgun.c
src/lib/subs/mission.c