]> git.pond.sub.org Git - empserver/commitdiff
Sectors and ships no longer need shells to fire flak
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 11 Feb 2009 19:46:27 +0000 (20:46 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 14 Feb 2009 13:17:44 +0000 (14:17 +0100)
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).

info/Flak.t
info/supply.t
src/lib/commands/bomb.c
src/lib/subs/aircombat.c

index beb85dfb57522bbae14093552502258274235239..fdc03214a2d28d2fb60fde89e54f23bdae56d81f 100644 (file)
@@ -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:
index 455139df8e678c387b701d0894ee6ec2c6e44af3..35ff4fea8543176ebbcbc8e5f764e88a46af7046 100644 (file)
@@ -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
index ef8582dedf489059c809a5240232e5071d525eef..a87f55babf1f338d696b8823c372aa9d4704fd6b 100644 (file)
@@ -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))
index 892e0aca6f0668f45caca61567c7fc9b4b13772e..5d17bab835cfff4c5dfa852eec7b3136bb156f40 100644 (file)
@@ -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;