2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire 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 3 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, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * edit.c: Edit things (sectors, ships, planes, units, nukes, countries)
29 * Known contributors to this file:
32 * Steve McClure, 1998-2000
33 * Ron Koenderink, 2003-2009
34 * Markus Armbruster, 2003-2013
50 static void print_sect(struct sctstr *);
51 static void print_nat(struct natstr *);
52 static void print_plane(struct plnstr *);
53 static void print_land(struct lndstr *);
54 static void print_ship(struct shpstr *);
55 static int getin(char *, char **);
56 static int edit_sect(struct sctstr *, char, int, char *);
57 static int edit_nat(struct natstr *, char, int, char *);
58 static int edit_ship(struct shpstr *, char, int, char *);
59 static int edit_land(struct lndstr *, char, int, char *);
60 static int edit_plane(struct plnstr *, char, int, char *);
81 what = getstarg(player->argp[1],
82 "Edit what (country, land, ship, plane, nuke, unit)? ",
89 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
91 if (!sarg_xy(ptr, &x, &y))
93 if (!getsect(x, y, §))
97 np = natargp(player->argp[2], "Country? ");
102 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
104 if (!getplane(num, &plane))
108 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
110 if (!getship(num, &ship))
114 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
116 if (!getland(num, &land))
120 pr("Not implemented yet.\n");
126 if (!player->argp[3]) {
146 if (player->argp[arg_index]) {
147 if (player->argp[arg_index+1]) {
148 thing = player->argp[arg_index++][0];
149 ptr = player->argp[arg_index++];
153 } else if (arg_index == 3) {
154 err = getin(buf, &ptr);
184 if ((err = edit_nat(np, thing, arg, ptr)) != RET_OK)
188 if (!check_sect_ok(§))
190 if ((err = edit_sect(§, thing, arg, ptr)) != RET_OK)
196 if (!check_ship_ok(&ship))
198 if ((err = edit_ship(&ship, thing, arg, ptr)) != RET_OK)
200 if (!ef_ensure_space(EF_SHIP, ship.shp_uid, 50))
202 if (!putship(ship.shp_uid, &ship))
206 if (!check_land_ok(&land))
208 if ((err = edit_land(&land, thing, arg, ptr)) != RET_OK)
210 if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50))
212 if (!putland(land.lnd_uid, &land))
216 if (!check_plane_ok(&plane))
218 if ((err = edit_plane(&plane, thing, arg, ptr)) != RET_OK)
220 if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))
222 if (!putplane(plane.pln_uid, &plane))
230 benefit(natid who, int good)
237 nreport(player->cnum, N_AIDS, who, 1);
240 nreport(player->cnum, N_HURTS, who, 1);
245 noise(struct sctstr *sptr, char *name, int old, int new)
247 pr("%s of %s changed from %d to %d\n",
248 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
250 wu(player->cnum, sptr->sct_own,
251 "%s in %s was changed from %d to %d by an act of %s\n",
252 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
253 old, new, cname(player->cnum));
254 benefit(sptr->sct_own, old < new);
258 print_sect(struct sctstr *sect)
260 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
261 pr("Distribution sector <D>: %s\n",
262 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
263 pr("Designation <s>: %c\tNew designation <S>: %c\n",
264 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
265 pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
266 pr(" o O e m i g f c u w l x X p t F a\n");
267 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
268 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
269 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
270 sect->sct_uran, sect->sct_work, sect->sct_loyal,
271 sect->sct_che, sect->sct_che_target,
272 sect->sct_pstage, sect->sct_ptime,
273 sect->sct_fallout, sect->sct_avail);
275 pr("Mines <M>: %d\n", sect->sct_mines);
276 pr("Road %% <R>: %d\t", sect->sct_road);
277 pr("Rail %% <r>: %d\t", sect->sct_rail);
278 pr("Defense %% <d>: %d\n", sect->sct_defense);
282 print_nat(struct natstr *np)
286 pr("Country #: %2d\n", np->nat_cnum);
287 pr("Name <n>: %-20s\t", np->nat_cnam);
288 pr("Representative <r>: %-20s\n", np->nat_pnam);
289 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
290 pr("Reserves <m>: %5d\n", np->nat_reserve);
291 pr("Capital <c>: %s\t\t",
292 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
293 pr("Origin <o>: %3s\n",
294 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
295 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
296 pr("Seconds Used <u>: %3d\n", np->nat_timeused);
297 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
298 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
299 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
300 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
301 pr("Money <M>: $%6d\n", np->nat_money);
302 pr("Telegrams <t>: %6d\n", np->nat_tgms);
304 pr("Countries contacted: ");
305 for (i = 0; i < MAXNOC; i++) {
306 if (getcontact(np, i))
307 pr("%d(%d) ", i, getcontact(np, i));
314 print_plane(struct plnstr *plane)
316 pr("UID <U>: %d\t\t", plane->pln_uid);
317 pr("Owner <O>: %d\t\t", plane->pln_own);
318 pr("Location <l>: %s\n",
319 xyas(plane->pln_x, plane->pln_y, player->cnum));
320 pr("Efficiency <e>: %d\t", plane->pln_effic);
321 pr("Mobility <m>: %d\n", plane->pln_mobil);
322 pr("Tech <t>: %d\t\t", plane->pln_tech);
323 pr("Wing <w>: %.1s\n", &plane->pln_wing);
324 pr("Range <r>: %d\t\t", plane->pln_range);
325 pr("Flags <f>: %d\n", plane->pln_flags);
326 pr("Ship <s>: %d\t\t", plane->pln_ship);
327 pr("Land Unit <y>: %d\t", plane->pln_land);
331 print_land(struct lndstr *land)
333 pr("UID <U>: %d\n", land->lnd_uid);
334 pr("Owner <O>: %d\n", land->lnd_own);
335 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
336 pr("Efficiency <e>: %d\t", land->lnd_effic);
337 pr("Mobility <M>: %d\n", land->lnd_mobil);
338 pr("Tech <t>: %d\t\t", land->lnd_tech);
339 pr("Army <a>: %.1s\n", &land->lnd_army);
340 pr("Fortification <F>: %d\t", land->lnd_harden);
341 pr("Land unit <Y>: %d\n", land->lnd_land);
342 pr("Ship <S>: %d\t\t", land->lnd_ship);
343 pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
344 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
345 land->lnd_rpath, land->lnd_rflags);
346 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
347 pr(" c m u f s g p i d o l h r\n");
348 pr("%3d", land->lnd_item[I_CIVIL]);
349 pr("%4d", land->lnd_item[I_MILIT]);
350 pr("%4d", land->lnd_item[I_UW]);
351 pr("%5d", land->lnd_item[I_FOOD]);
352 pr("%4d", land->lnd_item[I_SHELL]);
353 pr("%4d", land->lnd_item[I_GUN]);
354 pr("%5d", land->lnd_item[I_PETROL]);
355 pr("%5d", land->lnd_item[I_IRON]);
356 pr("%5d", land->lnd_item[I_DUST]);
357 pr("%5d", land->lnd_item[I_OIL]);
358 pr("%5d", land->lnd_item[I_LCM]);
359 pr("%5d", land->lnd_item[I_HCM]);
360 pr("%4d", land->lnd_item[I_RAD]);
365 print_ship(struct shpstr *ship)
369 if (!(natp = getnatp(ship->shp_own)))
371 pr("%s %s\n", prnat(natp), prship(ship));
372 pr("UID <U>: %d\n", ship->shp_uid);
373 pr("Owner <O>: %d\t\t\t", ship->shp_own);
374 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
375 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
376 pr("Efficiency <E>: %d\n", ship->shp_effic);
377 pr("Mobility <M>: %d\t\t", ship->shp_mobil);
378 pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
379 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
380 ship->shp_rpath, ship->shp_rflags);
381 pr("Plague Stage <a>: %d\t\t", ship->shp_pstage);
382 pr("Plague Time <b>: %d\n", ship->shp_ptime);
383 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
384 pr(" c m u f s g p i d o l h r\n");
385 pr("%3d", ship->shp_item[I_CIVIL]);
386 pr("%4d", ship->shp_item[I_MILIT]);
387 pr("%4d", ship->shp_item[I_UW]);
388 pr("%5d", ship->shp_item[I_FOOD]);
389 pr("%4d", ship->shp_item[I_SHELL]);
390 pr("%4d", ship->shp_item[I_GUN]);
391 pr("%5d", ship->shp_item[I_PETROL]);
392 pr("%5d", ship->shp_item[I_IRON]);
393 pr("%5d", ship->shp_item[I_DUST]);
394 pr("%5d", ship->shp_item[I_OIL]);
395 pr("%5d", ship->shp_item[I_LCM]);
396 pr("%5d", ship->shp_item[I_HCM]);
397 pr("%4d", ship->shp_item[I_RAD]);
402 getin(char *buf, char **valp)
407 p = getstarg(NULL, "%c xxxxx -- thing value : ", buf);
412 for (; isspace(*p); p++) ;
416 for (; *p && !isspace(*p); p++) ;
417 for (; isspace(*p); p++) ;
424 #if 0 /* not needed right now */
426 warn_deprecated(char key)
428 pr("Key <%c> is deprecated and will go away in a future release\n", key);
433 edit_sect(struct sctstr *sect, char op, int arg, char *p)
435 natid newown, oldown;
443 newown = (natid)LIMIT_TO(arg, 0, MAXNOC - 1);
444 pr("Owner of %s changed from %s to %s.\n",
445 xyas(sect->sct_x, sect->sct_y, player->cnum),
446 prnatid(sect->sct_own), prnatid(newown));
448 wu(player->cnum, sect->sct_own,
449 "Sector %s lost to deity intervention\n",
450 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
452 benefit(sect->sct_own, 0);
453 sect->sct_own = newown;
455 wu(player->cnum, newown,
456 "Sector %s gained from deity intervention\n",
457 xyas(sect->sct_x, sect->sct_y, newown));
464 oldown = (natid)LIMIT_TO(arg, 0, MAXNOC - 1);
465 pr("Old owner of %s changed from %s to %s.\n",
466 xyas(sect->sct_x, sect->sct_y, player->cnum),
467 prnatid(sect->sct_oldown), prnatid(oldown));
468 sect->sct_oldown = oldown;
471 new = LIMIT_TO(arg, 0, 100);
472 noise(sect, "Efficiency", sect->sct_effic, new);
473 sect->sct_effic = new;
476 new = LIMIT_TO(arg, -127, 255);
477 noise(sect, "Mobility", sect->sct_mobil, new);
478 sect->sct_mobil = new;
481 new = LIMIT_TO(arg, 0, 127);
482 noise(sect, "Iron ore content", sect->sct_min, new);
483 sect->sct_min = (unsigned char)new;
486 new = LIMIT_TO(arg, 0, 127);
487 noise(sect, "Gold content", sect->sct_gmin, new);
488 sect->sct_gmin = (unsigned char)new;
491 new = LIMIT_TO(arg, 0, 127);
492 noise(sect, "Fertility", sect->sct_fertil, new);
493 sect->sct_fertil = (unsigned char)new;
496 new = LIMIT_TO(arg, 0, 127);
497 noise(sect, "Oil content", sect->sct_oil, new);
498 sect->sct_oil = (unsigned char)new;
501 new = LIMIT_TO(arg, 0, 127);
502 noise(sect, "Uranium content", sect->sct_uran, new);
503 sect->sct_uran = (unsigned char)new;
506 new = LIMIT_TO(arg, 0, 100);
507 noise(sect, "Workforce percentage", sect->sct_work, new);
508 sect->sct_work = (unsigned char)new;
511 new = LIMIT_TO(arg, 0, 127);
512 pr("Loyalty of %s changed from %d to %d%%\n",
513 xyas(sect->sct_x, sect->sct_y, player->cnum),
514 sect->sct_loyal, new);
515 sect->sct_loyal = (unsigned char)new;
519 new = LIMIT_TO(arg, 0, CHE_MAX);
520 pr("Guerillas in %s changed from %d to %d\n",
521 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
525 old = sect->sct_che_target;
526 new = LIMIT_TO(arg, 0, MAXNOC - 1);
527 pr("Che target of %s changed from %s to %s.\n",
528 xyas(sect->sct_x, sect->sct_y, player->cnum),
529 prnatid(old), prnatid(new));
530 sect->sct_che_target = new;
535 old = sect->sct_pstage;
536 new = LIMIT_TO(arg, 0, PLG_EXPOSED);
537 pr("Plague stage of %s changed from %d to %d%%\n",
538 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
539 sect->sct_pstage = new;
542 old = sect->sct_ptime;
543 new = LIMIT_TO(arg, 0, 255);
544 pr("Plague time of %s changed from %d to %d%%\n",
545 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
546 sect->sct_ptime = new;
549 old = sect->sct_fallout;
550 new = LIMIT_TO(arg, 0, FALLOUT_MAX);
551 pr("Fallout for sector %s changed from %d to %d\n",
552 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
553 sect->sct_fallout = new;
556 new = LIMIT_TO(arg, 0, 9999);
557 noise(sect, "Available workforce", sect->sct_avail, new);
558 sect->sct_avail = new;
561 new = LIMIT_TO(arg, 0, MINES_MAX);
562 sect->sct_mines = new;
563 pr("Mines changed to %d\n", new);
566 if (!sarg_xy(p, &newx, &newy))
570 ef_set_uid(EF_SECTOR, §, XYOFFSET(newx, newy));
573 if (!sarg_xy(p, &newx, &newy))
575 pr("Distribution location for sector %s changed from %s to %s\n",
576 xyas(sect->sct_x, sect->sct_y, player->cnum),
577 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
578 xyas(newx, newy, player->cnum));
579 sect->sct_dist_x = newx;
580 sect->sct_dist_y = newy;
583 des = sct_typematch(p);
586 pr("Designation for sector %s changed from %c to %c\n",
587 xyas(sect->sct_x, sect->sct_y, player->cnum),
588 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
589 set_coastal(sect, sect->sct_type, des);
590 sect->sct_type = des;
593 des = sct_typematch(p);
596 pr("New designation for sector %s changed from %c to %c\n",
597 xyas(sect->sct_x, sect->sct_y, player->cnum),
598 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
599 sect->sct_newtype = des;
602 new = LIMIT_TO(arg, 0, 100);
603 noise(sect, "Road percentage", sect->sct_road, new);
604 sect->sct_road = new;
607 new = LIMIT_TO(arg, 0, 100);
608 noise(sect, "Rail percentage", sect->sct_rail, new);
609 sect->sct_rail = new;
612 new = LIMIT_TO(arg, 0, 100);
613 noise(sect, "Defense percentage", sect->sct_defense, new);
614 sect->sct_defense = new;
617 pr("huh? (%c)\n", op);
624 edit_nat(struct natstr *np, char op, int arg, char *p)
627 natid nat = np->nat_cnum;
628 float farg = (float)atof(p);
632 if (!check_nat_name(p, nat))
634 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
635 strcpy(np->nat_cnam, p);
638 pr("Country representative changed from %s to %s\n",
640 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
646 arg = LIMIT_TO(arg, 0, 1024);
647 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
651 benefit(nat, np->nat_reserve < arg);
652 pr("Military reserves changed from %d to %d\n",
653 np->nat_reserve, arg);
654 wu(player->cnum, nat,
655 "Military reserves changed from %d to %d by divine intervention.\n",
656 np->nat_reserve, arg);
657 np->nat_reserve = arg;
660 if (!sarg_xy(p, &newx, &newy))
662 pr("Capital coordinates changed from %s to %s\n",
663 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
664 xyas(newx, newy, player->cnum));
669 if (!sarg_xy(p, &newx, &newy))
671 pr("Origin coordinates changed from %s to %s\n",
672 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
673 xyas(newx, newy, player->cnum));
678 np->nat_stat = LIMIT_TO(arg, STAT_UNUSED, STAT_GOD);
681 arg = LIMIT_TO(arg, 0, m_m_p_d * 60);
682 pr("Number of seconds used changed from %d to %d.\n",
683 np->nat_timeused, arg);
684 np->nat_timeused = arg;
687 pr("Money changed from %d to %d\n", np->nat_money, arg);
688 wu(player->cnum, nat,
689 "Money changed from %d to %d by divine intervention.\n",
694 pr("Tech changed from %.2f to %.2f.\n",
695 np->nat_level[NAT_TLEV], farg);
696 np->nat_level[NAT_TLEV] = farg;
699 pr("Research changed from %.2f to %.2f.\n",
700 np->nat_level[NAT_RLEV], farg);
701 np->nat_level[NAT_RLEV] = farg;
704 pr("Education changed from %.2f to %.2f.\n",
705 np->nat_level[NAT_ELEV], farg);
706 np->nat_level[NAT_ELEV] = farg;
709 pr("Happiness changed from %.2f to %.2f.\n",
710 np->nat_level[NAT_HLEV], farg);
711 np->nat_level[NAT_HLEV] = farg;
714 pr("huh? (%c)\n", op);
722 edit_ship(struct shpstr *ship, char op, int arg, char *p)
729 ship->shp_pstage = arg;
732 ship->shp_ptime = arg;
735 strncpy(ship->shp_rpath, p, sizeof(ship->shp_rpath) - 1);
738 ship->shp_rflags = arg;
741 ef_set_uid(EF_SHIP, ship, arg);
745 wu(player->cnum, ship->shp_own,
746 "%s taken from you by deity intervention!\n", prship(ship));
747 if (arg && arg < MAXNOC) {
748 wu(player->cnum, (natid)arg,
749 "%s given to you by deity intervention!\n", prship(ship));
750 ship->shp_own = (natid)arg;
755 if (!sarg_xy(p, &newx, &newy))
761 arg = LIMIT_TO(arg, mchr[(int)ship->shp_type].m_tech, SHRT_MAX);
762 shp_set_tech(ship, arg);
765 ship->shp_effic = LIMIT_TO(arg, SHIP_MINEFF, 100);
768 ship->shp_mobil = arg;
773 else if (isalpha(p[0]))
774 ship->shp_fleet = p[0];
776 pr("%c: invalid fleet\n", p[0]);
781 ship->shp_item[I_CIVIL] = arg;
784 ship->shp_item[I_MILIT] = arg;
787 ship->shp_item[I_UW] = arg;
790 ship->shp_item[I_FOOD] = arg;
793 ship->shp_item[I_SHELL] = arg;
796 ship->shp_item[I_GUN] = arg;
799 ship->shp_item[I_PETROL] = arg;
802 ship->shp_item[I_IRON] = arg;
805 ship->shp_item[I_DUST] = arg;
808 ship->shp_item[I_OIL] = arg;
811 ship->shp_item[I_LCM] = arg;
814 ship->shp_item[I_HCM] = arg;
817 ship->shp_item[I_RAD] = arg;
820 pr("huh? (%c)\n", op);
827 edit_land(struct lndstr *land, char op, int arg, char *p)
834 land->lnd_land = arg;
837 ef_set_uid(EF_LAND, land, arg);
841 wu(player->cnum, land->lnd_own,
842 "%s taken from you by deity intervention!\n", prland(land));
844 if (arg && arg < MAXNOC) {
845 wu(player->cnum, (natid)arg,
846 "%s given to you by deity intervention!\n", prland(land));
847 land->lnd_own = (natid)arg;
852 if (!sarg_xy(p, &newx, &newy))
858 land->lnd_effic = LIMIT_TO(arg, LAND_MINEFF, 100);
861 land->lnd_mobil = arg;
864 arg = LIMIT_TO(arg, lchr[(int)land->lnd_type].l_tech, SHRT_MAX);
865 lnd_set_tech(land, arg);
870 else if (isalpha(p[0]))
871 land->lnd_army = p[0];
873 pr("%c: invalid army\n", p[0]);
878 land->lnd_harden = LIMIT_TO(arg, 0, 255);
881 land->lnd_ship = arg;
884 land->lnd_retreat = arg;
887 strncpy(land->lnd_rpath, p, sizeof(land->lnd_rpath) - 1);
890 land->lnd_rflags = arg;
893 land->lnd_item[I_CIVIL] = arg;
896 land->lnd_item[I_MILIT] = arg;
899 land->lnd_item[I_UW] = arg;
902 land->lnd_item[I_FOOD] = arg;
905 land->lnd_item[I_SHELL] = arg;
908 land->lnd_item[I_GUN] = arg;
911 land->lnd_item[I_PETROL] = arg;
914 land->lnd_item[I_IRON] = arg;
917 land->lnd_item[I_DUST] = arg;
920 land->lnd_item[I_OIL] = arg;
923 land->lnd_item[I_LCM] = arg;
926 land->lnd_item[I_HCM] = arg;
929 land->lnd_item[I_RAD] = arg;
932 pr("huh? (%c)\n", op);
939 edit_plane(struct plnstr *plane, char op, int arg, char *p)
945 ef_set_uid(EF_PLANE, plane, arg);
948 if (!sarg_xy(p, &newx, &newy))
955 wu(player->cnum, plane->pln_own,
956 "%s taken from you by deity intervention!\n",
958 if (arg && arg < MAXNOC) {
959 plane->pln_own = (natid)arg;
960 wu(player->cnum, plane->pln_own,
961 "%s given to you by deity intervention!\n", prplane(plane));
963 plane->pln_effic = 0;
966 plane->pln_effic = LIMIT_TO(arg, PLANE_MINEFF, 100);
969 plane->pln_mobil = LIMIT_TO(arg, -127, 255);
972 arg = LIMIT_TO(arg, plchr[(int)plane->pln_type].pl_tech, SHRT_MAX);
973 pln_set_tech(plane, arg);
978 else if (isalpha(p[0]))
979 plane->pln_wing = p[0];
981 pr("%c: invalid wing\n", p[0]);
986 plane->pln_range = (unsigned char)arg;
989 plane->pln_ship = arg;
992 plane->pln_land = arg;
995 plane->pln_flags = arg;
998 pr("huh? (%c)\n", op);