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 **);
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) {
163 if (player->argp[arg_index] != 0) {
164 if (player->argp[arg_index+1] != 0) {
165 thing = player->argp[arg_index++][0];
166 ptr = player->argp[arg_index++];
170 } else if (arg_index == 3) {
171 err = getin(buf, &ptr);
201 farg = (float)atof(ptr);
202 if ((err = docountry(thing, arg, ptr, farg, np)) != RET_OK)
206 if ((err = doland(thing, arg, ptr, §)) != RET_OK)
212 if ((err = doship(thing, 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, arg, ptr, farg, &land)) != RET_OK)
223 if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50))
225 if (!putland(land.lnd_uid, &land))
229 if ((err = doplane(thing, arg, ptr, &plane)) != RET_OK)
231 if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))
233 if (!putplane(plane.pln_uid, &plane))
241 benefit(natid who, int good)
248 nreport(player->cnum, N_AIDS, who, 1);
251 nreport(player->cnum, N_HURTS, who, 1);
256 noise(struct sctstr *sptr, int public_amt, char *name, int old, int new)
260 pr("%s of %s changed from %d to %d\n",
261 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
263 (void)sprintf(p, "changed from %d to %d", old, new);
265 (void)sprintf(p, "%s", (old < new ? "increased" : "decreased"));
267 wu(player->cnum, sptr->sct_own,
268 "%s in %s was %s by an act of %s\n",
269 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
270 p, cname(player->cnum));
271 benefit(sptr->sct_own, (old < new));
275 prsect(struct sctstr *sect)
277 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
278 pr("Distribution sector <D>: %s\n",
279 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
280 pr("Designation <s>: %c\t New designation <S>: %c\n",
281 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
282 pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
283 pr(" o O e m i g f c u w l x X p t F a\n");
284 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
285 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
286 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
287 sect->sct_uran, sect->sct_work, sect->sct_loyal,
288 sect->sct_che, sect->sct_che_target,
289 sect->sct_pstage, sect->sct_ptime,
290 sect->sct_fallout, sect->sct_avail);
292 pr("Mines <M>: %d\t", sect->sct_mines);
293 pr("Coastal <C>: %d\n", sect->sct_coastal);
294 pr("Road %% <R>: %d\t", sect->sct_road);
295 pr("Rail %% <r>: %d\t", sect->sct_rail);
296 pr("Defense %% <d>: %d\n", sect->sct_defense);
301 prnat(struct natstr *np)
305 pr("Country #: %2d\n", np->nat_cnum);
306 pr("Name <n>: %-20s\t", np->nat_cnam);
307 pr("Representative <r>: %-20s\n", np->nat_pnam);
308 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
309 pr("Reserves <m>: %5ld\n", np->nat_reserve);
310 pr("Capital <c>: %s\t\t",
311 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
312 pr("Origin <o>: %3s\n",
313 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
314 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
315 pr("Min Used <u>: %3d\n", np->nat_minused);
316 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
317 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
318 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
319 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
320 pr("Money <M>: $%6ld\n", np->nat_money);
321 pr("Telegrams <t>: %6d\n", np->nat_tgms);
322 if (opt_DEMANDUPDATE)
323 pr("Updates missed <U>: %d\n", np->nat_missed);
325 pr("Countries contacted: ");
326 for (i = 0; i < MAXNOC; i++) {
327 if (getcontact(np, i))
328 pr("%d(%d) ", i, getcontact(np, i));
335 pr_plane(struct plnstr *plane)
337 pr("UID <U>: %d\t\t", (int)plane->pln_uid);
338 pr("Owner <O>: %d\t\t", (int)plane->pln_own);
339 pr("Location <l>: %s\n",
340 xyas(plane->pln_x, plane->pln_y, player->cnum));
341 pr("Efficiency <e>: %d\t", (int)plane->pln_effic);
342 pr("Mobility <m>: %d\n", (int)plane->pln_mobil);
343 pr("Tech <t>: %d\t\t", plane->pln_tech);
344 pr("Wing <w>: %c\n", plane->pln_wing);
345 pr("Attack <a>: %d\t\t", plane->pln_att);
346 pr("Defense <d>: %d\n", plane->pln_def);
347 pr("Range <r>: %d\t\t", plane->pln_range);
348 pr("Flags <f>: %d\n", plane->pln_flags);
349 pr("Ship <s>: %d\t\t", plane->pln_ship);
350 pr("Land Unit <y>: %d\t", plane->pln_land);
351 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
355 pr_land(struct lndstr *land)
357 pr("UID <U>: %d\n", (int)land->lnd_uid);
358 pr("Owner <O>: %d\n", (int)land->lnd_own);
359 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
360 pr("Efficiency <e>: %d\t", (int)land->lnd_effic);
361 pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
362 pr("Tech <t>: %d\t\t", land->lnd_tech);
363 pr("Army <a>: %c\n", land->lnd_army);
364 pr("Fortification <F>: %d\t", land->lnd_harden);
365 pr("Fuel <B>: %d\n", land->lnd_fuel);
366 count_land_planes(land);
367 pr("Xlight planes <X>: %d\n", land->lnd_nxlight);
368 pr("Land unit <Y>: %d\n", land->lnd_land);
369 pr("Ship <S>: %d\t\t", land->lnd_ship);
370 pr("Radius <P>: %d\n", land->lnd_rad_max);
371 pr("Retreat percentage <Z>: %d\n", (int)land->lnd_retreat);
372 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
373 land->lnd_rpath, (int)land->lnd_rflags);
374 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
375 pr(" c m u f s g p i d o l h r\n");
376 pr("%3d", land->lnd_item[I_CIVIL]);
377 pr("%4d", land->lnd_item[I_MILIT]);
378 pr("%4d", land->lnd_item[I_UW]);
379 pr("%5d", land->lnd_item[I_FOOD]);
380 pr("%4d", land->lnd_item[I_SHELL]);
381 pr("%4d", land->lnd_item[I_GUN]);
382 pr("%5d", land->lnd_item[I_PETROL]);
383 pr("%5d", land->lnd_item[I_IRON]);
384 pr("%5d", land->lnd_item[I_DUST]);
385 pr("%5d", land->lnd_item[I_OIL]);
386 pr("%5d", land->lnd_item[I_LCM]);
387 pr("%5d", land->lnd_item[I_HCM]);
388 pr("%4d", land->lnd_item[I_RAD]);
393 pr_ship(struct shpstr *ship)
397 if ((natp = getnatp(ship->shp_own)) == 0)
399 pr("%s (#%d) %s\n", natp->nat_cnam, (int)ship->shp_own, prship(ship));
400 pr("UID <U>: %d\n", (int)ship->shp_uid);
401 pr("Owner <O>: %d\t\t\t", (int)ship->shp_own);
402 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
403 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
404 pr("Efficiency <E>: %d\n", (int)ship->shp_effic);
405 pr("Mobility <M>: %d\t\t", (int)ship->shp_mobil);
406 pr("Fleet <F>: %c\n", ship->shp_fleet);
408 pr("Xlight planes <X>: %d\t\t", (int)ship->shp_nxlight);
409 pr("Planes <P>: %d\n", (int)ship->shp_nplane);
410 pr("Helos <H>: %d\t\t\t", (int)ship->shp_nchoppers);
412 pr("Units <Y>: %d\n", (int)ship->shp_nland);
413 /* could depend on opt_FUEL - but a deity might want to set this
414 up before enabling the option */
415 pr("Fuel <B>: %d\t\t\t", (int)ship->shp_fuel);
416 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
417 ship->shp_rpath, (int)ship->shp_rflags);
418 pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
419 pr("Plague Time <b>: %d\n", ship->shp_ptime);
420 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
421 pr(" c m u f s g p i d o l h r\n");
422 pr("%3d", ship->shp_item[I_CIVIL]);
423 pr("%4d", ship->shp_item[I_MILIT]);
424 pr("%4d", ship->shp_item[I_UW]);
425 pr("%5d", ship->shp_item[I_FOOD]);
426 pr("%4d", ship->shp_item[I_SHELL]);
427 pr("%4d", ship->shp_item[I_GUN]);
428 pr("%5d", ship->shp_item[I_PETROL]);
429 pr("%5d", ship->shp_item[I_IRON]);
430 pr("%5d", ship->shp_item[I_DUST]);
431 pr("%5d", ship->shp_item[I_OIL]);
432 pr("%5d", ship->shp_item[I_LCM]);
433 pr("%5d", ship->shp_item[I_HCM]);
434 pr("%4d", ship->shp_item[I_RAD]);
439 errcheck(int num, int min, int max)
449 getin(char *buf, char **valp)
454 p = getstarg(NULL, "%c xxxxx -- thing value : ", buf);
459 for (; isspace(*p); p++) ;
463 for (; *p && !isspace(*p); p++) ;
464 for (; isspace(*p); p++) ;
472 warn_deprecated(char key)
474 pr("Key <%c> is deprecated and will go away in a future release\n", key);
478 doland(char op, int arg, char *p, struct sctstr *sect)
480 natid newown, oldown;
488 sect->sct_coastal = (arg ? 1 : 0);
489 pr("Coastal flag of %s changed to %d\n",
490 xyas(sect->sct_x, sect->sct_y, player->cnum),
496 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
497 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
498 xyas(sect->sct_x, sect->sct_y, player->cnum),
499 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
501 makelost(EF_SECTOR, sect->sct_own, 0, sect->sct_x,
503 wu(player->cnum, sect->sct_own,
504 "Sector %s lost to deity intervention\n", xyas(sect->sct_x,
509 benefit(sect->sct_own, 0);
510 sect->sct_own = newown;
512 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
513 wu(player->cnum, newown,
514 "Sector %s gained from deity intervention\n",
515 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
522 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
523 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
524 xyas(sect->sct_x, sect->sct_y, player->cnum),
525 cname(sect->sct_oldown),
526 sect->sct_oldown, cname(oldown), oldown);
527 sect->sct_oldown = oldown;
530 new = errcheck(arg, 0, 100);
531 noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
532 sect->sct_effic = (unsigned char)new;
535 new = errcheck(arg, -127, 255);
536 noise(sect, 1, "Mobility", (int)sect->sct_mobil, new);
537 sect->sct_mobil = new;
540 new = errcheck(arg, 0, 127);
541 noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
542 sect->sct_min = (unsigned char)new;
545 new = errcheck(arg, 0, 127);
546 noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
547 sect->sct_gmin = (unsigned char)new;
550 new = errcheck(arg, 0, 127);
551 noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
552 sect->sct_fertil = (unsigned char)new;
555 new = errcheck(arg, 0, 127);
556 noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
557 sect->sct_oil = (unsigned char)new;
560 new = errcheck(arg, 0, 127);
561 noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
562 sect->sct_uran = (unsigned char)new;
565 new = errcheck(arg, 0, 100);
566 noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
567 sect->sct_work = (unsigned char)new;
570 new = errcheck(arg, 0, 127);
571 pr("Loyalty of %s changed from %d to %d%%\n",
572 xyas(sect->sct_x, sect->sct_y, player->cnum),
573 sect->sct_loyal, new);
574 sect->sct_loyal = (unsigned char)new;
578 new = errcheck(arg, 0, CHE_MAX);
579 pr("Guerillas in %s changed from %d to %d\n",
580 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
584 old = sect->sct_che_target;
585 new = errcheck(arg, 0, MAXNOC - 1);
586 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
587 xyas(sect->sct_x, sect->sct_y, player->cnum),
588 cname(old), old, cname(new), new);
589 sect->sct_che_target = new;
592 old = sect->sct_pstage;
593 new = errcheck(arg, 0, PLG_EXPOSED);
594 pr("Plague stage of %s changed from %d to %d%%\n",
595 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
596 sect->sct_pstage = new;
599 old = sect->sct_ptime;
600 new = errcheck(arg, 0, 255);
601 pr("Plague time of %s changed from %d to %d%%\n",
602 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
603 sect->sct_ptime = new;
606 old = sect->sct_fallout;
607 new = errcheck(arg, 0, FALLOUT_MAX);
608 pr("Fallout for sector %s changed from %d to %d\n",
609 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
610 sect->sct_fallout = new;
613 new = errcheck(arg, 0, 9999);
614 noise(sect, 1, "Available workforce", (int)sect->sct_avail, new);
615 sect->sct_avail = new;
618 new = errcheck(arg, 0, MINES_MAX);
619 sect->sct_mines = new;
620 pr("Mines changed to %d\n", new);
623 if (!sarg_xy(p, &newx, &newy))
629 if (!sarg_xy(p, &newx, &newy))
631 pr("Distribution Location for sector %s changed from %s to %s\n",
632 xyas(sect->sct_x, sect->sct_y, player->cnum),
633 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
634 xyas(newx, newy, player->cnum));
635 sect->sct_dist_x = newx;
636 sect->sct_dist_y = newy;
639 des = sct_typematch(p);
642 pr("Designation for sector %s changed from %c to %c\n",
643 xyas(sect->sct_x, sect->sct_y, player->cnum),
644 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
645 set_coastal(sect, des);
646 sect->sct_type = des;
649 des = sct_typematch(p);
652 pr("New Designation for sector %s changed from %c to %c\n",
653 xyas(sect->sct_x, sect->sct_y, player->cnum),
654 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
655 sect->sct_newtype = des;
662 noise(sect, 1, "Road percentage", (int)sect->sct_road, arg);
663 sect->sct_road = arg;
670 noise(sect, 1, "Rail percentage", (int)sect->sct_rail, arg);
671 sect->sct_rail = arg;
678 noise(sect, 1, "Defense percentage", (int)sect->sct_defense, arg);
679 sect->sct_defense = arg;
682 pr("huh? (%c)\n", op);
690 docountry(char op, int arg, char *p, float farg, struct natstr *np)
693 natid nat = np->nat_cnum;
697 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
698 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
701 pr("Country representative changed from %s to %s\n",
703 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
709 arg = errcheck(arg, 0, 1024);
710 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
714 benefit(nat, np->nat_reserve < arg);
715 pr("Military Reserves changed from %ld to %d\n",
716 np->nat_reserve, arg);
717 wu(player->cnum, nat,
718 "Military Reserves changed from %ld to %d by divine intervention.\n",
719 np->nat_reserve, arg);
720 np->nat_reserve = arg;
723 if (!sarg_xy(p, &newx, &newy))
725 pr("Capital coordinates changed from %s to %s\n",
726 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
727 xyas(newx, newy, player->cnum));
732 if (!sarg_xy(p, &newx, &newy))
734 pr("Origin coordinates changed from %s to %s\n",
735 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
736 xyas(newx, newy, player->cnum));
741 np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
744 arg = errcheck(arg, 0, m_m_p_d);
745 pr("Number of minutes used changed from %d to %d.\n",
746 np->nat_minused, arg);
747 np->nat_minused = arg;
750 pr("Money changed from %ld to %d\n", np->nat_money, arg);
751 wu(player->cnum, nat,
752 "Money changed from %ld to %d by divine intervention.\n",
757 pr("Tech changed from %.2f to %.2f.\n",
758 np->nat_level[NAT_TLEV], farg);
759 np->nat_level[NAT_TLEV] = farg;
762 pr("Research changed from %.2f to %.2f.\n",
763 np->nat_level[NAT_RLEV], farg);
764 np->nat_level[NAT_RLEV] = farg;
767 pr("Education changed from %.2f to %.2f.\n",
768 np->nat_level[NAT_ELEV], farg);
769 np->nat_level[NAT_ELEV] = farg;
772 pr("Happiness changed from %.2f to %.2f.\n",
773 np->nat_level[NAT_HLEV], farg);
774 np->nat_level[NAT_HLEV] = farg;
777 np->nat_missed = arg;
780 pr("huh? (%c)\n", op);
789 doship(char op, int arg, char *p, struct shpstr *ship)
796 ship->shp_pstage = arg;
799 ship->shp_ptime = arg;
802 strncpy(ship->shp_rpath, p, sizeof(ship->shp_rpath) - 1);
805 ship->shp_rflags = arg;
808 ship->shp_nchoppers = arg;
811 ship->shp_nxlight = arg;
818 wu(player->cnum, ship->shp_own,
819 "%s taken from you by deity intervention!\n", prship(ship));
820 if (arg && arg < MAXNOC) {
821 wu(player->cnum, (natid)arg,
822 "%s given to you by deity intervention!\n", prship(ship));
823 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
825 ship->shp_own = (natid)arg;
826 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
830 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
832 ship->shp_own = (natid)0;
836 if (!sarg_xy(p, &newx, &newy))
844 mchr[(int)ship->shp_type].m_tech, SHRT_MAX));
847 ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
850 ship->shp_mobil = arg;
853 ship->shp_fuel = errcheck(arg, 0, 255);
857 ship->shp_fleet = ' ';
858 else if (isalpha(p[0]))
859 ship->shp_fleet = p[0];
861 pr("%c: invalid fleet\n", p[0]);
866 ship->shp_nland = errcheck(arg, 0, 100);
869 ship->shp_nplane = errcheck(arg, 0, 100);
872 ship->shp_item[I_CIVIL] = arg;
875 ship->shp_item[I_MILIT] = arg;
878 ship->shp_item[I_UW] = arg;
881 ship->shp_item[I_FOOD] = arg;
884 ship->shp_item[I_SHELL] = arg;
887 ship->shp_item[I_GUN] = arg;
890 ship->shp_item[I_PETROL] = arg;
893 ship->shp_item[I_IRON] = arg;
896 ship->shp_item[I_DUST] = arg;
899 ship->shp_item[I_OIL] = arg;
902 ship->shp_item[I_LCM] = arg;
905 ship->shp_item[I_HCM] = arg;
908 ship->shp_item[I_RAD] = arg;
912 ship->shp_armor = errcheck(arg, 0, SHRT_MAX);
915 pr("huh? (%c)\n", op);
922 dounit(char op, int arg, char *p, float farg, struct lndstr *land)
929 land->lnd_land = arg;
936 wu(player->cnum, land->lnd_own,
937 "%s taken from you by deity intervention!\n", prland(land));
939 if (arg && arg < MAXNOC) {
940 wu(player->cnum, (natid)arg,
941 "%s given to you by deity intervention!\n", prland(land));
942 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
944 land->lnd_own = (natid)arg;
945 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
948 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
951 land->lnd_own = (natid)0;
955 if (!sarg_xy(p, &newx, &newy))
961 land->lnd_effic = errcheck(arg, LAND_MINEFF, 100);
964 land->lnd_mobil = arg;
969 lchr[(int)land->lnd_type].l_tech, SHRT_MAX));
973 land->lnd_army = ' ';
974 else if (isalpha(p[0]))
975 land->lnd_army = p[0];
977 pr("%c: invalid army\n", p[0]);
982 land->lnd_harden = errcheck(arg, 0, 255);
985 land->lnd_fuel = errcheck(arg, 0, 255);
988 land->lnd_nxlight = arg;
991 land->lnd_ship = arg;
994 land->lnd_rad_max = arg;
997 land->lnd_retreat = arg;
1000 strncpy(land->lnd_rpath, p, sizeof(land->lnd_rpath) - 1);
1003 land->lnd_rflags = arg;
1006 land->lnd_item[I_CIVIL] = arg;
1009 land->lnd_item[I_MILIT] = arg;
1012 land->lnd_item[I_UW] = arg;
1015 land->lnd_item[I_FOOD] = arg;
1018 land->lnd_item[I_SHELL] = arg;
1021 land->lnd_item[I_GUN] = arg;
1024 land->lnd_item[I_PETROL] = arg;
1027 land->lnd_item[I_IRON] = arg;
1030 land->lnd_item[I_DUST] = arg;
1033 land->lnd_item[I_OIL] = arg;
1036 land->lnd_item[I_LCM] = arg;
1039 land->lnd_item[I_HCM] = arg;
1042 land->lnd_item[I_RAD] = arg;
1045 warn_deprecated(op);
1046 pr("Attack changed from %1.2f to %1.2f.\n",
1047 land->lnd_att, farg);
1048 land->lnd_att = farg;
1051 warn_deprecated(op);
1052 pr("Defense changed from %1.2f to %1.2f.\n",
1053 land->lnd_def, farg);
1054 land->lnd_def = farg;
1057 pr("huh? (%c)\n", op);
1065 doplane(char op, int arg, char *p, struct plnstr *plane)
1071 plane->pln_nuketype = arg;
1074 plane->pln_uid = arg;
1077 if (!sarg_xy(p, &newx, &newy))
1079 plane->pln_x = newx;
1080 plane->pln_y = newy;
1084 wu(player->cnum, plane->pln_own,
1085 "%s taken from you by deity intervention!\n",
1087 if (arg && arg < MAXNOC) {
1088 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1089 plane->pln_x, plane->pln_y);
1090 plane->pln_own = (natid)arg;
1091 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1092 plane->pln_x, plane->pln_y);
1093 wu(player->cnum, plane->pln_own,
1094 "%s given to you by deity intervention!\n", prplane(plane));
1096 plane->pln_effic = 0;
1097 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1098 plane->pln_x, plane->pln_y);
1099 plane->pln_own = (natid)0;
1103 plane->pln_effic = errcheck(arg, PLANE_MINEFF, 100);
1106 plane->pln_mobil = errcheck(arg, -127, 255);
1111 plchr[(int)plane->pln_type].pl_tech, SHRT_MAX));
1115 plane->pln_wing = ' ';
1116 else if (isalpha(p[0]))
1117 plane->pln_wing = p[0];
1119 pr("%c: invalid wing\n", p[0]);
1124 plane->pln_att = arg;
1127 plane->pln_def = arg;
1130 plane->pln_range = (unsigned char)arg;
1133 plane->pln_ship = arg;
1136 plane->pln_land = arg;
1139 plane->pln_flags = arg;
1142 pr("huh? (%c)\n", op);