Sectors and ships no longer need shells to fire flak
4.0.9 changed flak not to use up shells, but they still had to be present. Drop that, because it doesn't really provide any value. Moreover, this gets rid of the buggy flak shell supply code (seqno mismatch oopses, lost supplies).
This commit is contained in:
parent
7cce3124bf
commit
c0b300d875
4 changed files with 5 additions and 48 deletions
14
info/Flak.t
14
info/Flak.t
|
@ -24,19 +24,7 @@ In addition, if you are pin-bombing a land unit or a ship, when
|
|||
you make your bombing run, the specific unit/ship you are bombing
|
||||
gets to fire flak at you again. This number of guns firing flak
|
||||
in these cases does NOT saturate.
|
||||
.s1
|
||||
When a sector fires flak, the amount of shells required is the # of
|
||||
guns fired divided by 2. If not enough shells are available, either no flak
|
||||
is fired, or the flak is reduced to the number of shells available.
|
||||
Note that the shells are not consumed during flak fire, they just need
|
||||
to be available.
|
||||
.s1
|
||||
When a ship fires flak, at least 1 shell must be available.
|
||||
If no shells are available, no flak is fired. Note that the shell is
|
||||
not consumed during flak fire, it just needs to be available.
|
||||
.s1
|
||||
Land units use no shells when firing flak. Any land unit with an
|
||||
aaf rating of > 0 will fire flak when pin-bombed.
|
||||
Land units do not need capability flak to fire here.
|
||||
.s1
|
||||
The formulas for determining the # of guns fired in a general volley
|
||||
is:
|
||||
|
|
|
@ -34,7 +34,7 @@ or the unit wishes to attack, or is attacked, etc, it must attempt to get
|
|||
them from supply sources. Other things may use the same routines, such as
|
||||
loyal sectors, which will draw food from supply sources when in danger of
|
||||
starvation, and ships/forts/sectors, which will draw shells when they need
|
||||
them to fire defensively or fire AA at planes.
|
||||
them to fire defensively.
|
||||
.s1
|
||||
.L "Supply Sources"
|
||||
.s1
|
||||
|
|
|
@ -458,7 +458,6 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
int nukedam;
|
||||
int flak;
|
||||
int gun;
|
||||
int shell;
|
||||
|
||||
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
||||
free_shiplist(&head);
|
||||
|
@ -506,19 +505,10 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
if ((plp->pcp->pl_flags & P_A) && !on_shiplist(shipno, head))
|
||||
continue;
|
||||
|
||||
shell = 0;
|
||||
gun = shp_usable_guns(&ship);
|
||||
if (gun > 0) {
|
||||
shell = ship.shp_item[I_SHELL];
|
||||
if (shell <= 0)
|
||||
shell = supply_commod(ship.shp_own,
|
||||
ship.shp_x, ship.shp_y, I_SHELL, 1);
|
||||
}
|
||||
mcp = &mchr[(int)ship.shp_type];
|
||||
if (gun > 0 && shell > 0 && !(mcp->m_flags & M_SUB)) {
|
||||
if (gun > 0 && !(mcp->m_flags & M_SUB)) {
|
||||
flak = (int)(techfact(ship.shp_tech, gun) * 2.0);
|
||||
ship.shp_item[I_SHELL] = shell;
|
||||
putship(ship.shp_uid, &ship);
|
||||
PR(ship.shp_own, "Flak! Firing %d guns from ship %s\n",
|
||||
flak, prship(&ship));
|
||||
if (pinflak_planedamage(&plp->plane, plp->pcp, ship.shp_own, flak))
|
||||
|
|
|
@ -637,7 +637,6 @@ ac_planedamage(struct plist *plp, natid from, int dam, natid other,
|
|||
static void
|
||||
ac_doflak(struct emp_qelem *list, struct sctstr *from)
|
||||
{
|
||||
int shell;
|
||||
int gun;
|
||||
natid plane_owner;
|
||||
struct plist *plp;
|
||||
|
@ -646,16 +645,6 @@ ac_doflak(struct emp_qelem *list, struct sctstr *from)
|
|||
plane_owner = plp->plane.pln_own;
|
||||
|
||||
gun = MIN(FLAK_GUN_MAX, from->sct_item[I_GUN]);
|
||||
shell = from->sct_item[I_SHELL];
|
||||
if (gun > shell * 2) {
|
||||
shell += supply_commod(from->sct_own, from->sct_x, from->sct_y,
|
||||
I_SHELL, (gun + 1) / 2 - shell);
|
||||
from->sct_item[I_SHELL] = shell;
|
||||
putsect(from);
|
||||
}
|
||||
if (gun > shell * 2)
|
||||
gun = shell * 2;
|
||||
|
||||
gun = roundavg(tfact(from->sct_own, 2.0 * gun));
|
||||
if (gun > 0) {
|
||||
PR(plane_owner, "firing %d flak guns in %s...\n",
|
||||
|
@ -674,7 +663,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
|
|||
struct shpstr ship;
|
||||
struct mchrstr *mcp;
|
||||
double flak, total, ngun;
|
||||
int gun, shell;
|
||||
int gun;
|
||||
int rel;
|
||||
struct plist *plp;
|
||||
natid plane_owner;
|
||||
|
@ -694,18 +683,8 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
|
|||
rel = getrel(getnatp(ship.shp_own), plane_owner);
|
||||
if (rel > HOSTILE)
|
||||
continue;
|
||||
shell = 0;
|
||||
gun = shp_usable_guns(&ship);
|
||||
if (gun) {
|
||||
shell = ship.shp_item[I_SHELL];
|
||||
if (shell <= 0) {
|
||||
shell = supply_commod(ship.shp_own, ship.shp_x, ship.shp_y,
|
||||
I_SHELL, 1);
|
||||
ship.shp_item[I_SHELL] = shell;
|
||||
putship(ship.shp_uid, &ship);
|
||||
}
|
||||
}
|
||||
if (gun == 0 || shell == 0)
|
||||
if (gun == 0)
|
||||
continue;
|
||||
flak = gun * (ship.shp_effic / 100.0);
|
||||
ngun += flak;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue