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 * multifire.c: Fire at other sectors/ships
30 * Known contributors to this file:
43 targ_land, targ_ship, targ_sub, targ_unit, targ_bogus
47 struct emp_qelem queue; /* list of fired things */
48 int type; /* ship? otherwise sector */
49 int uid; /* ship uid */
50 coord x, y; /* sector coords */
51 int defdam; /* damage defenders did */
52 int victim; /* who I was shooting at */
55 static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
56 static int defend(struct emp_qelem *al,
58 enum targ_type target,
59 enum targ_type attacker,
63 struct shpstr *fship, int fx, int fy, int *nd);
64 static void do_defdam(struct emp_qelem *, double);
65 static int quiet_bigdef(int, struct emp_qelem *, natid, natid, coord,
67 static void use_ammo(struct emp_qelem *);
72 static int ef_with_guns[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD };
97 enum targ_type target, attacker, orig_attacker;
100 struct nstr_item nbst;
105 union empobj_storage item;
106 struct emp_qelem fired, defended;
111 emp_initque(&defended);
112 if (!(p = getstarg(player->argp[1],
113 "Firing from ship(s), sect(s), or land unit(s)? ",
116 type = ef_byname_from(p, ef_with_guns);
117 if (type == EF_SECTOR) {
118 if (opt_NO_FORT_FIRE) {
119 pr("Fort firing is disabled.\n");
122 orig_attacker = attacker = targ_land;
124 } else if (type == EF_SHIP) {
125 orig_attacker = attacker = targ_ship;
126 } else if (type == EF_LAND) {
127 orig_attacker = attacker = targ_unit;
129 pr("Ships, land units or sectors only!\n");
132 if ((ptr = getstarg(player->argp[2], "Firing from? ", buf)) == 0
136 if (!snxtitem(&nbst, type, ptr))
139 if (player->aborted) {
140 pr("Fire aborted.\n");
143 while (nxtitem(&nbst, &item)) {
144 attacker = orig_attacker;
145 if (attacker == targ_unit) {
146 if (!getland(item.land.lnd_uid, &fland))
148 if (!getsect(item.land.lnd_x, item.land.lnd_y, &fsect))
150 if (item.land.lnd_own != player->cnum)
153 if (fland.lnd_frg == 0) {
154 pr("Unit %d cannot fire!\n", fland.lnd_uid);
157 if (fland.lnd_item[I_MILIT] < 1) {
158 pr("Unit %d cannot fire because it has no military!\n",
162 if (fland.lnd_ship >= 0) {
163 pr("Unit %d cannot fire because it is on a ship!\n",
167 if (fland.lnd_land >= 0) {
168 pr("Unit %d cannot fire because it is on a land unit!\n",
172 if (fland.lnd_effic < LAND_MINFIREEFF) {
173 pr("Unit %d cannot fire because it is less than %d%% efficient\n",
174 fland.lnd_uid, LAND_MINFIREEFF);
177 resupply_commod(&fland, I_SHELL); /* Get more shells */
178 putland(fland.lnd_uid, &fland);
179 if (fland.lnd_item[I_SHELL] == 0) {
180 pr("%s -- not enough shells\n", prland(&fland));
183 } else if (attacker == targ_ship) {
184 if (!getship(item.ship.shp_uid, &fship))
186 if (item.ship.shp_own != player->cnum)
188 if (item.ship.shp_item[I_MILIT] < 1) {
189 pr("Not enough mil on ship #%d\n", item.ship.shp_uid);
192 gun = item.ship.shp_item[I_GUN];
193 gun = MIN(gun, item.ship.shp_glim);
194 if (item.ship.shp_frnge == 0) {
195 pr("Ships %d cannot fire guns!\n", item.ship.shp_uid);
199 pr("Not enough guns on ship #%d\n", item.ship.shp_uid);
202 if (item.ship.shp_item[I_SHELL] == 0) {
203 pr("Not enough shells on ship #%d\n", item.ship.shp_uid);
206 if (item.ship.shp_effic < 60) {
207 pr("Ship #%d is crippled!\n", item.ship.shp_uid);
210 fshipno = fship.shp_uid;
211 } else if (attacker == targ_land) {
212 if (!getsect(item.sect.sct_x, item.sect.sct_y, &fsect))
214 if (item.sect.sct_own != player->cnum)
216 if (item.sect.sct_type != SCT_FORTR)
218 if (item.sect.sct_effic < FORTEFF) {
219 pr("Fort not efficient enough to fire!\n");
222 if (item.sect.sct_item[I_GUN] == 0) {
223 pr("Not enough guns in sector %s!\n",
224 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
227 if (item.sect.sct_item[I_SHELL] == 0) {
228 pr("Not enough shells in sector %s!\n",
229 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
232 if (item.sect.sct_item[I_MILIT] < 5) {
233 pr("Not enough military in sector %s!\n",
234 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
237 pr("\nSector %s firing\n",
238 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
240 if ((ptr = getstarg(player->argp[3], "Firing at? ", buf)) == 0
243 if (player->aborted) {
244 pr("Fire aborted.\n");
248 (void)strcpy(vbuf, ptr);
253 if (target == targ_ship) {
254 vshipno = atoi(vbuf);
255 if (vshipno < 0 || !getship(vshipno, &vship) ||
257 pr("No such ship exists!\n");
260 target = (mchr[(int)vship.shp_type].m_flags & M_SUB) ?
261 targ_sub : targ_ship;
262 vict = vship.shp_own;
265 if (!getsect(x, y, &vsect)) {
266 pr("No such sector exists!\n");
270 if (!sarg_xy(vbuf, &x, &y) || !getsect(x, y, &vsect)) {
271 pr("No such sector exists!\n");
274 /* We check the sector type, but we only use it for damage, not
275 reporting. That way, you don't get extra information you wouldn't
276 normally get. Besides, what if they want to slam water? :) */
277 if (vsect.sct_type == SCT_SANCT || vsect.sct_type == SCT_WATER)
281 vict = vsect.sct_own;
285 if (attacker == targ_ship) {
286 if (fship.shp_own != player->cnum) {
287 pr("Not your ship!\n");
290 if (target == targ_sub || target == targ_ship) {
291 if (fship.shp_uid == vship.shp_uid) {
292 pr("You can't fire upon yourself!\n");
299 attacker = (mchr[fship.shp_type].m_flags & M_SUB) ?
300 targ_sub : targ_ship;
301 if (attacker == targ_sub){
302 pr("Subs may not fire normally.. use torpedo.\n");
306 attacker = targ_ship;
307 if ((mil = fship.shp_item[I_MILIT]) < 1) {
308 pr("Not enough military for firing crew.\n");
311 gun = fship.shp_item[I_GUN];
312 gun = MIN(gun, fship.shp_glim);
313 if (fship.shp_frnge == 0 || gun == 0) {
314 pr("Insufficient arms.\n");
317 shell = fship.shp_item[I_SHELL];
319 shell += supply_commod(fship.shp_own,
320 fship.shp_x, fship.shp_y,
326 if (fship.shp_effic < 60) {
327 pr("Ship #%d is crippled (%d%%)\n",
328 fshipno, fship.shp_effic);
331 range = effrange(fship.shp_frnge, fship.shp_tech);
332 range2 = roundrange(range);
333 pr("range is %d.00 (%.2f)\n", range2, range);
334 if (target == targ_sub) {
335 if ((mchr[(int)fship.shp_type].m_flags & M_DCH) == 0) {
336 /* Don't tell it's a sub */
338 } else if (shell < 2) {
339 pr("Not enough shells for depth charge!\n");
343 gun = MIN(gun, shell * 2);
344 gun = MIN(gun, mil / 2);
347 guneff = seagun(fship.shp_effic, shots);
349 shell -= ldround(shots / 2.0, 1);
350 fship.shp_item[I_SHELL] = shell;
351 if (opt_NOMOBCOST == 0)
352 fship.shp_mobil = MAX(fship.shp_mobil - 15, -100);
353 putship(fship.shp_uid, &fship);
354 } else if (attacker == targ_unit) {
355 if (fland.lnd_own != player->cnum) {
356 pr("Not your unit!\n");
360 if (target == targ_land) {
361 if (fland.lnd_x == vsect.sct_x
362 && fland.lnd_y == vsect.sct_y) {
363 pr("You can't fire upon yourself!\n");
371 if (fland.lnd_frg == 0) {
372 pr("Unit %d cannot fire!\n", fland.lnd_uid);
375 if (fland.lnd_item[I_SHELL] == 0) {
376 pr("%s -- not enough shells\n", prland(&fland));
380 shell = fland.lnd_item[I_SHELL];
382 range = effrange(fland.lnd_frg, fland.lnd_tech);
383 range2 = roundrange(range);
384 pr("range is %d.00 (%.2f)\n", range2, range);
385 if (target == targ_sub) {
386 /* Don't tell it's a sub */
390 gun = fland.lnd_item[I_GUN];
392 pr("%s -- not enough guns\n", prland(&fland));
396 dam = (int)landunitgun(fland.lnd_effic, fland.lnd_dam, gun,
397 fland.lnd_ammo, shell);
398 if (target == targ_ship) {
399 if (chance(fland.lnd_acc / 100.0))
400 dam = ldround(dam / 2.0, 1);
403 resupply_commod(&fland, I_SHELL); /* Get more shells */
404 putland(fland.lnd_uid, &fland);
408 if (fsect.sct_own != player->cnum ||
409 fsect.sct_type != SCT_FORTR) {
410 pr("No fortress at %s\n",
411 xyas(fsect.sct_x, fsect.sct_y, player->cnum));
414 if (target == targ_land) {
415 if (fsect.sct_x == vsect.sct_x
416 && fsect.sct_y == vsect.sct_y) {
417 pr("You can't fire upon yourself!\n");
421 attacker = targ_land;
422 if ((gun = fsect.sct_item[I_GUN]) == 0) {
423 pr("Insufficient arms.\n");
426 shell = fsect.sct_item[I_SHELL];
428 shell += supply_commod(fsect.sct_own,
429 fsect.sct_x, fsect.sct_y,
435 if (fsect.sct_item[I_MILIT] < 5) {
436 pr("Not enough military for firing crew.\n");
441 range = fortrange(&fsect);
442 range2 = roundrange(range);
443 pr("range is %d.00 (%.2f)\n", range2, range);
444 if (target == targ_sub) {
445 /* Don't tell it's a sub */
448 guneff = landgun((int)fsect.sct_effic, gun);
451 fsect.sct_item[I_SHELL] = shell;
454 trange = mapdist(x, y, fx, fy);
455 if (trange > range2) {
456 pr("Target out of range.\n");
461 pr("Target out of range. Thud.\n");
464 pr("Target ship out of range. Splash.\n");
473 fland.lnd_mission = 0;
474 putland(fland.lnd_uid, &fland);
477 fship.shp_mission = 0;
478 putship(fship.shp_uid, &fship);
483 if (target == targ_bogus) {
484 if (vsect.sct_type == SCT_SANCT) {
485 pr("%s is a %s!!\n", vbuf,
486 dchr[SCT_SANCT].d_name);
488 } else if (vsect.sct_type == SCT_WATER) {
489 pr("You must specify a ship in sector %s!\n",
497 if (!trechk(player->cnum, vict, SEAFIR))
501 if (!trechk(player->cnum, vict, SUBFIR))
506 if (!trechk(player->cnum, vict, LANFIR))
514 if (target == targ_land) {
515 natp = getnatp(player->cnum);
516 rel = getrel(natp, vict);
517 if ((rel != AT_WAR) && (player->cnum != vict) &&
518 (vict) && (vsect.sct_oldown != player->cnum)) {
519 pr("You're not at war with them!\n");
529 if (vship.shp_rflags & RET_DCHRGED)
530 retreat_ship(&vship, 'd');
535 prb = range2 ? (double)trange / range2 : 1.0;
538 pr("Wind deflects shell%s.\n", splur(shots));
539 /* dam = (int)(dam / 2.0);*/
540 dam *= (90 - (random() % 11)) / 100.0;
549 nreport(player->cnum, N_SCT_SHELL, vict, 1);
550 if (vict && vict != player->cnum)
552 "Country #%d shelled sector %s for %d damage.\n",
553 player->cnum, xyas(x, y, vict), dam);
554 pr("Shell%s hit sector %s for %d damage.\n",
555 splur(shots), xyas(x, y, player->cnum), dam);
556 /* Ok, it wasn't a bogus target, so do damage. */
557 if (target != targ_bogus)
558 sectdamage(&vsect, dam, 0);
561 nreport(player->cnum, N_SHP_SHELL, vict, 1);
564 if ((target != targ_sub) ||
565 ((vship.shp_rflags & RET_DCHRGED) == 0))
566 check_retreat_and_do_shipdamage(&vship, dam);
568 shipdamage(&vship, dam);
571 "Country #%d shelled %s in %s for %d damage.\n",
572 player->cnum, prship(&vship),
573 xyas(vship.shp_x, vship.shp_y, vict), dam);
575 pr("Shell%s hit %s in %s for %d damage.\n",
576 splur(shots), prsub(&vship),
577 xyas(vship.shp_x, vship.shp_y, player->cnum), dam);
579 if (vship.shp_effic < SHIP_MINEFF)
580 pr("%s sunk!\n", prsub(&vship));
584 /* Ok, now, check if we had a bogus target. If so,
585 just continue on, since there is no defender. */
586 if (target == targ_bogus)
588 if (attacker == targ_unit) {
589 attacker = targ_land;
590 getsect(fland.lnd_x, fland.lnd_y, &fsect);
593 defend(&fired, &defended, target, attacker, &vsect, &fsect,
594 &vship, &fship, fx, fy, &ndefending);
600 putship(vship.shp_uid, &vship);
603 if ((totaldefdam == 0) && (target == targ_ship))
604 if (vship.shp_rflags & RET_HELPLESS)
605 retreat_ship(&vship, 'h');
611 if ((target == targ_ship) || (target == targ_sub)) {
612 if (fship.shp_effic > SHIP_MINEFF) {
613 shp_missdef(&fship, vict);
616 putship(fship.shp_uid, &fship);
623 odds = ((double)ndefending) / ((double)nfiring);
626 do_defdam(&fired, odds);
631 defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
632 enum targ_type attacker, struct sctstr *vsect, struct sctstr *fsect,
633 struct shpstr *vship, struct shpstr *fship, int fx, int fy, int *nd)
637 int vict, nfiring = 0;
641 if (attacker == targ_land)
642 aown = fsect->sct_own;
644 aown = fship->shp_own;
646 if (target == targ_land)
647 vict = vsect->sct_own;
649 vict = vship->shp_own;
652 (dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
655 fp = malloc(sizeof(struct flist));
656 memset(fp, 0, sizeof(struct flist));
661 fp->x = fsect->sct_x;
662 fp->y = fsect->sct_y;
663 fp->type = targ_land;
666 fp->type = targ_ship;
667 fp->uid = fship->shp_uid;
670 emp_insque(&fp->queue, al);
677 do_defdam(struct emp_qelem *list, double odds)
680 int dam, vict, first = 1;
684 struct emp_qelem *qp, *next;
686 for (qp = list->q_forw; qp != list; qp = next) {
688 fp = (struct flist *)qp;
689 if (fp->type == targ_ship) {
690 if (!getship(fp->uid, &ship) || !ship.shp_own)
695 pr("\nDefenders fire back!\n");
698 dam = odds * fp->defdam;
700 if (fp->type == targ_ship) {
702 pr("Return fire hit %s in %s for %d damage.\n",
704 xyas(ship.shp_x, ship.shp_y, player->cnum), dam);
707 "Return fire hit %s in %s for %d damage.\n",
708 prsub(&ship), xyas(ship.shp_x, ship.shp_y, vict), dam);
709 shipdamage(&ship, dam);
710 putship(ship.shp_uid, &ship);
712 getsect(fp->x, fp->y, §);
714 pr("Return fire hit sector %s for %d damage.\n",
715 xyas(fp->x, fp->y, player->cnum), dam);
716 sectdamage(§, dam, 0);
719 wu(0, vict, "Return fire hit sector %s for %d damage.\n",
720 xyas(fp->x, fp->y, vict), dam);
722 emp_remque(&fp->queue);
728 quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
729 coord ax, coord ay, int *nfiring)
732 double erange, hitchance;
736 int dam, dam2, rel, rel2;
737 struct sctstr firing;
745 snxtitem_dist(&ni, EF_SHIP, ax, ay, 8);
746 while (nxtitem(&ni, &ship)) {
747 if (ship.shp_own == 0)
750 if ((mchr[(int)ship.shp_type].m_flags & M_SUB) &&
751 (attacker == targ_land))
754 rel = getrel(getnatp(ship.shp_own), own);
755 rel2 = getrel(getnatp(ship.shp_own), aown);
756 if ((ship.shp_own != own) && ((rel != ALLIED) || (rel2 != AT_WAR)))
758 /* Don't shoot yourself */
759 if (ship.shp_own == aown)
761 if (ship.shp_effic < 60)
764 gun = ship.shp_item[I_GUN];
765 shell = ship.shp_item[I_SHELL];
767 if (ship.shp_item[I_MILIT] < 1)
770 if (mchr[(int)ship.shp_type].m_flags & M_SUB) {
771 if (shell < SHP_TORP_SHELLS)
772 shell += supply_commod(ship.shp_own,
773 ship.shp_x, ship.shp_y,
774 I_SHELL, SHP_TORP_SHELLS - shell);
775 if (shell < SHP_TORP_SHELLS)
780 if (ship.shp_mobil <= 0)
783 erange = torprange(&ship);
784 range = mapdist(ship.shp_x, ship.shp_y, ax, ay);
785 if (range > roundrange(erange))
787 if (!line_of_sight(NULL, ship.shp_x, ship.shp_y, ax, ay))
791 fp = malloc(sizeof(struct flist));
792 memset(fp, 0, sizeof(struct flist));
793 fp->type = targ_ship;
794 fp->uid = ship.shp_uid;
795 add_to_fired_queue(&fp->queue, list);
797 nreport(ship.shp_own, N_FIRE_BACK, player->cnum, 1);
799 hitchance = DTORP_HITCHANCE(range, ship.shp_visib);
800 if (!chance(hitchance))
803 dam += TORP_DAMAGE();
805 erange = effrange(ship.shp_frnge, ship.shp_tech);
806 if (roundrange(erange) < ni.curdist)
808 /* must have gun, shell, and milit to fire */
810 shell += supply_commod(ship.shp_own,
811 ship.shp_x, ship.shp_y, I_SHELL, 1);
812 /* only need 1 shell, so don't check that */
815 nshot = MIN(gun, ship.shp_item[I_MILIT]);
816 nshot = MIN(nshot, ship.shp_glim);
820 fp = malloc(sizeof(struct flist));
821 memset(fp, 0, sizeof(struct flist));
822 fp->type = targ_ship;
823 fp->uid = ship.shp_uid;
824 add_to_fired_queue(&fp->queue, list);
825 nreport(ship.shp_own, N_FIRE_BACK, player->cnum, 1);
826 dam += seagun(ship.shp_effic, nshot);
829 snxtitem_dist(&ni, EF_LAND, ax, ay, 8);
830 while (nxtitem(&ni, &land)) {
831 if (land.lnd_own == 0)
833 if (land.lnd_effic < LAND_MINFIREEFF)
835 /* Can't fire if on a ship */
836 if (land.lnd_ship >= 0)
838 if (land.lnd_land >= 0)
840 /* Gotta have military */
841 if (land.lnd_item[I_MILIT] < 1)
843 /* Don't shoot yourself */
844 if (land.lnd_own == aown)
847 rel = getrel(getnatp(land.lnd_own), own);
848 rel2 = getrel(getnatp(land.lnd_own), aown);
850 if ((land.lnd_own != own) && ((rel != ALLIED) || (rel2 != AT_WAR)))
853 erange = effrange(land.lnd_frg, land.lnd_tech);
854 if (roundrange(erange) < ni.curdist)
858 if (!has_supply(&land))
861 gun = land.lnd_item[I_GUN];
862 shell = land.lnd_item[I_SHELL];
864 if (land.lnd_item[I_MILIT] == 0 || shell == 0 || gun == 0)
867 dam2 = (int)landunitgun(land.lnd_effic, land.lnd_dam, gun,
868 land.lnd_ammo, shell);
871 fp = malloc(sizeof(struct flist));
872 memset(fp, 0, sizeof(struct flist));
873 fp->type = targ_unit;
874 fp->uid = land.lnd_uid;
875 add_to_fired_queue(&fp->queue, list);
877 putland(land.lnd_uid, &land);
878 nreport(land.lnd_own, N_FIRE_BACK, player->cnum, 1);
883 * Determine if any nearby gun-equipped sectors are within
884 * range and able to fire at an attacker. Firing sectors
885 * need to have guns, shells, and military. Sector being
886 * attacked is x,y -- attacker is at ax,ay.
889 if (!opt_NO_FORT_FIRE) {
890 snxtsct_dist(&ns, ax, ay, 8);
891 while (nxtsct(&ns, &firing)) {
892 if (firing.sct_own == 0)
894 rel = getrel(getnatp(firing.sct_own), own);
895 rel2 = getrel(getnatp(firing.sct_own), aown);
897 if ((firing.sct_own != own) &&
898 ((rel != ALLIED) || (rel2 != AT_WAR)))
900 /* Don't shoot yourself */
901 if (firing.sct_own == aown)
903 erange = fortrange(&firing);
904 if (roundrange(erange) < ns.curdist)
907 gun = firing.sct_item[I_GUN];
908 shell = firing.sct_item[I_SHELL];
911 shell += supply_commod(firing.sct_own,
912 firing.sct_x, firing.sct_y,
914 if (gun == 0 || firing.sct_item[I_MILIT] < 5 || shell == 0)
917 fp = malloc(sizeof(struct flist));
918 memset(fp, 0, sizeof(struct flist));
919 fp->x = firing.sct_x;
920 fp->y = firing.sct_y;
921 fp->type = targ_land;
922 add_to_fired_queue(&fp->queue, list);
923 nreport(firing.sct_own, N_FIRE_BACK, player->cnum, 1);
926 dam += landgun((int)firing.sct_effic, gun);
930 return *nfiring == 0 ? 0 : dam / *nfiring;
934 use_ammo(struct emp_qelem *list)
936 struct emp_qelem *qp, *next;
944 /* use 1 shell from everyone */
945 for (qp = list->q_forw; qp != list; qp = next) {
947 fp = (struct flist *)qp;
948 if (fp->type == targ_ship) {
949 getship(fp->uid, &ship);
950 item = ship.shp_item;
951 if (mchr[(int)ship.shp_type].m_flags & M_SUB) {
952 shell = item[I_SHELL];
953 shell -= SHP_TORP_SHELLS - 1;
956 item[I_SHELL] = shell;
957 putship(ship.shp_uid, &ship);
958 /* mob cost = 1/2 a sect's mob */
959 ship.shp_mobil -= shp_mobcost(&ship) / 2.0;
961 } else if (fp->type == targ_land) {
962 getsect(fp->x, fp->y, §);
963 item = sect.sct_item;
965 getland(fp->uid, &land);
966 item = land.lnd_item;
968 shell = item[I_SHELL];
972 item[I_SHELL] = shell;
973 if (fp->type == targ_ship)
974 putship(ship.shp_uid, &ship);
975 else if (fp->type == targ_land)
978 putland(land.lnd_uid, &land);
980 emp_remque(&fp->queue);
987 add_to_fired_queue(struct emp_qelem *elem, struct emp_qelem *list)
989 struct emp_qelem *qp;
990 struct flist *fp, *ep;
993 ep = (struct flist *)elem;
995 /* Don't put them on the list if they're already there */
996 for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
997 fp = (struct flist *)qp;
998 if ((fp->type == targ_ship) && (fp->uid == ep->uid))
1000 if ((fp->type != targ_ship) && (fp->x == ep->x) &&
1006 emp_insque(elem, list);