2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * aircombat.c: Deal with air to air combat
30 * Known contributors to this file:
32 * Thomas Ruschak, 1992
34 * Markus Armbruster, 2006-2008
50 #include "prototypes.h"
55 #define FLAK_GUN_MAX 14
57 static int plane_caps(struct emp_qelem *);
58 static void ac_intercept(struct emp_qelem *, struct emp_qelem *,
59 struct emp_qelem *, natid, coord, coord);
60 static void ac_dog(struct plist *, struct plist *);
61 static void ac_planedamage(struct plist *, natid, int, natid, int,
63 static void ac_doflak(struct emp_qelem *, struct sctstr *);
64 static void ac_landflak(struct emp_qelem *, coord, coord);
65 static void ac_shipflak(struct emp_qelem *, coord, coord);
66 static void ac_fireflak(struct emp_qelem *, natid, int);
67 static void getilist(struct emp_qelem *, natid);
68 static int do_evade(struct emp_qelem *, struct emp_qelem *);
71 ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
72 coord x, coord y, char *path, int mission_flags,
77 unsigned char gotships[MAXNOC];
78 unsigned char gotlands[MAXNOC];
80 unsigned char rel[MAXNOC];
83 struct emp_qelem ilist[MAXNOC];
93 struct shiplist *head = NULL;
95 /* We want to only intercept once per sector per owner. So, if we overfly
96 a sector, and then overfly some land units or ships, we don't want to
97 potentially intercept 3 times. */
99 plp = (struct plist *)bomb_list->q_forw;
100 plane_owner = plp->plane.pln_own;
102 memset(overfly, 0, sizeof(overfly));
103 memset(gotilist, 0, sizeof(gotilist));
104 for (cn = 0; cn < MAXNOC; cn++)
105 rel[cn] = getrel(getnatp(cn), plane_owner);
107 if (mission_flags & PM_R) {
108 flags = plane_caps(bomb_list);
110 PR(plane_owner, "\nSPY Plane report\n");
113 } else if (flags & P_A) {
114 PR(plane_owner, "\nAnti-Sub Patrol report\n");
116 PR(plane_owner, "\nReconnaissance report\n");
122 getsect(x, y, §);
123 memset(gotships, 0, sizeof(gotships));
124 snxtitem_xy(&ni, EF_SHIP, x, y);
125 while (nxtitem(&ni, &ship)) {
126 if (mchr[(int)ship.shp_type].m_flags & M_SUB)
128 gotships[ship.shp_own] = 1;
130 memset(gotlands, 0, sizeof(gotlands));
131 snxtitem_xy(&ni, EF_LAND, x, y);
132 while (nxtitem(&ni, &land)) {
133 if (land.lnd_ship >= 0 || land.lnd_land >= 0)
135 gotlands[land.lnd_own] = 1;
138 if (mission_flags & PM_R) {
139 flags = plane_caps(bomb_list);
141 setcont(plane_owner, sect.sct_own, FOUND_FLY);
142 if (sect.sct_type == SCT_WATER) {
143 PR(plane_owner, "flying over %s at %s\n",
144 dchr[sect.sct_type].d_name, xyas(x, y, plane_owner));
145 if (mission_flags & PM_S)
146 plane_sweep(bomb_list, x, y);
148 plane_sona(bomb_list, x, y, &head);
149 changed += map_set(plane_owner,
150 sect.sct_x, sect.sct_y,
151 dchr[sect.sct_type].d_mnem, 0);
152 } else if (flags & P_S) {
153 satdisp_sect(§, flags & P_I ? 10 : 50);
155 /* This is borrowed from lookout */
156 if (sect.sct_own == plane_owner)
157 PR(plane_owner, "Your ");
159 PR(plane_owner, "%s (#%d) ",
160 cname(sect.sct_own), sect.sct_own);
161 PR(plane_owner, "%s", dchr[sect.sct_type].d_name);
162 changed += map_set(plane_owner,
163 sect.sct_x, sect.sct_y,
164 dchr[sect.sct_type].d_mnem, 0);
165 PR(plane_owner, " %d%% efficient ",
166 (sect.sct_own == plane_owner) ?
167 sect.sct_effic : roundintby((int)sect.sct_effic, 25));
168 civ = sect.sct_item[I_CIVIL];
169 mil = sect.sct_item[I_MILIT];
171 PR(plane_owner, "with %s%d civ ",
172 (sect.sct_own == plane_owner) ?
174 (sect.sct_own == plane_owner) ?
175 civ : roundintby(civ, 25));
177 PR(plane_owner, "with %s%d mil ",
178 (sect.sct_own == plane_owner) ?
180 (sect.sct_own == plane_owner) ?
181 mil : roundintby(mil, 25));
182 PR(plane_owner, "@ %s\n", xyas(x, y, plane_owner));
185 satdisp_units(sect.sct_x, sect.sct_y);
187 for (cn = 1; cn < MAXNOC; cn++) {
188 if (cn == plane_owner)
191 PR(plane_owner, "Flying over %s ships in %s\n",
192 cname(cn), xyas(x, y, plane_owner));
194 PR(plane_owner, "Flying over %s land units in %s\n",
195 cname(cn), xyas(x, y, plane_owner));
199 PR(plane_owner, "flying over %s at %s\n",
200 dchr[sect.sct_type].d_name, xyas(x, y, plane_owner));
201 changed += map_set(plane_owner, sect.sct_x, sect.sct_y,
202 dchr[sect.sct_type].d_mnem, 0);
205 evaded = do_evade(bomb_list, esc_list);
207 if (sect.sct_own != 0 && sect.sct_own != plane_owner
208 && rel[sect.sct_own] != ALLIED) {
209 overfly[sect.sct_own]++;
210 PR(sect.sct_own, "%s planes spotted over %s\n",
211 cname(plane_owner), xyas(x, y, sect.sct_own));
213 setcont(sect.sct_own, plane_owner, FOUND_FLY);
217 if (rel[sect.sct_own] <= HOSTILE)
218 ac_doflak(bomb_list, §);
219 /* If bombers left, fire flak from units and ships */
220 if (!QEMPTY(bomb_list))
221 ac_landflak(bomb_list, x, y);
222 if (!QEMPTY(bomb_list))
223 ac_shipflak(bomb_list, x, y);
224 /* mission planes aborted due to flak -- don't send escorts */
225 if (QEMPTY(bomb_list))
229 air_defense(x, y, plane_owner, bomb_list, esc_list);
231 if (rel[sect.sct_own] <= HOSTILE) {
232 if (!gotilist[sect.sct_own]) {
233 getilist(&ilist[sect.sct_own], sect.sct_own);
234 gotilist[sect.sct_own]++;
236 ac_intercept(bomb_list, esc_list, &ilist[sect.sct_own],
242 if (!dir || QEMPTY(bomb_list) || (val = diridx(dir)) == DIR_STOP)
244 x = xnorm(x + diroff[val][0]);
245 y = ynorm(y + diroff[val][1]);
248 /* Let's report all of the overflights even if aborted */
249 for (cn = 1; cn < MAXNOC; cn++) {
250 if (plane_owner == cn)
253 nreport(plane_owner, N_OVFLY_SECT, cn, overfly[cn]);
255 /* If the map changed, update it */
257 writemap(player->cnum);
258 /* Now, if the bomber and escort lists are empty, we are done */
259 if (QEMPTY(bomb_list) && QEMPTY(esc_list))
262 /* Something made it through */
264 /* Now, let's make life a little rougher. */
265 for (cn = 1; cn < MAXNOC && !QEMPTY(bomb_list); cn++) {
266 if (plane_owner == cn)
268 if (gotships[cn] != 0)
269 PR(cn, "%s planes spotted over ships in %s\n",
270 cname(plane_owner), xyas(x, y, cn));
271 if (gotlands[cn] != 0)
272 PR(cn, "%s planes spotted over land units in %s\n",
273 cname(plane_owner), xyas(x, y, cn));
274 if (gotships[cn] || gotlands[cn]) {
276 setcont(cn, plane_owner, FOUND_FLY);
277 if (rel[cn] <= HOSTILE && !evaded) {
279 getilist(&ilist[cn], cn);
282 ac_intercept(bomb_list, esc_list, &ilist[cn], cn, x, y);
287 free_shiplist(&head);
288 for (cn = 1; cn < MAXNOC; cn++) {
295 plane_caps(struct emp_qelem *list)
297 struct emp_qelem *qp;
302 for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
303 plp = (struct plist *)qp;
304 fl |= plp->pcp->pl_flags;
311 sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
312 natid def_own, natid plane_owner, coord x, coord y,
315 struct emp_qelem *aqp;
316 struct emp_qelem *anext;
317 struct emp_qelem *dqp;
318 struct emp_qelem *dnext;
323 for (aqp = att_list->q_forw,
324 dqp = def_list->q_forw;
325 aqp != att_list && dqp != def_list; aqp = anext) {
327 aplp = (struct plist *)aqp;
328 if (aplp->pcp->pl_cost < 1000)
330 for (; dqp != def_list; dqp = dnext) {
332 dplp = (struct plist *)dqp;
333 if (!(dplp->pcp->pl_flags & P_M))
336 if (dplp->plane.pln_range <
337 mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y))
339 if (CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED)
340 || mission_pln_equip(dplp, 0, P_F, 0) < 0) {
345 dplp->plane.pln_flags |= PLN_LAUNCHED;
346 putplane(dplp->plane.pln_uid, &dplp->plane);
349 PR(plane_owner, "%s launches SAMs!\n", cname(def_own));
350 PR(def_own, "Launching SAMs at %s planes over %s!\n",
351 cname(plane_owner), xyas(x, y, def_own));
352 ac_combat_headers(plane_owner, def_own);
360 PR(plane_owner, "\n");
363 if (delete_missiles) {
364 for (; dqp != def_list; dqp = dnext) {
366 dplp = (struct plist *)dqp;
367 if (!(dplp->pcp->pl_flags & P_M))
377 ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
378 struct emp_qelem *def_list, natid def_own, coord x, coord y)
383 struct emp_qelem *next;
384 struct emp_qelem *qp;
385 struct emp_qelem int_list;
390 plp = (struct plist *)bomb_list->q_forw;
391 plane_owner = plp->plane.pln_own;
393 sam_intercept(bomb_list, def_list, def_own, plane_owner, x, y, 0);
394 sam_intercept(esc_list, def_list, def_own, plane_owner, x, y, 0);
397 for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw)
399 for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw)
404 emp_initque(&int_list);
406 for (qp = def_list->q_forw; qp != def_list; qp = next) {
408 plp = (struct plist *)qp;
410 /* SAMs interdict separately */
411 if (plp->pcp->pl_flags & P_M)
413 dist = mapdist(x, y, pp->pln_x, pp->pln_y) * 2;
414 if (pp->pln_range < dist)
416 if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
417 || mission_pln_equip(plp, 0, P_F, 0) < 0) {
422 /* got one; delete from def_list, add to int_list */
424 emp_insque(qp, &int_list);
425 pp->pln_flags |= PLN_LAUNCHED;
426 pp->pln_mobil -= pln_mobcost(dist, pp, P_F);
427 putplane(pp->pln_uid, pp);
429 if (icount > att_count)
434 PR(plane_owner, "%d %s fighter%s rising to intercept!\n",
435 icount, cname(def_own), icount == 1 ? " is" : "s are");
436 PR(def_own, "%d fighter%s intercepting %s planes over %s!\n",
437 icount, icount == 1 ? " is" : "s are", cname(plane_owner),
438 xyas(x, y, def_own));
439 ac_combat_headers(plane_owner, def_own);
440 ac_airtoair(esc_list, &int_list);
441 ac_airtoair(bomb_list, &int_list);
442 PR(plane_owner, "\n");
448 ac_combat_headers(natid plane_owner, natid def_own)
451 " %-10.10s %-10.10s strength int odds damage results\n",
452 cname(plane_owner), cname(def_own));
454 " %-10.10s %-10.10s strength int odds damage results\n",
455 cname(def_own), cname(plane_owner));
462 ac_airtoair(struct emp_qelem *att_list, struct emp_qelem *int_list)
464 struct plist *attacker;
465 struct plist *interceptor;
466 struct emp_qelem *att;
467 struct emp_qelem *in;
471 struct emp_qelem *att_next;
472 struct emp_qelem *in_next;
474 att = att_list->q_forw;
475 in = int_list->q_forw;
478 if (QEMPTY(att_list) || QEMPTY(int_list)) {
482 while (more_att || more_int) {
483 in_next = in->q_forw;
484 att_next = att->q_forw;
485 attacker = (struct plist *)att;
486 interceptor = (struct plist *)in;
487 nplanes = attacker->plane.pln_effic;
488 if (nplanes > interceptor->plane.pln_effic)
489 nplanes = interceptor->plane.pln_effic;
490 ac_dog(attacker, interceptor);
493 if (att == att_list) {
495 if (QEMPTY(att_list))
500 if (in == int_list) {
502 if (QEMPTY(int_list))
511 ac_dog(struct plist *ap, struct plist *dp)
516 natid att_own, def_own;
521 att_own = ap->plane.pln_own;
522 def_own = dp->plane.pln_own;
524 PR(att_own, " %3.3s #%-4d %3.3s #%-4d",
526 ap->plane.pln_uid, dp->pcp->pl_name, dp->plane.pln_uid);
528 PR(def_own, " %3.3s #%-4d %3.3s #%-4d",
530 dp->plane.pln_uid, ap->pcp->pl_name, ap->plane.pln_uid);
531 att = pln_att(&ap->plane);
533 att = pln_def(&ap->plane);
534 att = att * ap->plane.pln_effic / 100;
535 att = MAX(att, ap->pcp->pl_def / 2);
537 def = pln_def(&dp->plane) * dp->plane.pln_effic / 100;
538 def = MAX(def, dp->pcp->pl_def / 2);
540 if ((ap->pcp->pl_flags & P_F) && ap->bombs != 0)
542 if ((dp->pcp->pl_flags & P_F) && dp->bombs != 0)
544 att += ap->pcp->pl_stealth / 25.0;
545 def += dp->pcp->pl_stealth / 25.0;
554 odds = ((double)att / ((double)def + (double)att));
557 intensity = roll(20) + roll(20) + roll(20) + roll(20) + 1;
559 PR(att_own, " %3d/%-3d %3d %3.2f ", att, def, intensity, odds);
560 PR(def_own, " %3d/%-3d %3d %3.2f ", def, att, intensity, odds);
564 while ((intensity--) > 0) {
568 if ((dp->plane.pln_effic - ddam) < PLANE_MINEFF)
572 if ((ap->plane.pln_effic - adam) < PLANE_MINEFF)
577 if (dp->pcp->pl_flags & P_M)
580 PR(att_own, "%3d/%-3d", adam, ddam);
581 PR(def_own, "%3d/%-3d", ddam, adam);
582 ac_planedamage(ap, def_own, adam, def_own, 1, 0, mesg);
583 strncpy(temp, mesg, 14);
584 ac_planedamage(dp, att_own, ddam, att_own, 1, 0, mesg);
585 PR(att_own, "%-13.13s %-13.13s\n", temp, mesg);
586 PR(def_own, "%-13.13s %-13.13s\n", mesg, temp);
589 setcont(att_own, def_own, FOUND_FLY);
590 setcont(def_own, att_own, FOUND_FLY);
595 * zap plane associated with plp.
596 * Damaging country is "from", damage is "dam".
597 * def_own is the country on the other side of the conflict from the plane
598 * owner. The only time def_own != from is when the interceptor is getting
601 * NOTE: This routine removes the appropriate plane element from the
602 * queue if it gets destroyed. That means that the caller must assume
603 * that the current queue pointer is invalid on return from the ac_planedamage
604 * call. (this has caused bugs in the past)
607 ac_planedamage(struct plist *plp, natid from, int dam, natid other,
608 int checkabort, int show, char *mesg)
618 plane_owner = pp->pln_own;
620 sprintf(dmess, " no damage");
625 memset(dmess, 0, sizeof(dmess));
629 if (eff < PLANE_MINEFF) {
630 sprintf(dmess, " shot down");
632 } else if (eff < 80 && chance((80 - eff) / 100.0) && checkabort) {
633 sprintf(dmess, " aborted @%2d%%", eff);
635 } else if (show == 0) {
636 sprintf(dmess, " cleared");
639 if ((plp->pcp->pl_flags & P_M) == 0) {
641 PR(plane_owner, " %s %s takes %d%s.\n",
642 cname(pp->pln_own), prplane(pp), dam, dmess);
644 PR(other, " %s %s takes %d%s.\n",
645 cname(pp->pln_own), prplane(pp), dam, dmess);
648 if (show && checkabort == 1) {
649 PR(plane_owner, "\n");
655 pp->pln_mobil -= MIN(32 + pp->pln_mobil, dam / 2);
657 if (disp == 1 && from != 0 && (plp->pcp->pl_flags & P_M) == 0)
658 nreport(from, N_DOWN_PLANE, pp->pln_own, 1);
661 putplane(pp->pln_uid, pp);
666 ac_doflak(struct emp_qelem *list, struct sctstr *from)
673 plp = (struct plist *)list->q_forw;
674 plane_owner = plp->plane.pln_own;
676 gun = MIN(FLAK_GUN_MAX, from->sct_item[I_GUN]);
677 shell = from->sct_item[I_SHELL];
678 if (gun > shell * 2) {
679 shell += supply_commod(from->sct_own, from->sct_x, from->sct_y,
680 I_SHELL, (gun + 1) / 2 - shell);
681 from->sct_item[I_SHELL] = shell;
687 gun = roundavg(tfact(from->sct_own, 2.0 * gun));
689 PR(plane_owner, "firing %d flak guns in %s...\n",
690 gun, xyas(from->sct_x, from->sct_y, plane_owner));
691 if (from->sct_own != 0)
692 PR(from->sct_own, "firing %d flak guns in %s...\n",
693 gun, xyas(from->sct_x, from->sct_y, from->sct_own));
694 ac_fireflak(list, from->sct_own, gun);
699 ac_shipflak(struct emp_qelem *list, coord x, coord y)
704 double flak, total, ngun;
712 plp = (struct plist *)list->q_forw;
713 plane_owner = plp->plane.pln_own;
715 memset(nats, 0, sizeof(nats));
717 snxtitem_xy(&ni, EF_SHIP, x, y);
718 while (!QEMPTY(list) && nxtitem(&ni, &ship)) {
719 if (ship.shp_own == 0 || ship.shp_own == plane_owner)
721 mcp = &mchr[(int)ship.shp_type];
722 if (mcp->m_flags & M_SUB)
724 rel = getrel(getnatp(ship.shp_own), plane_owner);
728 gun = shp_usable_guns(&ship);
730 shell = ship.shp_item[I_SHELL];
732 shell = supply_commod(ship.shp_own, ship.shp_x, ship.shp_y,
734 ship.shp_item[I_SHELL] = shell;
735 putship(ship.shp_uid, &ship);
738 if (gun == 0 || shell == 0)
740 flak = gun * (ship.shp_effic / 100.0);
742 total += techfact(ship.shp_tech, flak * 2.0);
744 if (!nats[ship.shp_own]) {
745 /* First time here, print the message */
746 PR(ship.shp_own, "%s planes spotted over ships in %s\n",
747 cname(plane_owner), xyas(x, y, ship.shp_own));
748 nats[ship.shp_own] = 1;
750 PR(ship.shp_own, "firing %.0f flak guns from %s...\n",
751 flak, prship(&ship));
755 /* Limit to FLAK_GUN_MAX guns of average tech factor */
756 if (ngun > FLAK_GUN_MAX)
757 total *= FLAK_GUN_MAX / ngun;
759 gun = roundavg(total);
761 PR(plane_owner, "Flak! Ships firing %d flak guns...\n", gun);
762 ac_fireflak(list, from, gun);
767 ac_landflak(struct emp_qelem *list, coord x, coord y)
772 double flak, total, ngun;
780 plp = (struct plist *)list->q_forw;
781 plane_owner = plp->plane.pln_own;
783 memset(nats, 0, sizeof(nats));
785 snxtitem_xy(&ni, EF_LAND, x, y);
786 while (!QEMPTY(list) && nxtitem(&ni, &land)) {
787 if (land.lnd_own == 0 || land.lnd_own == plane_owner)
789 lcp = &lchr[(int)land.lnd_type];
790 aaf = lnd_aaf(&land);
791 if ((lcp->l_flags & L_FLAK) == 0 || aaf == 0)
793 if (land.lnd_ship >= 0 || land.lnd_land >= 0)
795 rel = getrel(getnatp(land.lnd_own), plane_owner);
798 flak = aaf * 1.5 * land.lnd_effic / 100.0;
800 total += techfact(land.lnd_tech, flak * 2.0);
802 if (!nats[land.lnd_own]) {
803 /* First time here, print the message */
804 PR(land.lnd_own, "%s planes spotted over land units in %s\n",
805 cname(plane_owner), xyas(x, y, land.lnd_own));
806 nats[land.lnd_own] = 1;
808 PR(land.lnd_own, "firing flak guns from unit %s (aa rating %d)\n",
813 /* Limit to FLAK_GUN_MAX guns of average tech factor */
814 if (ngun > FLAK_GUN_MAX)
815 total *= FLAK_GUN_MAX / ngun;
817 gun = roundavg(total);
819 PR(plane_owner, "Flak! Land units firing %d flak guns...\n", gun);
820 ac_fireflak(list, from, gun);
825 * Called from shipflak, landflak, and doflak.
828 ac_fireflak(struct emp_qelem *list, natid from, int guns)
832 struct emp_qelem *qp;
833 struct emp_qelem *next;
836 plp = (struct plist *)list->q_forw;
838 for (qp = list->q_forw; qp != list; qp = next) {
840 plp = (struct plist *)qp;
841 n = ac_flak_dam(guns, pln_def(&plp->plane), plp->pcp->pl_flags);
842 ac_planedamage(plp, from, n, 0, 2, 1, msg);
847 * Calculate flak damage
850 ac_flak_dam(int guns, int def, int pl_flags)
854 /* <-7 -7 -6 -5 -4 */
855 static float flaktable[18] = { 0.132f, 0.20f, 0.20f, 0.25f, 0.30f,
856 /* -3 -2 -1 0 +1 +2 +3 +4 */
857 0.35f, 0.40f, 0.45f, 0.50f, 0.50f, 0.55f, 0.60f, 0.65f,
858 /* +5 +6 +7 +8 >+8 */
859 0.70f,0.75f, 0.80f, 0.85f, 1.1305f };
860 enum { FLAK_MAX = sizeof(flaktable)/sizeof(flaktable[0]) - 1 };
863 if ((pl_flags & P_T) == 0)
871 mult = flaktable[FLAK_MAX];
876 mult = flaktable[flak];
879 dam = (int)((roll(8) + 2) * mult);
886 * Get a list of planes available for interception duties.
889 getilist(struct emp_qelem *list, natid own)
891 struct plchrstr *pcp;
897 snxtitem_all(&ni, EF_PLANE);
898 while (nxtitem(&ni, &plane)) {
899 if (plane.pln_own != own)
901 pcp = &plchr[(int)plane.pln_type];
902 if ((pcp->pl_flags & P_F) == 0)
904 if (plane.pln_flags & PLN_LAUNCHED)
906 if (plane.pln_mission != 0)
908 if (plane.pln_mobil <= 0)
910 if (plane.pln_effic < 40)
912 if (!pln_airbase_ok(&plane, 0, 0))
915 ip = malloc(sizeof(*ip));
918 ip->pcp = &plchr[(int)plane.pln_type];
920 emp_insque(&ip->queue, list);
925 do_evade(struct emp_qelem *bomb_list, struct emp_qelem *esc_list)
927 struct emp_qelem *qp;
932 for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw) {
933 plp = (struct plist *)qp;
934 if (evade > plp->pcp->pl_stealth / 100.0)
935 evade = plp->pcp->pl_stealth / 100.0;
937 for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw) {
938 plp = (struct plist *)qp;
939 if (evade > plp->pcp->pl_stealth / 100.0)
940 evade = plp->pcp->pl_stealth / 100.0;