2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2006, 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:
55 targ_land, targ_ship, targ_sub, targ_unit, targ_bogus
59 struct emp_qelem queue; /* list of fired things */
60 int type; /* ship? otherwise sector */
61 int uid; /* ship uid */
62 coord x, y; /* sector coords */
63 int defdam; /* damage defenders did */
64 int victim; /* who I was shooting at */
73 static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
74 static int defend(struct emp_qelem *al,
76 enum targ_type target,
77 enum targ_type attacker,
81 struct shpstr *fship, int fx, int fy, int *nd);
82 static void do_defdam(struct emp_qelem *, double);
83 static int quiet_bigdef(int, struct emp_qelem *, natid, natid, coord,
85 static void use_ammo(struct emp_qelem *);
90 static int ef_with_guns[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD };
115 enum targ_type target, attacker, orig_attacker;
118 struct nstr_item nbst;
124 struct emp_qelem fired, defended;
129 emp_initque(&defended);
130 if (!(p = getstarg(player->argp[1],
131 "Firing from ship(s), sect(s), or land unit(s)? ",
134 type = ef_byname_from(p, ef_with_guns);
135 if (type == EF_SECTOR) {
136 if (opt_NO_FORT_FIRE) {
137 pr("Fort firing is disabled.\n");
140 orig_attacker = attacker = targ_land;
142 } else if (type == EF_SHIP) {
143 orig_attacker = attacker = targ_ship;
144 } else if (type == EF_LAND) {
145 orig_attacker = attacker = targ_unit;
147 pr("Ships, land units or sectors only!\n");
150 if ((ptr = getstarg(player->argp[2], "Firing from? ", buf)) == 0
154 if (!snxtitem(&nbst, type, ptr))
157 if (player->aborted) {
158 pr("Fire aborted.\n");
161 while (nxtitem(&nbst, &item)) {
162 attacker = orig_attacker;
163 if (attacker == targ_unit) {
164 if (!getland(item.land.lnd_uid, &fland))
166 if (!getsect(item.land.lnd_x, item.land.lnd_y, &fsect))
168 if (item.land.lnd_own != player->cnum)
171 if (fland.lnd_frg == 0) {
172 pr("Unit %d cannot fire!\n", fland.lnd_uid);
175 if (fland.lnd_item[I_MILIT] < 1) {
176 pr("Unit %d cannot fire because it has no military!\n",
180 if (fland.lnd_ship >= 0) {
181 pr("Unit %d cannot fire because it is on a ship!\n",
185 if (fland.lnd_land >= 0) {
186 pr("Unit %d cannot fire because it is on a land unit!\n",
190 if (fland.lnd_effic < LAND_MINFIREEFF) {
191 pr("Unit %d cannot fire because it is less than %d%% efficient\n",
192 fland.lnd_uid, LAND_MINFIREEFF);
195 resupply_commod(&fland, I_SHELL); /* Get more shells */
196 putland(fland.lnd_uid, &fland);
197 if (fland.lnd_item[I_SHELL] == 0) {
198 pr("%s -- not enough shells\n", prland(&fland));
201 } else if (attacker == targ_ship) {
202 if (!getship(item.ship.shp_uid, &fship))
204 if (item.ship.shp_own != player->cnum)
206 if (item.ship.shp_item[I_MILIT] < 1) {
207 pr("Not enough mil on ship #%d\n", item.ship.shp_uid);
210 gun = item.ship.shp_item[I_GUN];
211 gun = MIN(gun, item.ship.shp_glim);
212 if (item.ship.shp_frnge == 0) {
213 pr("Ships %d cannot fire guns!\n", item.ship.shp_uid);
217 pr("Not enough guns on ship #%d\n", item.ship.shp_uid);
220 if (item.ship.shp_item[I_SHELL] == 0) {
221 pr("Not enough shells on ship #%d\n", item.ship.shp_uid);
224 if (item.ship.shp_effic < 60) {
225 pr("Ship #%d is crippled!\n", item.ship.shp_uid);
228 fshipno = fship.shp_uid;
229 } else if (attacker == targ_land) {
230 if (!getsect(item.sect.sct_x, item.sect.sct_y, &fsect))
232 if (item.sect.sct_own != player->cnum)
234 if (item.sect.sct_type != SCT_FORTR)
236 if (item.sect.sct_effic < FORTEFF) {
237 pr("Fort not efficient enough to fire!\n");
240 if (item.sect.sct_item[I_GUN] == 0) {
241 pr("Not enough guns in sector %s!\n",
242 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
245 if (item.sect.sct_item[I_SHELL] == 0) {
246 pr("Not enough shells in sector %s!\n",
247 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
250 if (item.sect.sct_item[I_MILIT] < 5) {
251 pr("Not enough military in sector %s!\n",
252 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
255 pr("\nSector %s firing\n",
256 xyas(item.sect.sct_x, item.sect.sct_y, player->cnum));
258 if ((ptr = getstarg(player->argp[3], "Firing at? ", buf)) == 0
261 if (player->aborted) {
262 pr("Fire aborted.\n");
266 (void)strcpy(vbuf, ptr);
271 if (target == targ_ship) {
272 vshipno = atoi(vbuf);
273 if (vshipno < 0 || !getship(vshipno, &vship) ||
275 pr("No such ship exists!\n");
278 target = (mchr[(int)vship.shp_type].m_flags & M_SUB) ?
279 targ_sub : targ_ship;
280 vict = vship.shp_own;
283 if (!getsect(x, y, &vsect)) {
284 pr("No such sector exists!\n");
288 if (!sarg_xy(vbuf, &x, &y) || !getsect(x, y, &vsect)) {
289 pr("No such sector exists!\n");
292 /* We check the sector type, but we only use it for damage, not
293 reporting. That way, you don't get extra information you wouldn't
294 normally get. Besides, what if they want to slam water? :) */
295 if (vsect.sct_type == SCT_SANCT || vsect.sct_type == SCT_WATER)
299 vict = vsect.sct_own;
303 if (attacker == targ_ship) {
304 if (fship.shp_own != player->cnum) {
305 pr("Not your ship!\n");
308 if (target == targ_sub || target == targ_ship) {
309 if (fship.shp_uid == vship.shp_uid) {
310 pr("You can't fire upon yourself!\n");
317 attacker = (mchr[fship.shp_type].m_flags & M_SUB) ?
318 targ_sub : targ_ship;
319 if (attacker == targ_sub){
320 pr("Subs may not fire normally.. use torpedo.\n");
324 attacker = targ_ship;
325 if ((mil = fship.shp_item[I_MILIT]) < 1) {
326 pr("Not enough military for firing crew.\n");
329 gun = fship.shp_item[I_GUN];
330 gun = MIN(gun, fship.shp_glim);
331 if (fship.shp_frnge == 0 || gun == 0) {
332 pr("Insufficient arms.\n");
335 shell = fship.shp_item[I_SHELL];
337 shell += supply_commod(fship.shp_own,
338 fship.shp_x, fship.shp_y,
344 if (fship.shp_effic < 60) {
345 pr("Ship #%d is crippled (%d%%)\n", fshipno,
349 range = effrange(fship.shp_frnge, fship.shp_tech);
350 range2 = roundrange(range);
351 pr("range is %d.00 (%.2f)\n", range2, range);
352 if (target == targ_sub) {
353 if ((mchr[(int)fship.shp_type].m_flags & M_DCH) == 0) {
354 /* Don't tell it's a sub */
356 } else if (shell < 2) {
357 pr("Not enough shells for depth charge!\n");
361 gun = MIN(gun, shell * 2);
362 gun = MIN(gun, mil / 2);
365 guneff = seagun(fship.shp_effic, shots);
367 shell -= ldround(shots / 2.0, 1);
368 fship.shp_item[I_SHELL] = shell;
369 if (opt_NOMOBCOST == 0)
370 fship.shp_mobil = MAX(fship.shp_mobil - 15, -100);
371 putship(fship.shp_uid, &fship);
372 } else if (attacker == targ_unit) {
373 if (fland.lnd_own != player->cnum) {
374 pr("Not your unit!\n");
378 if (target == targ_land) {
379 if (fland.lnd_x == vsect.sct_x
380 && fland.lnd_y == vsect.sct_y) {
381 pr("You can't fire upon yourself!\n");
389 if (fland.lnd_frg == 0) {
390 pr("Unit %d cannot fire!\n", fland.lnd_uid);
393 if (fland.lnd_item[I_SHELL] == 0) {
394 pr("%s -- not enough shells\n", prland(&fland));
398 shell = fland.lnd_item[I_SHELL];
400 range = effrange(fland.lnd_frg, fland.lnd_tech);
401 range2 = roundrange(range);
402 pr("range is %d.00 (%.2f)\n", range2, range);
403 if (target == targ_sub) {
404 /* Don't tell it's a sub */
408 gun = fland.lnd_item[I_GUN];
410 pr("%s -- not enough guns\n", prland(&fland));
414 dam = (int)landunitgun(fland.lnd_effic, fland.lnd_dam, gun,
415 fland.lnd_ammo, shell);
416 if (target == targ_ship) {
417 if (chance(fland.lnd_acc / 100.0))
418 dam = ldround(dam / 2.0, 1);
421 resupply_commod(&fland, I_SHELL); /* Get more shells */
422 putland(fland.lnd_uid, &fland);
426 if (fsect.sct_own != player->cnum ||
427 fsect.sct_type != SCT_FORTR) {
428 pr("No fortress at %s\n",
429 xyas(fsect.sct_x, fsect.sct_y, player->cnum));
432 if (target == targ_land) {
433 if (fsect.sct_x == vsect.sct_x
434 && fsect.sct_y == vsect.sct_y) {
435 pr("You can't fire upon yourself!\n");
439 attacker = targ_land;
440 if ((gun = fsect.sct_item[I_GUN]) == 0) {
441 pr("Insufficient arms.\n");
444 shell = fsect.sct_item[I_SHELL];
446 shell += supply_commod(fsect.sct_own,
447 fsect.sct_x, fsect.sct_y,
453 if (fsect.sct_item[I_MILIT] < 5) {
454 pr("Not enough military for firing crew.\n");
459 range = fortrange(&fsect);
460 range2 = roundrange(range);
461 pr("range is %d.00 (%.2f)\n", range2, range);
462 if (target == targ_sub) {
463 /* Don't tell it's a sub */
466 guneff = landgun((int)fsect.sct_effic, gun);
469 fsect.sct_item[I_SHELL] = shell;
472 trange = mapdist(x, y, fx, fy);
473 if (trange > range2) {
474 pr("Target out of range.\n");
479 pr("Target out of range. Thud.\n");
482 pr("Target ship out of range. Splash.\n");
491 fland.lnd_mission = 0;
492 putland(fland.lnd_uid, &fland);
495 fship.shp_mission = 0;
496 putship(fship.shp_uid, &fship);
501 if (target == targ_bogus) {
502 if (vsect.sct_type == SCT_SANCT) {
503 pr("%s is a %s!!\n", vbuf,
504 dchr[SCT_SANCT].d_name);
506 } else if (vsect.sct_type == SCT_WATER) {
507 pr("You must specify a ship in sector %s!\n",
515 if (!trechk(player->cnum, vict, SEAFIR))
519 if (!trechk(player->cnum, vict, SUBFIR))
524 if (!trechk(player->cnum, vict, LANFIR))
532 if (target == targ_land) {
533 natp = getnatp(player->cnum);
534 rel = getrel(natp, vict);
535 if ((rel != AT_WAR) && (player->cnum != vict) &&
536 (vict) && (vsect.sct_oldown != player->cnum)) {
537 pr("You're not at war with them!\n");
547 if (vship.shp_rflags & RET_DCHRGED)
548 retreat_ship(&vship, 'd');
553 prb = range2 ? (double)trange / range2 : 1.0;
556 pr("Wind deflects shell%s.\n", splur(shots));
557 /* dam = (int)(dam / 2.0);*/
558 dam *= (90 - (random() % 11)) / 100.0;
567 nreport(player->cnum, N_SCT_SHELL, vict, 1);
568 if (vict && vict != player->cnum)
570 "Country #%d shelled sector %s for %d damage.\n",
571 player->cnum, xyas(x, y, vict), dam);
572 pr("Shell%s hit sector %s for %d damage.\n",
573 splur(shots), xyas(x, y, player->cnum), dam);
574 /* Ok, it wasn't a bogus target, so do damage. */
575 if (target != targ_bogus)
576 sectdamage(&vsect, dam, 0);
579 nreport(player->cnum, N_SHP_SHELL, vict, 1);
582 if ((target != targ_sub) ||
583 ((vship.shp_rflags & RET_DCHRGED) == 0))
584 check_retreat_and_do_shipdamage(&vship, dam);
586 shipdamage(&vship, dam);
589 "Country #%d shelled %s in %s for %d damage.\n",
590 player->cnum, prship(&vship),
591 xyas(vship.shp_x, vship.shp_y, vict), dam);
593 pr("Shell%s hit %s in %s for %d damage.\n",
594 splur(shots), prsub(&vship),
595 xyas(vship.shp_x, vship.shp_y, player->cnum), dam);
597 if (vship.shp_effic < SHIP_MINEFF)
598 pr("%s sunk!\n", prsub(&vship));
602 /* Ok, now, check if we had a bogus target. If so,
603 just continue on, since there is no defender. */
604 if (target == targ_bogus)
606 if (attacker == targ_unit) {
607 attacker = targ_land;
608 getsect(fland.lnd_x, fland.lnd_y, &fsect);
611 defend(&fired, &defended, target, attacker, &vsect, &fsect,
612 &vship, &fship, fx, fy, &ndefending);
618 putship(vship.shp_uid, &vship);
621 if ((totaldefdam == 0) && (target == targ_ship))
622 if (vship.shp_rflags & RET_HELPLESS)
623 retreat_ship(&vship, 'h');
629 if ((target == targ_ship) || (target == targ_sub)) {
630 if (fship.shp_effic > SHIP_MINEFF) {
631 shp_missdef(&fship, vict);
634 putship(fship.shp_uid, &fship);
641 odds = ((double)ndefending) / ((double)nfiring);
644 do_defdam(&fired, odds);
649 defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
650 enum targ_type attacker, struct sctstr *vsect, struct sctstr *fsect,
651 struct shpstr *vship, struct shpstr *fship, int fx, int fy, int *nd)
655 int vict, nfiring = 0;
659 if (attacker == targ_land)
660 aown = fsect->sct_own;
662 aown = fship->shp_own;
664 if (target == targ_land)
665 vict = vsect->sct_own;
667 vict = vship->shp_own;
670 (dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
673 fp = malloc(sizeof(struct flist));
674 memset(fp, 0, sizeof(struct flist));
679 fp->x = fsect->sct_x;
680 fp->y = fsect->sct_y;
681 fp->type = targ_land;
684 fp->type = targ_ship;
685 fp->uid = fship->shp_uid;
688 emp_insque(&fp->queue, al);
695 do_defdam(struct emp_qelem *list, double odds)
698 int dam, vict, first = 1;
702 struct emp_qelem *qp, *next;
704 for (qp = list->q_forw; qp != list; qp = next) {
706 fp = (struct flist *)qp;
707 if (fp->type == targ_ship) {
708 if (!getship(fp->uid, &ship) || !ship.shp_own)
713 pr("\nDefenders fire back!\n");
716 dam = odds * fp->defdam;
718 if (fp->type == targ_ship) {
720 pr("Return fire hit %s in %s for %d damage.\n",
722 xyas(ship.shp_x, ship.shp_y, player->cnum), dam);
725 "Return fire hit %s in %s for %d damage.\n",
726 prsub(&ship), xyas(ship.shp_x, ship.shp_y, vict), dam);
727 shipdamage(&ship, dam);
728 putship(ship.shp_uid, &ship);
730 getsect(fp->x, fp->y, §);
732 pr("Return fire hit sector %s for %d damage.\n",
733 xyas(fp->x, fp->y, player->cnum), dam);
734 sectdamage(§, dam, 0);
737 wu(0, vict, "Return fire hit sector %s for %d damage.\n",
738 xyas(fp->x, fp->y, vict), dam);
740 emp_remque(&fp->queue);
746 quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
747 coord ax, coord ay, int *nfiring)
750 double erange, hitchance;
754 int dam, dam2, rel, rel2;
755 struct sctstr firing;
763 snxtitem_dist(&ni, EF_SHIP, ax, ay, 8);
764 while (nxtitem(&ni, &ship)) {
765 if (ship.shp_own == 0)
768 if ((mchr[(int)ship.shp_type].m_flags & M_SUB) &&
769 (attacker == targ_land))
772 rel = getrel(getnatp(ship.shp_own), own);
773 rel2 = getrel(getnatp(ship.shp_own), aown);
774 if ((ship.shp_own != own) && ((rel != ALLIED) || (rel2 != AT_WAR)))
776 /* Don't shoot yourself */
777 if (ship.shp_own == aown)
779 if (ship.shp_effic < 60)
782 gun = ship.shp_item[I_GUN];
783 shell = ship.shp_item[I_SHELL];
785 if (ship.shp_item[I_MILIT] < 1)
788 if (mchr[(int)ship.shp_type].m_flags & M_SUB) {
789 if (shell < SHP_TORP_SHELLS)
790 shell += supply_commod(ship.shp_own,
791 ship.shp_x, ship.shp_y,
792 I_SHELL, SHP_TORP_SHELLS - shell);
793 if (shell < SHP_TORP_SHELLS)
798 if (ship.shp_mobil <= 0)
801 erange = torprange(&ship);
802 range = mapdist(ship.shp_x, ship.shp_y, ax, ay);
803 if (range > roundrange(erange))
805 if (!line_of_sight(NULL, ship.shp_x, ship.shp_y, ax, ay))
809 fp = malloc(sizeof(struct flist));
810 memset(fp, 0, sizeof(struct flist));
811 fp->type = targ_ship;
812 fp->uid = ship.shp_uid;
813 add_to_fired_queue(&fp->queue, list);
815 nreport(ship.shp_own, N_FIRE_BACK, player->cnum, 1);
817 hitchance = DTORP_HITCHANCE(range, ship.shp_visib);
818 if (!chance(hitchance))
821 dam += TORP_DAMAGE();
823 erange = effrange(ship.shp_frnge, ship.shp_tech);
824 if (roundrange(erange) < ni.curdist)
826 /* must have gun, shell, and milit to fire */
828 shell += supply_commod(ship.shp_own,
829 ship.shp_x, ship.shp_y, I_SHELL, 1);
830 /* only need 1 shell, so don't check that */
833 nshot = MIN(gun, ship.shp_item[I_MILIT]);
834 nshot = MIN(nshot, ship.shp_glim);
838 fp = malloc(sizeof(struct flist));
839 memset(fp, 0, sizeof(struct flist));
840 fp->type = targ_ship;
841 fp->uid = ship.shp_uid;
842 add_to_fired_queue(&fp->queue, list);
843 nreport(ship.shp_own, N_FIRE_BACK, player->cnum, 1);
844 dam += seagun(ship.shp_effic, nshot);
847 snxtitem_dist(&ni, EF_LAND, ax, ay, 8);
848 while (nxtitem(&ni, &land)) {
849 if (land.lnd_own == 0)
851 if (land.lnd_effic < LAND_MINFIREEFF)
853 /* Can't fire if on a ship */
854 if (land.lnd_ship >= 0)
856 if (land.lnd_land >= 0)
858 /* Gotta have military */
859 if (land.lnd_item[I_MILIT] < 1)
861 /* Don't shoot yourself */
862 if (land.lnd_own == aown)
865 rel = getrel(getnatp(land.lnd_own), own);
866 rel2 = getrel(getnatp(land.lnd_own), aown);
868 if ((land.lnd_own != own) && ((rel != ALLIED) || (rel2 != AT_WAR)))
871 erange = effrange(land.lnd_frg, land.lnd_tech);
872 if (roundrange(erange) < ni.curdist)
876 if (!has_supply(&land))
879 gun = land.lnd_item[I_GUN];
880 shell = land.lnd_item[I_SHELL];
882 if (land.lnd_item[I_MILIT] == 0 || shell == 0 || gun == 0)
885 dam2 = (int)landunitgun(land.lnd_effic, land.lnd_dam, gun,
886 land.lnd_ammo, shell);
889 fp = malloc(sizeof(struct flist));
890 memset(fp, 0, sizeof(struct flist));
891 fp->type = targ_unit;
892 fp->uid = land.lnd_uid;
893 add_to_fired_queue(&fp->queue, list);
895 putland(land.lnd_uid, &land);
896 nreport(land.lnd_own, N_FIRE_BACK, player->cnum, 1);
901 * Determine if any nearby gun-equipped sectors are within
902 * range and able to fire at an attacker. Firing sectors
903 * need to have guns, shells, and military. Sector being
904 * attacked is x,y -- attacker is at ax,ay.
907 if (!opt_NO_FORT_FIRE) {
908 snxtsct_dist(&ns, ax, ay, 8);
909 while (nxtsct(&ns, &firing)) {
910 if (firing.sct_own == 0)
912 rel = getrel(getnatp(firing.sct_own), own);
913 rel2 = getrel(getnatp(firing.sct_own), aown);
915 if ((firing.sct_own != own) &&
916 ((rel != ALLIED) || (rel2 != AT_WAR)))
918 /* Don't shoot yourself */
919 if (firing.sct_own == aown)
921 erange = fortrange(&firing);
922 if (roundrange(erange) < ns.curdist)
925 gun = firing.sct_item[I_GUN];
926 shell = firing.sct_item[I_SHELL];
929 shell += supply_commod(firing.sct_own,
930 firing.sct_x, firing.sct_y,
932 if (gun == 0 || firing.sct_item[I_MILIT] < 5 || shell == 0)
935 fp = malloc(sizeof(struct flist));
936 memset(fp, 0, sizeof(struct flist));
937 fp->x = firing.sct_x;
938 fp->y = firing.sct_y;
939 fp->type = targ_land;
940 add_to_fired_queue(&fp->queue, list);
941 nreport(firing.sct_own, N_FIRE_BACK, player->cnum, 1);
944 dam += landgun((int)firing.sct_effic, gun);
948 return *nfiring == 0 ? 0 : dam / *nfiring;
952 use_ammo(struct emp_qelem *list)
954 struct emp_qelem *qp, *next;
962 /* use 1 shell from everyone */
963 for (qp = list->q_forw; qp != list; qp = next) {
965 fp = (struct flist *)qp;
966 if (fp->type == targ_ship) {
967 getship(fp->uid, &ship);
968 item = ship.shp_item;
969 if (mchr[(int)ship.shp_type].m_flags & M_SUB) {
970 shell = item[I_SHELL];
971 shell -= SHP_TORP_SHELLS - 1;
974 item[I_SHELL] = shell;
975 putship(ship.shp_uid, &ship);
976 /* mob cost = 1/2 a sect's mob */
977 ship.shp_mobil -= shp_mobcost(&ship) / 2.0;
979 } else if (fp->type == targ_land) {
980 getsect(fp->x, fp->y, §);
981 item = sect.sct_item;
983 getland(fp->uid, &land);
984 item = land.lnd_item;
986 shell = item[I_SHELL];
990 item[I_SHELL] = shell;
991 if (fp->type == targ_ship)
992 putship(ship.shp_uid, &ship);
993 else if (fp->type == targ_land)
996 putland(land.lnd_uid, &land);
998 emp_remque(&fp->queue);
1005 add_to_fired_queue(struct emp_qelem *elem, struct emp_qelem *list)
1007 struct emp_qelem *qp;
1008 struct flist *fp, *ep;
1011 ep = (struct flist *)elem;
1013 /* Don't put them on the list if they're already there */
1014 for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
1015 fp = (struct flist *)qp;
1016 if ((fp->type == targ_ship) && (fp->uid == ep->uid))
1018 if ((fp->type != targ_ship) && (fp->x == ep->x) &&
1024 emp_insque(elem, list);