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 * 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
61 static void benefit(natid, int);
62 static int docountry(char, int, char *, float, struct natstr *);
63 static int doland(char, int, char *, struct sctstr *);
64 static int doplane(char, int, char *, struct plnstr *);
65 static int doship(char, int, char *, struct shpstr *);
66 static int dounit(char, int, char *, float, struct lndstr *);
67 static int getin(char **, char **, int *, char *);
68 static void noise(struct sctstr *, int, char *, int, int);
69 static void pr_land(struct lndstr *);
70 static void pr_plane(struct plnstr *);
71 static void pr_ship(struct shpstr *);
72 static void prnat(struct natstr *);
73 static void prsect(struct sctstr *);
96 if ((what = getstarg(player->argp[1],
97 "Edit What (country, land, ship, plane, nuke, unit)? ",
103 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
105 if (!sarg_xy(ptr, &x, &y))
107 if (!getsect(x, y, §))
111 if (!(ptr = getstarg(player->argp[2], "Country number? ", buf)))
114 np = getnatp(atoi(ptr));
116 np = natargp(ptr, NULL);
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, 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, 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);
308 prnat(struct natstr *np)
312 pr("Country #: %2d\n", np->nat_cnum);
313 pr("Name <n>: %-20s\t", np->nat_cnam);
314 pr("Representative <r>: %-20s\n", np->nat_pnam);
315 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
316 pr("Reserves <m>: %5ld\n", np->nat_reserve);
317 pr("Capital <c>: %s\t\t",
318 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
319 pr("Origin <o>: %3s\n",
320 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
321 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
322 pr("Min Used <u>: %3d\n", np->nat_minused);
323 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
324 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
325 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
326 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
327 pr("Money <M>: $%6ld\n", np->nat_money);
328 pr("Telegrams <t>: %6d\n", np->nat_tgms);
329 if (opt_DEMANDUPDATE)
330 pr("Updates missed <U>: %d\n", np->nat_missed);
332 pr("Countries contacted: ");
333 for (i = 0; i < MAXNOC; i++) {
334 if (getcontact(np, i))
335 pr("%d(%d) ", i, getcontact(np, i));
342 pr_plane(struct plnstr *plane)
344 pr("UID <U>: %d\t\t", (int)plane->pln_uid);
345 pr("Owner <O>: %d\t\t", (int)plane->pln_own);
346 pr("Location <l>: %s\n",
347 xyas(plane->pln_x, plane->pln_y, player->cnum));
348 pr("Efficiency <e>: %d\t", (int)plane->pln_effic);
349 pr("Mobility <m>: %d\n", (int)plane->pln_mobil);
350 pr("Tech <t>: %d\t\t", plane->pln_tech);
351 pr("Wing <w>: %c\n", plane->pln_wing);
352 pr("Attack <a>: %d\t\t", plane->pln_att);
353 pr("Defense <d>: %d\n", plane->pln_def);
354 pr("Range <r>: %d\t\t", plane->pln_range);
355 pr("Flags <f>: %d\n", plane->pln_flags);
356 pr("Ship <s>: %d\t\t", plane->pln_ship);
357 pr("Land Unit <y>: %d\t", plane->pln_land);
358 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
362 pr_land(struct lndstr *land)
364 pr("UID <U>: %d\n", (int)land->lnd_uid);
365 pr("Owner <O>: %d\n", (int)land->lnd_own);
366 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
367 pr("Efficiency <e>: %d\t", (int)land->lnd_effic);
368 pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
369 pr("Tech <t>: %d\t\t", land->lnd_tech);
370 pr("Army <a>: %c\n", land->lnd_army);
371 pr("Fortification <F>: %d\t", land->lnd_harden);
372 pr("Fuel <B>: %d\n", land->lnd_fuel);
373 count_land_planes(land);
374 pr("Xlight planes <X>: %d\n", land->lnd_nxlight);
375 pr("Land unit <Y>: %d\n", land->lnd_land);
376 pr("Ship <S>: %d\t\t", land->lnd_ship);
377 pr("Radius <P>: %d\n", land->lnd_rad_max);
378 pr("Retreat percentage <Z>: %d\n", (int)land->lnd_retreat);
379 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
380 land->lnd_rpath, (int)land->lnd_rflags);
381 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
382 pr(" c m u f s g p i d o l h r\n");
383 pr("%3d", land->lnd_item[I_CIVIL]);
384 pr("%4d", land->lnd_item[I_MILIT]);
385 pr("%4d", land->lnd_item[I_UW]);
386 pr("%5d", land->lnd_item[I_FOOD]);
387 pr("%4d", land->lnd_item[I_SHELL]);
388 pr("%4d", land->lnd_item[I_GUN]);
389 pr("%5d", land->lnd_item[I_PETROL]);
390 pr("%5d", land->lnd_item[I_IRON]);
391 pr("%5d", land->lnd_item[I_DUST]);
392 pr("%5d", land->lnd_item[I_OIL]);
393 pr("%5d", land->lnd_item[I_LCM]);
394 pr("%5d", land->lnd_item[I_HCM]);
395 pr("%4d", land->lnd_item[I_RAD]);
400 pr_ship(struct shpstr *ship)
404 if ((natp = getnatp(ship->shp_own)) == 0)
406 pr("%s (#%d) %s\n", natp->nat_cnam, (int)ship->shp_own, prship(ship));
407 pr("UID <U>: %d\n", (int)ship->shp_uid);
408 pr("Owner <O>: %d\t\t\t", (int)ship->shp_own);
409 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
410 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
411 pr("Efficiency <E>: %d\n", (int)ship->shp_effic);
412 pr("Mobility <M>: %d\t\t", (int)ship->shp_mobil);
413 pr("Fleet <F>: %c\n", ship->shp_fleet);
415 pr("Xlight planes <X>: %d\t\t", (int)ship->shp_nxlight);
416 pr("Planes <P>: %d\n", (int)ship->shp_nplane);
417 pr("Helos <H>: %d\t\t\t", (int)ship->shp_nchoppers);
419 pr("Units <Y>: %d\n", (int)ship->shp_nland);
420 /* could depend on opt_FUEL - but a deity might want to set this
421 up before enabling the option */
422 pr("Fuel <B>: %d\t\t\t", (int)ship->shp_fuel);
423 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
424 ship->shp_rpath, (int)ship->shp_rflags);
425 pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
426 pr("Plague Time <b>: %d\n", ship->shp_ptime);
427 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
428 pr(" c m u f s g p i d o l h r\n");
429 pr("%3d", ship->shp_item[I_CIVIL]);
430 pr("%4d", ship->shp_item[I_MILIT]);
431 pr("%4d", ship->shp_item[I_UW]);
432 pr("%5d", ship->shp_item[I_FOOD]);
433 pr("%4d", ship->shp_item[I_SHELL]);
434 pr("%4d", ship->shp_item[I_GUN]);
435 pr("%5d", ship->shp_item[I_PETROL]);
436 pr("%5d", ship->shp_item[I_IRON]);
437 pr("%5d", ship->shp_item[I_DUST]);
438 pr("%5d", ship->shp_item[I_OIL]);
439 pr("%5d", ship->shp_item[I_LCM]);
440 pr("%5d", ship->shp_item[I_HCM]);
441 pr("%4d", ship->shp_item[I_RAD]);
446 errcheck(int num, int min, int max)
456 getin(char **what, char **p, int *arg, char *buf)
458 if (!(*what = getstarg(*p, "%c xxxxx -- thing value : ", buf))) {
463 while (**what && isspace(**what))
467 for (*p = *what; **p && !isspace(**p); (*p)++) /* skip non spaces */
469 while (**p && isspace(**p))
478 warn_deprecated(char key)
480 pr("Key <%c> is deprecated and will go away in a future release\n", key);
484 doland(char op, int arg, char *p, struct sctstr *sect)
486 natid newown, oldown;
494 sect->sct_coastal = (arg ? 1 : 0);
495 pr("Coastal flag of %s changed to %d\n",
496 xyas(sect->sct_x, sect->sct_y, player->cnum),
502 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
503 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
504 xyas(sect->sct_x, sect->sct_y, player->cnum),
505 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
507 makelost(EF_SECTOR, sect->sct_own, 0, sect->sct_x,
509 wu(player->cnum, sect->sct_own,
510 "Sector %s lost to deity intervention\n", xyas(sect->sct_x,
515 benefit(sect->sct_own, 0);
516 sect->sct_own = newown;
518 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
519 wu(player->cnum, newown,
520 "Sector %s gained from deity intervention\n",
521 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
528 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
529 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
530 xyas(sect->sct_x, sect->sct_y, player->cnum),
531 cname(sect->sct_oldown),
532 sect->sct_oldown, cname(oldown), oldown);
533 sect->sct_oldown = oldown;
536 new = errcheck(arg, 0, 100);
537 noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
538 sect->sct_effic = (unsigned char)new;
541 new = errcheck(arg, -127, 255);
542 noise(sect, 1, "Mobility", (int)sect->sct_mobil, new);
543 sect->sct_mobil = new;
546 new = errcheck(arg, 0, 127);
547 noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
548 sect->sct_min = (unsigned char)new;
551 new = errcheck(arg, 0, 127);
552 noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
553 sect->sct_gmin = (unsigned char)new;
556 new = errcheck(arg, 0, 127);
557 noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
558 sect->sct_fertil = (unsigned char)new;
561 new = errcheck(arg, 0, 127);
562 noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
563 sect->sct_oil = (unsigned char)new;
566 new = errcheck(arg, 0, 127);
567 noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
568 sect->sct_uran = (unsigned char)new;
571 new = errcheck(arg, 0, 100);
572 noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
573 sect->sct_work = (unsigned char)new;
576 new = errcheck(arg, 0, 127);
577 pr("Loyalty of %s changed from %d to %d%%\n",
578 xyas(sect->sct_x, sect->sct_y, player->cnum),
579 sect->sct_loyal, new);
580 sect->sct_loyal = (unsigned char)new;
584 new = errcheck(arg, 0, CHE_MAX);
585 pr("Guerillas in %s changed from %d to %d\n",
586 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
590 old = sect->sct_che_target;
591 new = errcheck(arg, 0, MAXNOC - 1);
592 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
593 xyas(sect->sct_x, sect->sct_y, player->cnum),
594 cname(old), old, cname(new), new);
595 sect->sct_che_target = new;
598 old = sect->sct_pstage;
599 new = errcheck(arg, 0, PLG_EXPOSED);
600 pr("Plague stage of %s changed from %d to %d%%\n",
601 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
602 sect->sct_pstage = new;
605 old = sect->sct_ptime;
606 new = errcheck(arg, 0, 255);
607 pr("Plague time of %s changed from %d to %d%%\n",
608 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
609 sect->sct_ptime = new;
612 old = sect->sct_fallout;
613 new = errcheck(arg, 0, FALLOUT_MAX);
614 pr("Fallout for sector %s changed from %d to %d\n",
615 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
616 sect->sct_fallout = new;
619 new = errcheck(arg, 0, 9999);
620 noise(sect, 1, "Available workforce", (int)sect->sct_avail, new);
621 sect->sct_avail = new;
624 new = errcheck(arg, 0, MINES_MAX);
625 sect->sct_mines = new;
626 pr("Mines changed to %d\n", new);
629 if (!sarg_xy(p, &newx, &newy))
635 if (!sarg_xy(p, &newx, &newy))
637 pr("Distribtion Location for sector %s changed from %s to %s\n",
638 xyas(sect->sct_x, sect->sct_y, player->cnum),
639 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
640 xyas(newx, newy, player->cnum));
641 sect->sct_dist_x = newx;
642 sect->sct_dist_y = newy;
645 des = sct_typematch(p);
648 pr("Designation for sector %s changed from %c to %c\n",
649 xyas(sect->sct_x, sect->sct_y, player->cnum),
650 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
651 set_coastal(sect, des);
652 sect->sct_type = des;
655 des = sct_typematch(p);
658 pr("New Designation for sector %s changed from %c to %c\n",
659 xyas(sect->sct_x, sect->sct_y, player->cnum),
660 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
661 sect->sct_newtype = des;
668 noise(sect, 1, "Road percentage", (int)sect->sct_road, arg);
669 sect->sct_road = arg;
676 noise(sect, 1, "Rail percentage", (int)sect->sct_rail, arg);
677 sect->sct_rail = arg;
684 noise(sect, 1, "Defense percentage", (int)sect->sct_defense, arg);
685 sect->sct_defense = arg;
688 pr("huh? (%c)\n", op);
696 docountry(char op, int arg, char *p, float farg, struct natstr *np)
699 natid nat = np->nat_cnum;
703 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
704 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
707 pr("Country representative changed from %s to %s\n",
709 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
715 arg = errcheck(arg, 0, 1024);
716 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
720 benefit(nat, np->nat_reserve < arg);
721 pr("Military Reserves changed from %ld to %d\n",
722 np->nat_reserve, arg);
723 wu(player->cnum, nat,
724 "Military Reserves changed from %ld to %d by divine intervention.\n",
725 np->nat_reserve, arg);
726 np->nat_reserve = arg;
729 if (!sarg_xy(p, &newx, &newy))
731 pr("Capital coordinates changed from %s to %s\n",
732 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
733 xyas(newx, newy, player->cnum));
738 if (!sarg_xy(p, &newx, &newy))
740 pr("Origin coordinates changed from %s to %s\n",
741 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
742 xyas(newx, newy, player->cnum));
747 np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
750 arg = errcheck(arg, 0, m_m_p_d);
751 pr("Number of minutes used changed from %d to %d.\n",
752 np->nat_minused, arg);
753 np->nat_minused = arg;
756 pr("Money changed from %ld to %d\n", np->nat_money, arg);
757 wu(player->cnum, nat,
758 "Money changed from %ld to %d by divine intervention.\n",
763 pr("Tech changed from %.2f to %.2f.\n",
764 np->nat_level[NAT_TLEV], farg);
765 np->nat_level[NAT_TLEV] = farg;
768 pr("Research changed from %.2f to %.2f.\n",
769 np->nat_level[NAT_RLEV], farg);
770 np->nat_level[NAT_RLEV] = farg;
773 pr("Education changed from %.2f to %.2f.\n",
774 np->nat_level[NAT_ELEV], farg);
775 np->nat_level[NAT_ELEV] = farg;
778 pr("Happiness changed from %.2f to %.2f.\n",
779 np->nat_level[NAT_HLEV], farg);
780 np->nat_level[NAT_HLEV] = farg;
783 np->nat_missed = arg;
786 pr("huh? (%c)\n", op);
795 doship(char op, int arg, char *p, struct shpstr *ship)
802 ship->shp_pstage = arg;
805 ship->shp_ptime = arg;
808 strncpy(ship->shp_rpath, p, sizeof(ship->shp_rpath) - 1);
811 ship->shp_rflags = arg;
814 ship->shp_nchoppers = arg;
817 ship->shp_nxlight = arg;
824 wu(player->cnum, ship->shp_own,
825 "%s taken from you by deity intervention!\n", prship(ship));
826 if (arg && arg < MAXNOC) {
827 wu(player->cnum, (natid)arg,
828 "%s given to you by deity intervention!\n", prship(ship));
829 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
831 ship->shp_own = (natid)arg;
832 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
836 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
838 ship->shp_own = (natid)0;
842 if (!sarg_xy(p, &newx, &newy))
850 mchr[(int)ship->shp_type].m_tech, SHRT_MAX));
853 ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
856 ship->shp_mobil = arg;
859 ship->shp_fuel = errcheck(arg, 0, 255);
863 ship->shp_fleet = ' ';
864 else if (isalpha(p[0]))
865 ship->shp_fleet = p[0];
867 pr("%c: invalid fleet\n", p[0]);
872 ship->shp_nland = errcheck(arg, 0, 100);
875 ship->shp_nplane = errcheck(arg, 0, 100);
878 ship->shp_item[I_CIVIL] = arg;
881 ship->shp_item[I_MILIT] = arg;
884 ship->shp_item[I_UW] = arg;
887 ship->shp_item[I_FOOD] = arg;
890 ship->shp_item[I_SHELL] = arg;
893 ship->shp_item[I_GUN] = arg;
896 ship->shp_item[I_PETROL] = arg;
899 ship->shp_item[I_IRON] = arg;
902 ship->shp_item[I_DUST] = arg;
905 ship->shp_item[I_OIL] = arg;
908 ship->shp_item[I_LCM] = arg;
911 ship->shp_item[I_HCM] = arg;
914 ship->shp_item[I_RAD] = arg;
918 ship->shp_armor = errcheck(arg, 0, SHRT_MAX);
921 pr("huh? (%c)\n", op);
928 dounit(char op, int arg, char *p, float farg, struct lndstr *land)
935 land->lnd_land = arg;
942 wu(player->cnum, land->lnd_own,
943 "%s taken from you by deity intervention!\n", prland(land));
945 if (arg && arg < MAXNOC) {
946 wu(player->cnum, (natid)arg,
947 "%s given to you by deity intervention!\n", prland(land));
948 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
950 land->lnd_own = (natid)arg;
951 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
954 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
957 land->lnd_own = (natid)0;
961 if (!sarg_xy(p, &newx, &newy))
967 land->lnd_effic = errcheck(arg, LAND_MINEFF, 100);
970 land->lnd_mobil = arg;
975 lchr[(int)land->lnd_type].l_tech, SHRT_MAX));
979 land->lnd_army = ' ';
980 else if (isalpha(p[0]))
981 land->lnd_army = p[0];
983 pr("%c: invalid army\n", p[0]);
988 land->lnd_harden = errcheck(arg, 0, 255);
991 land->lnd_fuel = errcheck(arg, 0, 255);
994 land->lnd_nxlight = arg;
997 land->lnd_ship = arg;
1000 land->lnd_rad_max = arg;
1003 land->lnd_retreat = arg;
1006 strncpy(land->lnd_rpath, p, sizeof(land->lnd_rpath) - 1);
1009 land->lnd_rflags = arg;
1012 land->lnd_item[I_CIVIL] = arg;
1015 land->lnd_item[I_MILIT] = arg;
1018 land->lnd_item[I_UW] = arg;
1021 land->lnd_item[I_FOOD] = arg;
1024 land->lnd_item[I_SHELL] = arg;
1027 land->lnd_item[I_GUN] = arg;
1030 land->lnd_item[I_PETROL] = arg;
1033 land->lnd_item[I_IRON] = arg;
1036 land->lnd_item[I_DUST] = arg;
1039 land->lnd_item[I_OIL] = arg;
1042 land->lnd_item[I_LCM] = arg;
1045 land->lnd_item[I_HCM] = arg;
1048 land->lnd_item[I_RAD] = arg;
1051 warn_deprecated(op);
1052 pr("Attack changed from %1.2f to %1.2f.\n",
1053 land->lnd_att, farg);
1054 land->lnd_att = farg;
1057 warn_deprecated(op);
1058 pr("Defense changed from %1.2f to %1.2f.\n",
1059 land->lnd_def, farg);
1060 land->lnd_def = farg;
1063 pr("huh? (%c)\n", op);
1071 doplane(char op, int arg, char *p, struct plnstr *plane)
1077 plane->pln_nuketype = arg;
1080 plane->pln_uid = arg;
1083 if (!sarg_xy(p, &newx, &newy))
1085 plane->pln_x = newx;
1086 plane->pln_y = newy;
1090 wu(player->cnum, plane->pln_own,
1091 "%s taken from you by deity intervention!\n",
1093 if (arg && arg < MAXNOC) {
1094 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1095 plane->pln_x, plane->pln_y);
1096 plane->pln_own = (natid)arg;
1097 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1098 plane->pln_x, plane->pln_y);
1099 wu(player->cnum, plane->pln_own,
1100 "%s given to you by deity intervention!\n", prplane(plane));
1102 plane->pln_effic = 0;
1103 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1104 plane->pln_x, plane->pln_y);
1105 plane->pln_own = (natid)0;
1109 plane->pln_effic = errcheck(arg, PLANE_MINEFF, 100);
1112 plane->pln_mobil = errcheck(arg, -127, 255);
1117 plchr[(int)plane->pln_type].pl_tech, SHRT_MAX));
1121 plane->pln_wing = ' ';
1122 else if (isalpha(p[0]))
1123 plane->pln_wing = p[0];
1125 pr("%c: invalid wing\n", p[0]);
1130 plane->pln_att = arg;
1133 plane->pln_def = arg;
1136 plane->pln_range = (unsigned char)arg;
1139 plane->pln_ship = arg;
1142 plane->pln_land = arg;
1145 plane->pln_flags = arg;
1148 pr("huh? (%c)\n", op);