2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2004, 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-2004
59 static void benefit(natid who, int good);
60 static int docountry(s_char op, int arg, s_char *p, float farg, natid nat,
62 static int doland(s_char op, int arg, s_char *p, struct sctstr *sect);
63 static int doplane(s_char op, int arg, s_char *p, struct plnstr *plane);
64 static int doship(s_char op, int arg, s_char *p, struct shpstr *ship);
65 static int dounit(s_char op, int arg, s_char *p, float farg, struct lndstr *land);
66 static int getin(s_char **, s_char **, int *, s_char *);
67 static void noise(struct sctstr *sptr, int public_amt, s_char *name,
69 static void pr_land(struct lndstr *land);
70 static void pr_plane(struct plnstr *plane);
71 static void pr_ship(struct shpstr *ship);
72 static void prnat(natid n);
73 static void prsect(struct sctstr *sect);
95 s_char ewhat; /* saves information from the command line
98 if ((what = getstarg(player->argp[1],
99 "Edit What (country, land, ship, plane, nuke, unit)? ",
105 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
107 if (!sarg_xy(ptr, &x, &y))
109 if (!getsect(x, y, §))
113 if ((num = natarg(player->argp[2], "Country number? ")) < 0)
119 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
121 if (!getplane(num, &plane))
125 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
127 if (!getship(num, &ship))
131 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
133 if (!getland(num, &land))
137 pr("Not implemented yet.\n");
143 if (player->argp[3] == 0) {
165 if (player->argp[arg_index] != 0) {
166 if (player->argp[arg_index+1] != 0) {
167 thing = player->argp[arg_index++];
168 ptr = player->argp[arg_index++];
172 } else if (arg_index == 3) {
173 if ((err = getin(&thing, &ptr, &arg, buf)) != RET_OK) {
200 farg = (float)atof(ptr);
201 if ((err = docountry(thing[0], arg, ptr, farg, nat, np))
206 if ((err = doland(thing[0], arg, ptr, §)) != RET_OK)
212 if ((err = doship(thing[0], arg, ptr, &ship)) != RET_OK)
214 if (!ef_ensure_space(EF_SHIP, ship.shp_uid, 50))
216 if (!putship(ship.shp_uid, &ship))
220 farg = (float)atof(ptr);
221 if ((err = dounit(thing[0], arg, ptr, farg, &land))
224 if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50))
226 if (!putland(land.lnd_uid, &land))
230 if ((err = doplane(thing[0], arg, ptr, &plane))
233 if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))
235 if (!putplane(plane.pln_uid, &plane))
248 benefit(natid who, int good)
255 nreport(player->cnum, N_AIDS, who, 1);
258 nreport(player->cnum, N_HURTS, who, 1);
263 noise(struct sctstr *sptr, int public_amt, s_char *name, int old, int new)
267 pr("%s of %s changed from %d to %d\n",
268 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
270 (void)sprintf(p, "changed from %d to %d", old, new);
272 (void)sprintf(p, "%s", (old < new ? "increased" : "decreased"));
274 wu(player->cnum, sptr->sct_own,
275 "%s in %s was %s by an act of %s\n",
276 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
277 p, cname(player->cnum));
278 benefit(sptr->sct_own, (old < new));
282 prsect(struct sctstr *sect)
284 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
285 pr("Distribution sector <D>: %s\n",
286 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
287 pr("Designation <s>: %c\t New designation <S>: %c\n",
288 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
289 pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
290 pr(" o O e m i g f c u w l x X p t F a\n");
291 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
292 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
293 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
294 sect->sct_uran, sect->sct_work, sect->sct_loyal,
295 sect->sct_che, sect->sct_che_target,
296 sect->sct_pstage, sect->sct_ptime,
297 sect->sct_fallout, sect->sct_avail);
299 pr("Mines <M>: %d\t", sect->sct_mines);
300 pr("Coastal <C>: %d\n", sect->sct_coastal);
301 pr("Road %% <R>: %d\t", sect->sct_road);
302 pr("Rail %% <r>: %d\t", sect->sct_rail);
303 pr("Defense %% <d>: %d\n", sect->sct_defense);
313 if ((np = getnatp(n)) == 0)
315 pr("Country #: %2d\n", n);
316 pr("Name <n>: %-20s\t", np->nat_cnam);
317 pr("Connected: %d\n", np->nat_connected);
318 pr("Representative <r>: %-20s\n", np->nat_pnam);
319 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
320 pr("Reserves <m>: %5ld\n", np->nat_reserve);
321 pr("Capital <c>: %s\t\t",
322 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
323 pr("Origin <o>: %3s\n",
324 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
325 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
326 pr("Min Used <u>: %3d\n", np->nat_minused);
327 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
328 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
329 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
330 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
331 pr("Money <M>: $%6ld\n", np->nat_money);
332 pr("Telegrams <t>: %6d\n", np->nat_tgms);
333 if (opt_DEMANDUPDATE)
334 pr("Updates missed <U>: %d\n", np->nat_missed);
336 pr("Countries contacted: ");
337 for (i = 0; i < MAXNOC; i++) {
338 if (getcontact(np, i))
339 pr("%d(%d) ", i, getcontact(np, i));
346 pr_plane(struct plnstr *plane)
348 pr("UID <U>: %d\t\t", (int)plane->pln_uid);
349 pr("Owner <O>: %d\t\t", (int)plane->pln_own);
350 pr("Location <l>: %s\n",
351 xyas(plane->pln_x, plane->pln_y, player->cnum));
352 pr("Efficiency <e>: %d\t", (int)plane->pln_effic);
353 pr("Mobility <m>: %d\n", (int)plane->pln_mobil);
354 pr("Tech <t>: %d\t\t", plane->pln_tech);
355 pr("Wing <w>: %c\n", plane->pln_wing);
356 pr("Attack <a>: %d\t\t", plane->pln_att);
357 pr("Defense <d>: %d\n", plane->pln_def);
358 pr("Range <r>: %d\t\t", plane->pln_range);
359 pr("Flags <f>: %d\n", plane->pln_flags);
360 pr("Ship <s>: %d\t\t", plane->pln_ship);
361 pr("Land Unit <y>: %d\t", plane->pln_land);
362 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
366 pr_land(struct lndstr *land)
368 pr("UID <U>: %d\n", (int)land->lnd_uid);
369 pr("Owner <O>: %d\n", (int)land->lnd_own);
370 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
371 pr("Efficiency <e>: %d\t", (int)land->lnd_effic);
372 pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
373 pr("Tech <t>: %d\t\t", land->lnd_tech);
374 pr("Army <a>: %c\n", land->lnd_army);
375 pr("Fortification <F>: %d\t", land->lnd_harden);
376 pr("Fuel <B>: %d\n", land->lnd_fuel);
377 count_land_planes(land);
378 pr("Xlight planes <X>: %d\n", land->lnd_nxlight);
379 pr("Land unit <Y>: %d\n", land->lnd_land);
380 pr("Ship <S>: %d\t\t", land->lnd_ship);
381 pr("Radius <P>: %d\n", land->lnd_rad_max);
382 pr("Retreat percentage <Z>: %d\n", (int)land->lnd_retreat);
383 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
384 land->lnd_rpath, (int)land->lnd_rflags);
385 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
386 pr(" c m u f s g p i d o l h r\n");
387 pr("%3d", land->lnd_item[I_CIVIL]);
388 pr("%4d", land->lnd_item[I_MILIT]);
389 pr("%4d", land->lnd_item[I_UW]);
390 pr("%5d", land->lnd_item[I_FOOD]);
391 pr("%4d", land->lnd_item[I_SHELL]);
392 pr("%4d", land->lnd_item[I_GUN]);
393 pr("%5d", land->lnd_item[I_PETROL]);
394 pr("%5d", land->lnd_item[I_IRON]);
395 pr("%5d", land->lnd_item[I_DUST]);
396 pr("%5d", land->lnd_item[I_OIL]);
397 pr("%5d", land->lnd_item[I_LCM]);
398 pr("%5d", land->lnd_item[I_HCM]);
399 pr("%4d", land->lnd_item[I_RAD]);
404 pr_ship(struct shpstr *ship)
408 if ((natp = getnatp(ship->shp_own)) == 0)
410 pr("%s (#%d) %s\n", natp->nat_cnam, (int)ship->shp_own, prship(ship));
411 pr("UID <U>: %d\n", (int)ship->shp_uid);
412 pr("Owner <O>: %d\t\t\t", (int)ship->shp_own);
413 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
414 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
415 pr("Efficiency <E>: %d\n", (int)ship->shp_effic);
416 pr("Mobility <M>: %d\t\t", (int)ship->shp_mobil);
417 pr("Fleet <F>: %c\n", ship->shp_fleet);
419 pr("Xlight planes <X>: %d\t\t", (int)ship->shp_nxlight);
420 pr("Planes <P>: %d\n", (int)ship->shp_nplane);
421 pr("Helos <H>: %d\t\t\t", (int)ship->shp_nchoppers);
423 pr("Units <Y>: %d\n", (int)ship->shp_nland);
424 /* could depend on opt_FUEL - but a deity might want to set this
425 up before enabling the option */
426 pr("Fuel <B>: %d\t\t\t", (int)ship->shp_fuel);
427 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
428 ship->shp_rpath, (int)ship->shp_rflags);
429 pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
430 pr("Plague Time <b>: %d\n", ship->shp_ptime);
431 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
432 pr(" c m u f s g p i d o l h r\n");
433 pr("%3d", ship->shp_item[I_CIVIL]);
434 pr("%4d", ship->shp_item[I_MILIT]);
435 pr("%4d", ship->shp_item[I_UW]);
436 pr("%5d", ship->shp_item[I_FOOD]);
437 pr("%4d", ship->shp_item[I_SHELL]);
438 pr("%4d", ship->shp_item[I_GUN]);
439 pr("%5d", ship->shp_item[I_PETROL]);
440 pr("%5d", ship->shp_item[I_IRON]);
441 pr("%5d", ship->shp_item[I_DUST]);
442 pr("%5d", ship->shp_item[I_OIL]);
443 pr("%5d", ship->shp_item[I_LCM]);
444 pr("%5d", ship->shp_item[I_HCM]);
445 pr("%4d", ship->shp_item[I_RAD]);
450 errcheck(int num, int min, int max)
460 getin(s_char **what, s_char **p, int *arg, s_char *buf)
462 if (!(*what = getstarg(*p, "%c xxxxx -- thing value : ", buf))) {
467 while (**what && isspace(**what))
471 for (*p = *what; **p && !isspace(**p); (*p)++) /* skip non spaces */
473 while (**p && isspace(**p))
482 warn_deprecated(char key)
484 pr("Key <%c> is deprecated and will go away in a future release\n", key);
488 doland(s_char op, int arg, s_char *p, struct sctstr *sect)
490 natid newown, oldown;
498 sect->sct_coastal = (arg ? 1 : 0);
499 pr("Coastal flag of %s changed to %d\n",
500 xyas(sect->sct_x, sect->sct_y, player->cnum),
506 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
507 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
508 xyas(sect->sct_x, sect->sct_y, player->cnum),
509 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
511 makelost(EF_SECTOR, sect->sct_own, 0, sect->sct_x,
513 wu(player->cnum, sect->sct_own,
514 "Sector %s lost to deity intervention\n", xyas(sect->sct_x,
519 benefit(sect->sct_own, 0);
520 sect->sct_own = newown;
522 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
523 wu(player->cnum, newown,
524 "Sector %s gained from deity intervention\n",
525 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
532 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
533 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
534 xyas(sect->sct_x, sect->sct_y, player->cnum),
535 cname(sect->sct_oldown),
536 sect->sct_oldown, cname(oldown), oldown);
537 sect->sct_oldown = oldown;
540 new = errcheck(arg, 0, 100);
541 noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
542 sect->sct_effic = (u_char)new;
545 new = errcheck(arg, -127, 255);
546 noise(sect, 1, "Mobility", (int)sect->sct_mobil, new);
547 sect->sct_mobil = new;
550 new = errcheck(arg, 0, 127);
551 noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
552 sect->sct_min = (u_char)new;
555 new = errcheck(arg, 0, 127);
556 noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
557 sect->sct_gmin = (u_char)new;
560 new = errcheck(arg, 0, 127);
561 noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
562 sect->sct_fertil = (u_char)new;
565 new = errcheck(arg, 0, 127);
566 noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
567 sect->sct_oil = (u_char)new;
570 new = errcheck(arg, 0, 127);
571 noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
572 sect->sct_uran = (u_char)new;
575 new = errcheck(arg, 0, 100);
576 noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
577 sect->sct_work = (u_char)new;
580 new = errcheck(arg, 0, 127);
581 pr("Loyalty of %s changed from %d to %d%%\n",
582 xyas(sect->sct_x, sect->sct_y, player->cnum),
583 sect->sct_loyal, new);
584 sect->sct_loyal = (u_char)new;
588 new = errcheck(arg, 0, CHE_MAX);
589 pr("Guerillas in %s changed from %d to %d\n",
590 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
594 old = sect->sct_che_target;
595 new = errcheck(arg, 0, MAXNOC - 1);
596 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
597 xyas(sect->sct_x, sect->sct_y, player->cnum),
598 cname(old), old, cname(new), new);
599 sect->sct_che_target = new;
602 old = sect->sct_pstage;
603 new = errcheck(arg, 0, PLG_EXPOSED);
604 pr("Plague stage of %s changed from %d to %d%%\n",
605 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
606 sect->sct_pstage = new;
609 old = sect->sct_ptime;
610 new = errcheck(arg, 0, 255);
611 pr("Plague time of %s changed from %d to %d%%\n",
612 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
613 sect->sct_ptime = new;
616 old = sect->sct_fallout;
617 new = errcheck(arg, 0, FALLOUT_MAX);
618 pr("Fallout for sector %s changed from %d to %d\n",
619 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
620 sect->sct_fallout = new;
623 new = errcheck(arg, 0, 9999);
624 noise(sect, 1, "Available workforce", (int)sect->sct_avail, new);
625 sect->sct_avail = new;
628 new = errcheck(arg, 0, MINES_MAX);
629 sect->sct_mines = new;
630 pr("Mines changed to %d\n", new);
633 if (!sarg_xy(p, &newx, &newy))
639 if (!sarg_xy(p, &newx, &newy))
641 pr("Distribtion Location for sector %s changed from %s to %s\n",
642 xyas(sect->sct_x, sect->sct_y, player->cnum),
643 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
644 xyas(newx, newy, player->cnum));
645 sect->sct_dist_x = newx;
646 sect->sct_dist_y = newy;
649 des = sct_typematch(p);
652 pr("Designation for sector %s changed from %c to %c\n",
653 xyas(sect->sct_x, sect->sct_y, player->cnum),
654 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
655 sect->sct_type = des;
658 des = sct_typematch(p);
661 pr("New Designation for sector %s changed from %c to %c\n",
662 xyas(sect->sct_x, sect->sct_y, player->cnum),
663 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
664 sect->sct_newtype = des;
671 noise(sect, 1, "Road percentage", (int)sect->sct_road, arg);
672 sect->sct_road = arg;
679 noise(sect, 1, "Rail percentage", (int)sect->sct_rail, arg);
680 sect->sct_rail = arg;
687 noise(sect, 1, "Defense percentage", (int)sect->sct_defense, arg);
688 sect->sct_defense = arg;
691 pr("huh? (%c)\n", op);
699 docountry(s_char op, int arg, s_char *p, float farg, natid nat,
705 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
706 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
709 pr("Country representative changed from %s to %s\n",
711 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
717 arg = errcheck(arg, 0, 1024);
718 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
722 benefit(nat, np->nat_reserve < arg);
723 pr("Military Reserves changed from %ld to %d\n",
724 np->nat_reserve, arg);
725 if (np->nat_stat == STAT_NORM)
726 wu(player->cnum, nat,
727 "Military Reserves changed from %ld to %d by divine intervention.\n",
728 np->nat_reserve, arg);
729 np->nat_reserve = arg;
732 if (!sarg_xy(p, &newx, &newy))
734 pr("Capital coordinates changed from %s to %s\n",
735 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
736 xyas(newx, newy, player->cnum));
741 if (!sarg_xy(p, &newx, &newy))
743 pr("Origin coordinates changed from %s to %s\n",
744 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
745 xyas(newx, newy, player->cnum));
750 np->nat_stat = (s_char)errcheck(arg, 0, STAT_NEW);
753 arg = errcheck(arg, 0, m_m_p_d);
754 pr("Number of minutes used changed from %d to %d.\n",
755 np->nat_minused, arg);
756 np->nat_minused = arg;
759 pr("Money changed from %ld to %d\n", np->nat_money, arg);
760 wu(player->cnum, nat,
761 "Money changed from %ld to %d by divine intervention.\n",
766 pr("Tech changed from %.2f to %.2f.\n",
767 np->nat_level[NAT_TLEV], farg);
768 np->nat_level[NAT_TLEV] = farg;
771 pr("Research changed from %.2f to %.2f.\n",
772 np->nat_level[NAT_RLEV], farg);
773 np->nat_level[NAT_RLEV] = farg;
776 pr("Education changed from %.2f to %.2f.\n",
777 np->nat_level[NAT_ELEV], farg);
778 np->nat_level[NAT_ELEV] = farg;
781 pr("Happiness changed from %.2f to %.2f.\n",
782 np->nat_level[NAT_HLEV], farg);
783 np->nat_level[NAT_HLEV] = farg;
786 np->nat_missed = arg;
789 pr("huh? (%c)\n", op);
798 doship(s_char op, int arg, s_char *p, struct shpstr *ship)
805 ship->shp_pstage = arg;
808 ship->shp_ptime = arg;
811 memcpy(ship->shp_rpath, p, sizeof(ship->shp_rpath));
814 ship->shp_rflags = arg;
817 ship->shp_nchoppers = arg;
820 ship->shp_nxlight = arg;
827 wu(player->cnum, ship->shp_own,
828 "%s taken from you by deity intervention!\n", prship(ship));
829 if (arg && arg < MAXNOC) {
830 wu(player->cnum, (natid)arg,
831 "%s given to you by deity intervention!\n", prship(ship));
832 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
834 ship->shp_own = (natid)arg;
835 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
839 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
841 ship->shp_own = (natid)0;
845 if (!sarg_xy(p, &newx, &newy))
853 mchr[(int)ship->shp_type].m_tech, SHRT_MAX));
856 ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
859 ship->shp_mobil = arg;
862 ship->shp_fuel = errcheck(arg, 0, 255);
866 ship->shp_fleet = ' ';
867 else if (isalpha(p[0]))
868 ship->shp_fleet = p[0];
870 pr("%c: invalid fleet\n", p[0]);
875 ship->shp_nland = errcheck(arg, 0, 100);
878 ship->shp_nplane = errcheck(arg, 0, 100);
881 ship->shp_item[I_CIVIL] = arg;
884 ship->shp_item[I_MILIT] = arg;
887 ship->shp_item[I_UW] = arg;
890 ship->shp_item[I_FOOD] = arg;
893 ship->shp_item[I_SHELL] = arg;
896 ship->shp_item[I_GUN] = arg;
899 ship->shp_item[I_PETROL] = arg;
902 ship->shp_item[I_IRON] = arg;
905 ship->shp_item[I_DUST] = arg;
908 ship->shp_item[I_OIL] = arg;
911 ship->shp_item[I_LCM] = arg;
914 ship->shp_item[I_HCM] = arg;
917 ship->shp_item[I_RAD] = arg;
921 ship->shp_armor = errcheck(arg, 0, SHRT_MAX);
924 pr("huh? (%c)\n", op);
931 dounit(s_char op, int arg, s_char *p, float farg, struct lndstr *land)
938 land->lnd_land = arg;
945 wu(player->cnum, land->lnd_own,
946 "%s taken from you by deity intervention!\n", prland(land));
948 if (arg && arg < MAXNOC) {
949 wu(player->cnum, (natid)arg,
950 "%s given to you by deity intervention!\n", prland(land));
951 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
953 land->lnd_own = (natid)arg;
954 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
957 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
960 land->lnd_own = (natid)0;
964 if (!sarg_xy(p, &newx, &newy))
970 land->lnd_effic = errcheck(arg, LAND_MINEFF, 100);
973 land->lnd_mobil = arg;
978 lchr[(int)land->lnd_type].l_tech, SHRT_MAX));
982 land->lnd_army = ' ';
983 else if (isalpha(p[0]))
984 land->lnd_army = p[0];
986 pr("%c: invalid army\n", p[0]);
991 land->lnd_harden = errcheck(arg, 0, 255);
994 land->lnd_fuel = errcheck(arg, 0, 255);
997 land->lnd_nxlight = arg;
1000 land->lnd_ship = arg;
1003 land->lnd_rad_max = arg;
1006 land->lnd_retreat = arg;
1009 memcpy(land->lnd_rpath, p, sizeof(land->lnd_rpath));
1012 land->lnd_rflags = arg;
1015 land->lnd_item[I_CIVIL] = arg;
1018 land->lnd_item[I_MILIT] = arg;
1021 land->lnd_item[I_UW] = arg;
1024 land->lnd_item[I_FOOD] = arg;
1027 land->lnd_item[I_SHELL] = arg;
1030 land->lnd_item[I_GUN] = arg;
1033 land->lnd_item[I_PETROL] = arg;
1036 land->lnd_item[I_IRON] = arg;
1039 land->lnd_item[I_DUST] = arg;
1042 land->lnd_item[I_OIL] = arg;
1045 land->lnd_item[I_LCM] = arg;
1048 land->lnd_item[I_HCM] = arg;
1051 land->lnd_item[I_RAD] = arg;
1054 warn_deprecated(op);
1055 pr("Attack changed from %1.2f to %1.2f.\n",
1056 land->lnd_att, farg);
1057 land->lnd_att = farg;
1060 warn_deprecated(op);
1061 pr("Defense changed from %1.2f to %1.2f.\n",
1062 land->lnd_def, farg);
1063 land->lnd_def = farg;
1066 pr("huh? (%c)\n", op);
1074 doplane(s_char op, int arg, s_char *p, struct plnstr *plane)
1080 plane->pln_nuketype = arg;
1083 plane->pln_uid = arg;
1086 if (!sarg_xy(p, &newx, &newy))
1088 plane->pln_x = newx;
1089 plane->pln_y = newy;
1093 wu(player->cnum, plane->pln_own,
1094 "%s taken from you by deity intervention!\n",
1096 if (arg && arg < MAXNOC) {
1097 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1098 plane->pln_x, plane->pln_y);
1099 plane->pln_own = (natid)arg;
1100 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1101 plane->pln_x, plane->pln_y);
1102 wu(player->cnum, plane->pln_own,
1103 "%s given to you by deity intervention!\n", prplane(plane));
1105 plane->pln_effic = 0;
1106 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1107 plane->pln_x, plane->pln_y);
1108 plane->pln_own = (natid)0;
1112 plane->pln_effic = errcheck(arg, PLANE_MINEFF, 100);
1115 plane->pln_mobil = errcheck(arg, -127, 255);
1120 plchr[(int)plane->pln_type].pl_tech, SHRT_MAX));
1124 plane->pln_wing = ' ';
1125 else if (isalpha(p[0]))
1126 plane->pln_wing = p[0];
1128 pr("%c: invalid wing\n", p[0]);
1133 plane->pln_att = (s_char)errcheck(arg, 0, 127);
1136 plane->pln_def = (s_char)arg;
1139 plane->pln_range = (u_char)arg;
1142 plane->pln_ship = arg;
1145 plane->pln_land = arg;
1148 plane->pln_flags = arg;
1151 pr("huh? (%c)\n", op);