2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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 the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * edit.c: Edit things (sectors, ships, planes, units, nukes, countries)
30 * Known contributors to this file:
33 * Steve McClure, 1998-2000
34 * Ron Koenderink, 2003
58 static void benefit(natid who, int good);
59 static int docountry(s_char op, int arg, s_char *p, float farg, natid nat,
61 static int doland(s_char op, int arg, s_char *p, struct sctstr *sect);
62 static int doplane(s_char op, int arg, s_char *p, struct plnstr *plane);
63 static int doship(s_char op, int arg, s_char *p, struct shpstr *ship);
64 static int dounit(s_char op, int arg, s_char *p, struct lndstr *land);
65 static int getin(s_char **, s_char **, int *, s_char *);
66 static void noise(struct sctstr *sptr, int public_amt, s_char *name,
68 static void pr_land(struct lndstr *land);
69 static void pr_plane(struct plnstr *plane);
70 static void pr_ship(struct shpstr *ship);
71 static void prnat(natid n);
72 static void prsect(struct sctstr *sect);
94 s_char ewhat; /* saves information from the command line
97 if ((what = getstarg(player->argp[1],
98 "Edit What (country, land, ship, plane, nuke, unit)? ",
104 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
106 if (!sarg_xy(ptr, &x, &y))
108 if (!getsect(x, y, §))
112 if ((num = natarg(player->argp[2], "Country number? ")) < 0)
118 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
120 if (!getplane(num, &plane))
124 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
126 if (!getship(num, &ship))
130 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
132 if (!getland(num, &land))
136 pr("Not implemented yet.\n");
142 if (player->argp[3] == 0) {
164 if (player->argp[arg_index] != 0) {
165 if (player->argp[arg_index+1] != 0) {
166 thing = player->argp[arg_index++];
167 ptr = player->argp[arg_index++];
171 } else if (arg_index == 3) {
172 if ((err = getin(&thing, &ptr, &arg, buf)) != RET_OK) {
200 if ((err = docountry(thing[0], arg, ptr, farg, nat, np))
205 if ((err = doland(thing[0], arg, ptr, §)) != RET_OK)
211 if ((err = doship(thing[0], arg, ptr, &ship)) != RET_OK)
213 if (!ef_ensure_space(EF_SHIP, ship.shp_uid, 50))
215 if (!putship(ship.shp_uid, &ship))
219 if ((err = dounit(thing[0], arg, ptr, &land))
222 if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50))
224 if (!putland(land.lnd_uid, &land))
228 if ((err = doplane(thing[0], arg, ptr, &plane))
231 if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))
233 if (!putplane(plane.pln_uid, &plane))
246 benefit(natid who, int good)
253 nreport(player->cnum, N_AIDS, who, 1);
256 nreport(player->cnum, N_HURTS, who, 1);
261 noise(struct sctstr *sptr, int public_amt, s_char *name, int old, int new)
265 pr("%s of %s changed from %d to %d\n",
266 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
268 (void)sprintf(p, "changed from %d to %d", old, new);
270 (void)sprintf(p, "%s", (old < new ? "increased" : "decreased"));
272 wu(player->cnum, sptr->sct_own,
273 "%s in %s was %s by an act of %s\n",
274 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
275 p, cname(player->cnum));
276 benefit(sptr->sct_own, (old < new));
280 prsect(struct sctstr *sect)
282 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
283 pr("Distribution sector <D>: %s\n",
284 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
285 pr("Designation <s>: %c\t New designation <S>: %c\n",
286 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
287 pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
288 pr(" o O e m i g f c u w l x X p t F a\n");
289 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
290 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
291 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
292 sect->sct_uran, sect->sct_work, sect->sct_loyal,
293 sect->sct_che, sect->sct_che_target,
294 sect->sct_pstage, sect->sct_ptime,
295 sect->sct_fallout, sect->sct_avail);
297 pr("Mines <M>: %d\t", sect->sct_mines);
298 pr("Coastal <C>: %d\n", sect->sct_coastal);
299 pr("Road %% <R>: %d\t", sect->sct_road);
300 pr("Rail %% <r>: %d\t", sect->sct_rail);
301 pr("Defense %% <d>: %d\n", sect->sct_defense);
311 if ((np = getnatp(n)) == 0)
313 pr("Country #: %2d\n", n);
314 pr("Name <n>: %-20s\t", np->nat_cnam);
315 pr("Connected: %d\n", np->nat_connected);
316 pr("Representative <r>: %-20s\n", np->nat_pnam);
317 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
318 pr("Reserves <m>: %5d\n", np->nat_reserve);
319 pr("Capital <c>: %s\t\t",
320 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
321 pr("Origin <o>: %3s\n",
322 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
323 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
324 pr("Min Used <u>: %3d\n", np->nat_minused);
325 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
326 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
327 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
328 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
329 pr("Money <M>: $%6d\n", np->nat_money);
330 pr("Telegrams <t>: %6d\n", np->nat_tgms);
331 if (opt_DEMANDUPDATE)
332 pr("Updates missed <U>: %d\n", np->nat_missed);
334 pr("Countries contacted: ");
335 for (i = 0; i < MAXNOC; i++) {
336 if (getcontact(np, i))
337 pr("%d(%d) ", i, getcontact(np, i));
344 pr_plane(struct plnstr *plane)
346 pr("UID <U>: %d\t\t", (int)plane->pln_uid);
347 pr("Owner <O>: %d\t\t", (int)plane->pln_own);
348 pr("Location <l>: %s\n",
349 xyas(plane->pln_x, plane->pln_y, player->cnum));
350 pr("Efficiency <e>: %d\t", (int)plane->pln_effic);
351 pr("Mobility <m>: %d\n", (int)plane->pln_mobil);
352 pr("Tech <t>: %d\t\t", plane->pln_tech);
353 pr("Wing <w>: %c\n", plane->pln_wing);
354 pr("Attack <a>: %d\t\t", plane->pln_att);
355 pr("Defense <d>: %d\n", plane->pln_def);
356 pr("Range <r>: %d\t\t", plane->pln_range);
357 pr("Flags <f>: %d\n", plane->pln_flags);
358 pr("Ship <s>: %d\t\t", plane->pln_ship);
359 pr("Land Unit <y>: %d\t", plane->pln_land);
360 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
364 pr_land(struct lndstr *land)
369 lcp = &lchr[(int)land->lnd_type];
370 pr("UID <U>: %d\n", (int)land->lnd_uid);
371 pr("Owner <O>: %d\n", (int)land->lnd_own);
372 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
373 pr("Efficiency <e>: %d\t", (int)land->lnd_effic);
374 pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
375 pr("Tech <t>: %d\t\t", land->lnd_tech);
376 pr("Army <a>: %c\n", land->lnd_army);
377 pr("Attack: %f\t", lcp->l_att);
378 pr("Defense: %f\n", lcp->l_def);
379 pr("Fortification <F>: %d\t", land->lnd_harden);
380 pr("Fuel <B>: %d\n", land->lnd_fuel);
381 count_land_planes(land);
382 pr("Xlight planes <X>: %d\n", land->lnd_nxlight);
383 pr("Land unit <Y>: %d\n", land->lnd_land);
384 pr("Ship <S>: %d\t\t", land->lnd_ship);
385 pr("Radius <P>: %d\n", land->lnd_rad_max);
386 pr("Retreat percentage <Z>: %d\n", (int)land->lnd_retreat);
387 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
388 land->lnd_rpath, (int)land->lnd_rflags);
389 getvec(VT_ITEM, vec, (s_char *)land, EF_LAND);
390 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
391 pr(" c m u f s g p i d o l h r\n");
392 pr("%3d", vec[I_CIVIL]);
393 pr("%4d", vec[I_MILIT]);
394 pr("%4d", vec[I_UW]);
395 pr("%5d", vec[I_FOOD]);
396 pr("%4d", vec[I_SHELL]);
397 pr("%4d", vec[I_GUN]);
398 pr("%5d", vec[I_PETROL]);
399 pr("%5d", vec[I_IRON]);
400 pr("%5d", vec[I_DUST]);
401 pr("%5d", vec[I_OIL]);
402 pr("%5d", vec[I_LCM]);
403 pr("%5d", vec[I_HCM]);
404 pr("%4d", vec[I_RAD]);
409 pr_ship(struct shpstr *ship)
414 if ((natp = getnatp(ship->shp_own)) == 0)
416 pr("%s (#%d) %s\n", natp->nat_cnam, (int)ship->shp_own, prship(ship));
417 pr("UID <U>: %d\n", (int)ship->shp_uid);
418 pr("Owner <O>: %d\t\t\t", (int)ship->shp_own);
419 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
420 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
421 pr("Efficiency <E>: %d\n", (int)ship->shp_effic);
422 pr("Mobility <M>: %d\t\t\t", (int)ship->shp_mobil);
423 pr("Fleet <F>: %c\n", ship->shp_fleet);
425 pr("Helos <H>: %d\n", (int)ship->shp_nchoppers);
426 pr("Xlight planes <X>: %d\n", (int)ship->shp_nxlight);
427 pr("Planes <P>: %d\n", (int)ship->shp_nplane);
429 pr("Units <Y>: %d\n", (int)ship->shp_nland);
430 /* could depend on opt_FUEL - but a deity might want to set this
431 up before enabling the option */
432 pr("Fuel <B>: %d\n", (int)ship->shp_fuel);
433 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
434 ship->shp_rpath, (int)ship->shp_rflags);
435 getvec(VT_ITEM, vec, (s_char *)ship, EF_SHIP);
436 pr("Plague Stage <a>: %d\n", ship->shp_pstage);
437 pr("Plague Time <b>: %d\n", ship->shp_ptime);
438 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
439 pr(" c m u f s g p i d o l h r\n");
440 pr("%3d", vec[I_CIVIL]);
441 pr("%4d", vec[I_MILIT]);
442 pr("%4d", vec[I_UW]);
443 pr("%5d", vec[I_FOOD]);
444 pr("%4d", vec[I_SHELL]);
445 pr("%4d", vec[I_GUN]);
446 pr("%5d", vec[I_PETROL]);
447 pr("%5d", vec[I_IRON]);
448 pr("%5d", vec[I_DUST]);
449 pr("%5d", vec[I_OIL]);
450 pr("%5d", vec[I_LCM]);
451 pr("%5d", vec[I_HCM]);
452 pr("%4d", vec[I_RAD]);
457 errcheck(int num, int min, int max)
467 getin(s_char **what, s_char **p, int *arg, s_char *buf)
469 if (!(*what = getstarg(*p, "%c xxxxx -- thing value : ", buf))) {
474 while (**what && isspace(**what))
478 for (*p = *what; **p && !isspace(**p); (*p)++) /* skip non spaces */
480 while (**p && isspace(**p))
490 doland(s_char op, int arg, s_char *p, struct sctstr *sect)
492 natid newown, oldown;
500 sect->sct_coastal = (arg ? 1 : 0);
501 pr("Coastal flag of %s changed to %d\n",
502 xyas(sect->sct_x, sect->sct_y, player->cnum),
508 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
509 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
510 xyas(sect->sct_x, sect->sct_y, player->cnum),
511 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
513 makelost(EF_SECTOR, sect->sct_own, 0, sect->sct_x,
515 wu(player->cnum, sect->sct_own,
516 "Sector %s lost to deity intervention\n", xyas(sect->sct_x,
521 benefit(sect->sct_own, 0);
522 sect->sct_own = newown;
524 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
525 wu(player->cnum, newown,
526 "Sector %s gained from deity intervention\n",
527 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
534 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
535 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
536 xyas(sect->sct_x, sect->sct_y, player->cnum),
537 cname(sect->sct_oldown),
538 sect->sct_oldown, cname(oldown), oldown);
539 sect->sct_oldown = oldown;
542 new = errcheck(arg, 0, 100);
543 noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
544 sect->sct_effic = (u_char)new;
547 new = errcheck(arg, -127, 255);
548 noise(sect, 1, "Mobility", (int)sect->sct_mobil, new);
549 sect->sct_mobil = new;
552 new = errcheck(arg, 0, 127);
553 noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
554 sect->sct_min = (u_char)new;
557 new = errcheck(arg, 0, 127);
558 noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
559 sect->sct_gmin = (u_char)new;
562 new = errcheck(arg, 0, 127);
563 noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
564 sect->sct_fertil = (u_char)new;
567 new = errcheck(arg, 0, 127);
568 noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
569 sect->sct_oil = (u_char)new;
572 new = errcheck(arg, 0, 127);
573 noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
574 sect->sct_uran = (u_char)new;
577 new = errcheck(arg, 0, 100);
578 noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
579 sect->sct_work = (u_char)new;
582 new = errcheck(arg, 0, 127);
583 pr("Loyalty of %s changed from %d to %d%%\n",
584 xyas(sect->sct_x, sect->sct_y, player->cnum),
585 sect->sct_loyal, new);
586 sect->sct_loyal = (u_char)new;
590 new = errcheck(arg, 0, CHE_MAX);
591 pr("Guerillas in %s changed from %d to %d\n",
592 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
596 old = sect->sct_che_target;
597 new = errcheck(arg, 0, MAXNOC - 1);
598 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
599 xyas(sect->sct_x, sect->sct_y, player->cnum),
600 cname(old), old, cname(new), new);
601 sect->sct_che_target = new;
604 old = sect->sct_pstage;
605 new = errcheck(arg, 0, PLG_EXPOSED);
606 pr("Plague stage of %s changed from %d to %d%\n",
607 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
608 sect->sct_pstage = new;
611 old = sect->sct_ptime;
612 new = errcheck(arg, 0, 255);
613 pr("Plague time of %s changed from %d to %d%\n",
614 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
615 sect->sct_ptime = new;
618 old = sect->sct_fallout;
619 new = errcheck(arg, 0, 9999);
620 pr("Fallout for sector %s changed from %d to %d\n",
621 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
622 sect->sct_fallout = new;
625 new = errcheck(arg, 0, 9999);
626 noise(sect, 1, "Available workforce", (int)sect->sct_avail, new);
627 sect->sct_avail = new;
630 new = errcheck(arg, 0, MINES_MAX);
631 sect->sct_mines = new;
632 pr("Mines changed to %d\n", new);
635 if (!sarg_xy(p, &newx, &newy))
641 if (!sarg_xy(p, &newx, &newy))
643 pr("Distribtion Location for sector %s changed from %s to %s\n",
644 xyas(sect->sct_x, sect->sct_y, player->cnum),
645 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
646 xyas(newx, newy, player->cnum));
647 sect->sct_dist_x = newx;
648 sect->sct_dist_y = newy;
651 des = sct_typematch(p);
654 pr("Designation for sector %s changed from %c to %c\n",
655 xyas(sect->sct_x, sect->sct_y, player->cnum),
656 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
657 sect->sct_type = des;
660 des = sct_typematch(p);
663 pr("New Designation for sector %s changed from %c to %c\n",
664 xyas(sect->sct_x, sect->sct_y, player->cnum),
665 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
666 sect->sct_newtype = des;
673 noise(sect, 1, "Road percentage", (int)sect->sct_road, arg);
674 sect->sct_road = arg;
681 noise(sect, 1, "Rail percentage", (int)sect->sct_rail, arg);
682 sect->sct_rail = arg;
689 noise(sect, 1, "Defense percentage", (int)sect->sct_defense, arg);
690 sect->sct_defense = arg;
693 pr("huh? (%c)\n", op);
701 docountry(s_char op, int arg, s_char *p, float farg, natid nat,
707 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
708 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
711 pr("Country representative changed from %s to %s\n",
713 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
719 arg = errcheck(arg, 0, 1024);
720 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
724 benefit(nat, np->nat_reserve < arg);
725 pr("Military Reserves changed from %d to %d\n",
726 np->nat_reserve, arg);
727 if (np->nat_stat == STAT_NORM)
728 wu(player->cnum, nat,
729 "Military Reserves changed from %d to %d by divine intervention.\n",
730 np->nat_reserve, arg);
731 np->nat_reserve = arg;
734 if (!sarg_xy(p, &newx, &newy))
736 pr("Capital coordinates changed from %s to %s\n",
737 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
738 xyas(newx, newy, player->cnum));
743 if (!sarg_xy(p, &newx, &newy))
745 pr("Origin coordinates changed from %s to %s\n",
746 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
747 xyas(newx, newy, player->cnum));
752 np->nat_stat = (s_char)errcheck(arg, 0, STAT_NEW);
755 arg = errcheck(arg, 0, m_m_p_d);
756 pr("Number of minutes used changed from %d to %d.\n",
757 np->nat_minused, arg);
758 np->nat_minused = arg;
761 pr("Money changed from %d to %d\n", np->nat_money, arg);
762 wu(player->cnum, nat,
763 "Money changed from %d to %d by divine intervention.\n",
768 pr("Tech changed from %.2f to %.2f.\n",
769 np->nat_level[NAT_TLEV], farg);
770 np->nat_level[NAT_TLEV] = farg;
773 pr("Research changed from %.2f to %.2f.\n",
774 np->nat_level[NAT_RLEV], farg);
775 np->nat_level[NAT_RLEV] = farg;
778 pr("Education changed from %.2f to %.2f.\n",
779 np->nat_level[NAT_ELEV], farg);
780 np->nat_level[NAT_ELEV] = farg;
783 pr("Happiness changed from %.2f to %.2f.\n",
784 np->nat_level[NAT_HLEV], farg);
785 np->nat_level[NAT_HLEV] = farg;
788 np->nat_missed = arg;
791 pr("huh? (%c)\n", op);
800 doship(s_char op, int arg, s_char *p, struct shpstr *ship)
807 ship->shp_pstage = arg;
810 ship->shp_ptime = arg;
813 memcpy(ship->shp_rpath, p, sizeof(ship->shp_rpath));
816 ship->shp_rflags = arg;
819 ship->shp_nchoppers = arg;
822 ship->shp_nxlight = arg;
829 wu(player->cnum, ship->shp_own,
830 "%s taken from you by deity intervention!\n", prship(ship));
831 if (arg && arg < MAXNOC) {
832 wu(player->cnum, (natid)arg,
833 "%s given to you by deity intervention!\n", prship(ship));
834 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
836 ship->shp_own = (natid)arg;
837 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
841 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
843 ship->shp_own = (natid)0;
847 if (!sarg_xy(p, &newx, &newy))
853 ship->shp_tech = arg;
856 ship->shp_effic = errcheck(arg, 0, 100);
859 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
861 ship->shp_own = (natid)0;
865 ship->shp_mobil = arg;
868 ship->shp_fuel = errcheck(arg, 0, 255);
872 ship->shp_fleet = ' ';
873 else if (isalpha(p[0]))
874 ship->shp_fleet = p[0];
876 pr("%c: invalid fleet\n", p[0]);
881 ship->shp_nland = errcheck(arg, 0, 100);
884 ship->shp_nplane = errcheck(arg, 0, 100);
887 ship->shp_item[I_CIVIL] = arg;
890 ship->shp_item[I_MILIT] = arg;
893 ship->shp_item[I_UW] = arg;
896 ship->shp_item[I_FOOD] = arg;
899 ship->shp_item[I_SHELL] = arg;
902 ship->shp_item[I_GUN] = arg;
905 ship->shp_item[I_PETROL] = arg;
908 ship->shp_item[I_IRON] = arg;
911 ship->shp_item[I_DUST] = arg;
914 ship->shp_item[I_OIL] = arg;
917 ship->shp_item[I_LCM] = arg;
920 ship->shp_item[I_HCM] = arg;
923 ship->shp_item[I_RAD] = arg;
926 pr("huh? (%c)\n", op);
933 dounit(s_char op, int arg, s_char *p, struct lndstr *land)
940 land->lnd_land = arg;
947 wu(player->cnum, land->lnd_own,
948 "%s taken from you by deity intervention!\n", prland(land));
950 if (arg && arg < MAXNOC) {
951 wu(player->cnum, (natid)arg,
952 "%s given to you by deity intervention!\n", prland(land));
953 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
955 land->lnd_own = (natid)arg;
956 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
959 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
962 land->lnd_own = (natid)0;
966 if (!sarg_xy(p, &newx, &newy))
972 land->lnd_effic = errcheck(arg, 0, 100);
974 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
977 land->lnd_own = (natid)0;
981 land->lnd_mobil = arg;
984 land->lnd_tech = arg;
988 land->lnd_army = ' ';
989 else if (isalpha(p[0]))
990 land->lnd_army = p[0];
992 pr("%c: invalid army\n", p[0]);
997 land->lnd_harden = errcheck(arg, 0, 255);
1000 land->lnd_fuel = errcheck(arg, 0, 255);
1003 land->lnd_nxlight = arg;
1006 land->lnd_ship = arg;
1009 land->lnd_rad_max = arg;
1012 land->lnd_retreat = arg;
1015 memcpy(land->lnd_rpath, p, sizeof(land->lnd_rpath));
1018 land->lnd_rflags = arg;
1021 land->lnd_item[I_CIVIL] = arg;
1024 land->lnd_item[I_MILIT] = arg;
1027 land->lnd_item[I_UW] = arg;
1030 land->lnd_item[I_FOOD] = arg;
1033 land->lnd_item[I_SHELL] = arg;
1036 land->lnd_item[I_GUN] = arg;
1039 land->lnd_item[I_PETROL] = arg;
1042 land->lnd_item[I_IRON] = arg;
1045 land->lnd_item[I_DUST] = arg;
1048 land->lnd_item[I_OIL] = arg;
1051 land->lnd_item[I_LCM] = arg;
1054 land->lnd_item[I_HCM] = arg;
1057 land->lnd_item[I_RAD] = arg;
1060 pr("huh? (%c)\n", op);
1068 doplane(s_char op, int arg, s_char *p, struct plnstr *plane)
1074 plane->pln_nuketype = arg;
1077 plane->pln_uid = arg;
1080 if (!sarg_xy(p, &newx, &newy))
1082 plane->pln_x = newx;
1083 plane->pln_y = newy;
1087 wu(player->cnum, plane->pln_own,
1088 "%s taken from you by deity intervention!\n",
1090 if (arg && arg < MAXNOC) {
1091 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1092 plane->pln_x, plane->pln_y);
1093 plane->pln_own = (natid)arg;
1094 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1095 plane->pln_x, plane->pln_y);
1096 wu(player->cnum, plane->pln_own,
1097 "%s given to you by deity intervention!\n", prplane(plane));
1099 plane->pln_effic = 0;
1100 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1101 plane->pln_x, plane->pln_y);
1102 plane->pln_own = (natid)0;
1106 plane->pln_effic = errcheck(arg, 0, 100);
1108 plane->pln_effic = 0;
1109 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1110 plane->pln_x, plane->pln_y);
1111 plane->pln_own = (natid)0;
1115 plane->pln_mobil = errcheck(arg, -127, 255);
1118 plane->pln_tech = arg;
1122 plane->pln_wing = ' ';
1123 else if (isalpha(p[0]))
1124 plane->pln_wing = p[0];
1126 pr("%c: invalid wing\n", p[0]);
1131 plane->pln_att = (s_char)errcheck(arg, 0, 127);
1134 plane->pln_def = (s_char)arg;
1137 plane->pln_range = (u_char)arg;
1140 plane->pln_ship = arg;
1143 plane->pln_land = arg;
1146 plane->pln_flags = arg;
1149 pr("huh? (%c)\n", op);