2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2007, 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
35 * Markus Armbruster, 2003-2006
54 static void benefit(natid, int);
55 static int docountry(char, int, char *, struct natstr *);
56 static int doland(char, int, char *, struct sctstr *);
57 static int doplane(char, int, char *, struct plnstr *);
58 static int doship(char, int, char *, struct shpstr *);
59 static int dounit(char, int, char *, struct lndstr *);
60 static int getin(char *, char **);
61 static void noise(struct sctstr *, char *, int, int);
62 static void pr_land(struct lndstr *);
63 static void pr_plane(struct plnstr *);
64 static void pr_ship(struct shpstr *);
65 static void prnat(struct natstr *);
66 static void prsect(struct sctstr *);
88 if ((what = getstarg(player->argp[1],
89 "Edit What (country, land, ship, plane, nuke, unit)? ",
95 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
97 if (!sarg_xy(ptr, &x, &y))
99 if (!getsect(x, y, §))
103 np = natargp(player->argp[2], "Country? ");
108 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
110 if (!getplane(num, &plane))
114 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
116 if (!getship(num, &ship))
120 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
122 if (!getland(num, &land))
126 pr("Not implemented yet.\n");
132 if (player->argp[3] == 0) {
152 if (player->argp[arg_index] != 0) {
153 if (player->argp[arg_index+1] != 0) {
154 thing = player->argp[arg_index++][0];
155 ptr = player->argp[arg_index++];
159 } else if (arg_index == 3) {
160 err = getin(buf, &ptr);
190 if ((err = docountry(thing, arg, ptr, np)) != RET_OK)
194 if ((err = doland(thing, arg, ptr, §)) != RET_OK)
200 if ((err = doship(thing, arg, ptr, &ship)) != RET_OK)
202 if (!ef_ensure_space(EF_SHIP, ship.shp_uid, 50))
204 if (!putship(ship.shp_uid, &ship))
208 if ((err = dounit(thing, arg, ptr, &land)) != RET_OK)
210 if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50))
212 if (!putland(land.lnd_uid, &land))
216 if ((err = doplane(thing, arg, ptr, &plane)) != RET_OK)
218 if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))
220 if (!putplane(plane.pln_uid, &plane))
228 benefit(natid who, int good)
235 nreport(player->cnum, N_AIDS, who, 1);
238 nreport(player->cnum, N_HURTS, who, 1);
243 noise(struct sctstr *sptr, char *name, int old, int new)
245 pr("%s of %s changed from %d to %d\n",
246 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
248 wu(player->cnum, sptr->sct_own,
249 "%s in %s was changed from %d to %d by an act of %s\n",
250 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
251 old, new, cname(player->cnum));
252 benefit(sptr->sct_own, old < new);
256 prsect(struct sctstr *sect)
258 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
259 pr("Distribution sector <D>: %s\n",
260 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
261 pr("Designation <s>: %c\tNew designation <S>: %c\n",
262 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
263 pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
264 pr(" o O e m i g f c u w l x X p t F a\n");
265 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
266 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
267 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
268 sect->sct_uran, sect->sct_work, sect->sct_loyal,
269 sect->sct_che, sect->sct_che_target,
270 sect->sct_pstage, sect->sct_ptime,
271 sect->sct_fallout, sect->sct_avail);
273 pr("Mines <M>: %d\n", sect->sct_mines);
274 pr("Road %% <R>: %d\t", sect->sct_road);
275 pr("Rail %% <r>: %d\t", sect->sct_rail);
276 pr("Defense %% <d>: %d\n", sect->sct_defense);
281 prnat(struct natstr *np)
285 pr("Country #: %2d\n", np->nat_cnum);
286 pr("Name <n>: %-20s\t", np->nat_cnam);
287 pr("Representative <r>: %-20s\n", np->nat_pnam);
288 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
289 pr("Reserves <m>: %5ld\n", np->nat_reserve);
290 pr("Capital <c>: %s\t\t",
291 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
292 pr("Origin <o>: %3s\n",
293 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
294 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
295 pr("Min Used <u>: %3d\n", np->nat_minused);
296 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
297 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
298 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
299 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
300 pr("Money <M>: $%6ld\n", np->nat_money);
301 pr("Telegrams <t>: %6d\n", np->nat_tgms);
302 if (opt_DEMANDUPDATE)
303 pr("Updates missed <U>: %d\n", np->nat_missed);
305 pr("Countries contacted: ");
306 for (i = 0; i < MAXNOC; i++) {
307 if (getcontact(np, i))
308 pr("%d(%d) ", i, getcontact(np, i));
315 pr_plane(struct plnstr *plane)
317 pr("UID <U>: %d\t\t", plane->pln_uid);
318 pr("Owner <O>: %d\t\t", plane->pln_own);
319 pr("Location <l>: %s\n",
320 xyas(plane->pln_x, plane->pln_y, player->cnum));
321 pr("Efficiency <e>: %d\t", plane->pln_effic);
322 pr("Mobility <m>: %d\n", plane->pln_mobil);
323 pr("Tech <t>: %d\t\t", plane->pln_tech);
324 pr("Wing <w>: %.1s\n", &plane->pln_wing);
325 pr("Range <r>: %d\t\t", plane->pln_range);
326 pr("Flags <f>: %d\n", plane->pln_flags);
327 pr("Ship <s>: %d\t\t", plane->pln_ship);
328 pr("Land Unit <y>: %d\t", plane->pln_land);
329 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
333 pr_land(struct lndstr *land)
335 pr("UID <U>: %d\n", land->lnd_uid);
336 pr("Owner <O>: %d\n", land->lnd_own);
337 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
338 pr("Efficiency <e>: %d\t", land->lnd_effic);
339 pr("Mobility <M>: %d\n", land->lnd_mobil);
340 pr("Tech <t>: %d\t\t", land->lnd_tech);
341 pr("Army <a>: %.1s\n", &land->lnd_army);
342 pr("Fortification <F>: %d\t", land->lnd_harden);
343 pr("Fuel <B>: %d\n", land->lnd_fuel);
344 pr("Land unit <Y>: %d\n", land->lnd_land);
345 pr("Ship <S>: %d\t\t", land->lnd_ship);
346 pr("Radius <P>: %d\n", land->lnd_rad_max);
347 pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
348 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
349 land->lnd_rpath, land->lnd_rflags);
350 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
351 pr(" c m u f s g p i d o l h r\n");
352 pr("%3d", land->lnd_item[I_CIVIL]);
353 pr("%4d", land->lnd_item[I_MILIT]);
354 pr("%4d", land->lnd_item[I_UW]);
355 pr("%5d", land->lnd_item[I_FOOD]);
356 pr("%4d", land->lnd_item[I_SHELL]);
357 pr("%4d", land->lnd_item[I_GUN]);
358 pr("%5d", land->lnd_item[I_PETROL]);
359 pr("%5d", land->lnd_item[I_IRON]);
360 pr("%5d", land->lnd_item[I_DUST]);
361 pr("%5d", land->lnd_item[I_OIL]);
362 pr("%5d", land->lnd_item[I_LCM]);
363 pr("%5d", land->lnd_item[I_HCM]);
364 pr("%4d", land->lnd_item[I_RAD]);
369 pr_ship(struct shpstr *ship)
373 if ((natp = getnatp(ship->shp_own)) == 0)
375 pr("%s (#%d) %s\n", natp->nat_cnam, ship->shp_own, prship(ship));
376 pr("UID <U>: %d\n", ship->shp_uid);
377 pr("Owner <O>: %d\t\t\t", ship->shp_own);
378 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
379 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
380 pr("Efficiency <E>: %d\n", ship->shp_effic);
381 pr("Mobility <M>: %d\t\t", ship->shp_mobil);
382 pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
383 /* could depend on opt_FUEL - but a deity might want to set this
384 up before enabling the option */
385 pr("Fuel <B>: %d\n", ship->shp_fuel);
386 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
387 ship->shp_rpath, ship->shp_rflags);
388 pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
389 pr("Plague Time <b>: %d\n", ship->shp_ptime);
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", ship->shp_item[I_CIVIL]);
393 pr("%4d", ship->shp_item[I_MILIT]);
394 pr("%4d", ship->shp_item[I_UW]);
395 pr("%5d", ship->shp_item[I_FOOD]);
396 pr("%4d", ship->shp_item[I_SHELL]);
397 pr("%4d", ship->shp_item[I_GUN]);
398 pr("%5d", ship->shp_item[I_PETROL]);
399 pr("%5d", ship->shp_item[I_IRON]);
400 pr("%5d", ship->shp_item[I_DUST]);
401 pr("%5d", ship->shp_item[I_OIL]);
402 pr("%5d", ship->shp_item[I_LCM]);
403 pr("%5d", ship->shp_item[I_HCM]);
404 pr("%4d", ship->shp_item[I_RAD]);
409 errcheck(int num, int min, int max)
419 getin(char *buf, char **valp)
424 p = getstarg(NULL, "%c xxxxx -- thing value : ", buf);
429 for (; isspace(*p); p++) ;
433 for (; *p && !isspace(*p); p++) ;
434 for (; isspace(*p); p++) ;
442 warn_deprecated(char key)
444 pr("Key <%c> is deprecated and will go away in a future release\n", key);
448 doland(char op, int arg, char *p, struct sctstr *sect)
450 natid newown, oldown;
459 sect->sct_coastal = (arg ? 1 : 0);
460 pr("Coastal flag of %s changed to %d\n",
461 xyas(sect->sct_x, sect->sct_y, player->cnum),
467 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
468 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
469 xyas(sect->sct_x, sect->sct_y, player->cnum),
470 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
472 makelost(EF_SECTOR, sect->sct_own, 0,
473 sect->sct_x, sect->sct_y);
474 wu(player->cnum, sect->sct_own,
475 "Sector %s lost to deity intervention\n",
476 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
478 benefit(sect->sct_own, 0);
479 sect->sct_own = newown;
481 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
482 wu(player->cnum, newown,
483 "Sector %s gained from deity intervention\n",
484 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
491 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
492 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
493 xyas(sect->sct_x, sect->sct_y, player->cnum),
494 cname(sect->sct_oldown),
495 sect->sct_oldown, cname(oldown), oldown);
496 sect->sct_oldown = oldown;
499 new = errcheck(arg, 0, 100);
500 noise(sect, "Efficiency", sect->sct_effic, new);
501 sect->sct_effic = (unsigned char)new;
504 new = errcheck(arg, -127, 255);
505 noise(sect, "Mobility", sect->sct_mobil, new);
506 sect->sct_mobil = new;
509 new = errcheck(arg, 0, 127);
510 noise(sect, "Iron ore content", sect->sct_min, new);
511 sect->sct_min = (unsigned char)new;
514 new = errcheck(arg, 0, 127);
515 noise(sect, "Gold content", sect->sct_gmin, new);
516 sect->sct_gmin = (unsigned char)new;
519 new = errcheck(arg, 0, 127);
520 noise(sect, "Fertility", sect->sct_fertil, new);
521 sect->sct_fertil = (unsigned char)new;
524 new = errcheck(arg, 0, 127);
525 noise(sect, "Oil content", sect->sct_oil, new);
526 sect->sct_oil = (unsigned char)new;
529 new = errcheck(arg, 0, 127);
530 noise(sect, "Uranium content", sect->sct_uran, new);
531 sect->sct_uran = (unsigned char)new;
534 new = errcheck(arg, 0, 100);
535 noise(sect, "Workforce percentage", sect->sct_work, new);
536 sect->sct_work = (unsigned char)new;
539 new = errcheck(arg, 0, 127);
540 pr("Loyalty of %s changed from %d to %d%%\n",
541 xyas(sect->sct_x, sect->sct_y, player->cnum),
542 sect->sct_loyal, new);
543 sect->sct_loyal = (unsigned char)new;
547 new = errcheck(arg, 0, CHE_MAX);
548 pr("Guerillas in %s changed from %d to %d\n",
549 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
553 old = sect->sct_che_target;
554 new = errcheck(arg, 0, MAXNOC - 1);
555 pr("Che target of %s changed from %s (#%d) to %s (#%d).\n",
556 xyas(sect->sct_x, sect->sct_y, player->cnum),
557 cname(old), old, cname(new), new);
558 sect->sct_che_target = new;
563 old = sect->sct_pstage;
564 new = errcheck(arg, 0, PLG_EXPOSED);
565 pr("Plague stage of %s changed from %d to %d%%\n",
566 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
567 sect->sct_pstage = new;
570 old = sect->sct_ptime;
571 new = errcheck(arg, 0, 255);
572 pr("Plague time of %s changed from %d to %d%%\n",
573 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
574 sect->sct_ptime = new;
577 old = sect->sct_fallout;
578 new = errcheck(arg, 0, FALLOUT_MAX);
579 pr("Fallout for sector %s changed from %d to %d\n",
580 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
581 sect->sct_fallout = new;
584 new = errcheck(arg, 0, 9999);
585 noise(sect, "Available workforce", sect->sct_avail, new);
586 sect->sct_avail = new;
589 new = errcheck(arg, 0, MINES_MAX);
590 sect->sct_mines = new;
591 pr("Mines changed to %d\n", new);
594 if (!sarg_xy(p, &newx, &newy))
600 if (!sarg_xy(p, &newx, &newy))
602 pr("Distribution Location for sector %s changed from %s to %s\n",
603 xyas(sect->sct_x, sect->sct_y, player->cnum),
604 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
605 xyas(newx, newy, player->cnum));
606 sect->sct_dist_x = newx;
607 sect->sct_dist_y = newy;
610 des = sct_typematch(p);
613 pr("Designation for sector %s changed from %c to %c\n",
614 xyas(sect->sct_x, sect->sct_y, player->cnum),
615 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
616 set_coastal(sect, sect->sct_type, des);
617 sect->sct_type = des;
620 des = sct_typematch(p);
623 pr("New Designation for sector %s changed from %c to %c\n",
624 xyas(sect->sct_x, sect->sct_y, player->cnum),
625 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
626 sect->sct_newtype = des;
633 noise(sect, "Road percentage", sect->sct_road, arg);
634 sect->sct_road = arg;
641 noise(sect, "Rail percentage", sect->sct_rail, arg);
642 sect->sct_rail = arg;
649 noise(sect, "Defense percentage", sect->sct_defense, arg);
650 sect->sct_defense = arg;
653 pr("huh? (%c)\n", op);
661 docountry(char op, int arg, char *p, struct natstr *np)
664 natid nat = np->nat_cnum;
665 float farg = (float)atof(p);
669 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
670 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
673 pr("Country representative changed from %s to %s\n",
675 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
681 arg = errcheck(arg, 0, 1024);
682 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
686 benefit(nat, np->nat_reserve < arg);
687 pr("Military Reserves changed from %ld to %d\n",
688 np->nat_reserve, arg);
689 wu(player->cnum, nat,
690 "Military Reserves changed from %ld to %d by divine intervention.\n",
691 np->nat_reserve, arg);
692 np->nat_reserve = arg;
695 if (!sarg_xy(p, &newx, &newy))
697 pr("Capital coordinates changed from %s to %s\n",
698 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
699 xyas(newx, newy, player->cnum));
704 if (!sarg_xy(p, &newx, &newy))
706 pr("Origin coordinates changed from %s to %s\n",
707 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
708 xyas(newx, newy, player->cnum));
713 np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
716 arg = errcheck(arg, 0, m_m_p_d);
717 pr("Number of minutes used changed from %d to %d.\n",
718 np->nat_minused, arg);
719 np->nat_minused = arg;
722 pr("Money changed from %ld to %d\n", np->nat_money, arg);
723 wu(player->cnum, nat,
724 "Money changed from %ld to %d by divine intervention.\n",
729 pr("Tech changed from %.2f to %.2f.\n",
730 np->nat_level[NAT_TLEV], farg);
731 np->nat_level[NAT_TLEV] = farg;
734 pr("Research changed from %.2f to %.2f.\n",
735 np->nat_level[NAT_RLEV], farg);
736 np->nat_level[NAT_RLEV] = farg;
739 pr("Education changed from %.2f to %.2f.\n",
740 np->nat_level[NAT_ELEV], farg);
741 np->nat_level[NAT_ELEV] = farg;
744 pr("Happiness changed from %.2f to %.2f.\n",
745 np->nat_level[NAT_HLEV], farg);
746 np->nat_level[NAT_HLEV] = farg;
749 np->nat_missed = arg;
752 pr("huh? (%c)\n", op);
761 doship(char op, int arg, char *p, struct shpstr *ship)
768 ship->shp_pstage = arg;
771 ship->shp_ptime = arg;
774 strncpy(ship->shp_rpath, p, sizeof(ship->shp_rpath) - 1);
777 ship->shp_rflags = arg;
781 ship->shp_nchoppers = arg;
785 ship->shp_nxlight = arg;
792 wu(player->cnum, ship->shp_own,
793 "%s taken from you by deity intervention!\n", prship(ship));
794 if (arg && arg < MAXNOC) {
795 wu(player->cnum, (natid)arg,
796 "%s given to you by deity intervention!\n", prship(ship));
797 makelost(EF_SHIP, ship->shp_own, ship->shp_uid,
798 ship->shp_x, ship->shp_y);
799 ship->shp_own = (natid)arg;
800 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid,
801 ship->shp_x, ship->shp_y);
806 if (!sarg_xy(p, &newx, &newy))
814 mchr[(int)ship->shp_type].m_tech, SHRT_MAX));
817 ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
820 ship->shp_mobil = arg;
823 ship->shp_fuel = errcheck(arg, 0, 255);
828 else if (isalpha(p[0]))
829 ship->shp_fleet = p[0];
831 pr("%c: invalid fleet\n", p[0]);
837 ship->shp_nland = errcheck(arg, 0, 100);
841 ship->shp_nplane = errcheck(arg, 0, 100);
844 ship->shp_item[I_CIVIL] = arg;
847 ship->shp_item[I_MILIT] = arg;
850 ship->shp_item[I_UW] = arg;
853 ship->shp_item[I_FOOD] = arg;
856 ship->shp_item[I_SHELL] = arg;
859 ship->shp_item[I_GUN] = arg;
862 ship->shp_item[I_PETROL] = arg;
865 ship->shp_item[I_IRON] = arg;
868 ship->shp_item[I_DUST] = arg;
871 ship->shp_item[I_OIL] = arg;
874 ship->shp_item[I_LCM] = arg;
877 ship->shp_item[I_HCM] = arg;
880 ship->shp_item[I_RAD] = arg;
883 pr("huh? (%c)\n", op);
890 dounit(char op, int arg, char *p, struct lndstr *land)
897 land->lnd_land = arg;
904 wu(player->cnum, land->lnd_own,
905 "%s taken from you by deity intervention!\n", prland(land));
907 if (arg && arg < MAXNOC) {
908 wu(player->cnum, (natid)arg,
909 "%s given to you by deity intervention!\n", prland(land));
910 makelost(EF_LAND, land->lnd_own, land->lnd_uid,
911 land->lnd_x, land->lnd_y);
912 land->lnd_own = (natid)arg;
913 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid,
914 land->lnd_x, land->lnd_y);
919 if (!sarg_xy(p, &newx, &newy))
925 land->lnd_effic = errcheck(arg, LAND_MINEFF, 100);
928 land->lnd_mobil = arg;
933 lchr[(int)land->lnd_type].l_tech, SHRT_MAX));
938 else if (isalpha(p[0]))
939 land->lnd_army = p[0];
941 pr("%c: invalid army\n", p[0]);
946 land->lnd_harden = errcheck(arg, 0, 255);
949 land->lnd_fuel = errcheck(arg, 0, 255);
953 land->lnd_nxlight = arg;
956 land->lnd_ship = arg;
959 land->lnd_rad_max = arg;
962 land->lnd_retreat = arg;
965 strncpy(land->lnd_rpath, p, sizeof(land->lnd_rpath) - 1);
968 land->lnd_rflags = arg;
971 land->lnd_item[I_CIVIL] = arg;
974 land->lnd_item[I_MILIT] = arg;
977 land->lnd_item[I_UW] = arg;
980 land->lnd_item[I_FOOD] = arg;
983 land->lnd_item[I_SHELL] = arg;
986 land->lnd_item[I_GUN] = arg;
989 land->lnd_item[I_PETROL] = arg;
992 land->lnd_item[I_IRON] = arg;
995 land->lnd_item[I_DUST] = arg;
998 land->lnd_item[I_OIL] = arg;
1001 land->lnd_item[I_LCM] = arg;
1004 land->lnd_item[I_HCM] = arg;
1007 land->lnd_item[I_RAD] = arg;
1010 pr("huh? (%c)\n", op);
1018 doplane(char op, int arg, char *p, struct plnstr *plane)
1024 plane->pln_nuketype = arg;
1027 plane->pln_uid = arg;
1030 if (!sarg_xy(p, &newx, &newy))
1032 plane->pln_x = newx;
1033 plane->pln_y = newy;
1037 wu(player->cnum, plane->pln_own,
1038 "%s taken from you by deity intervention!\n",
1040 if (arg && arg < MAXNOC) {
1041 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1042 plane->pln_x, plane->pln_y);
1043 plane->pln_own = (natid)arg;
1044 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1045 plane->pln_x, plane->pln_y);
1046 wu(player->cnum, plane->pln_own,
1047 "%s given to you by deity intervention!\n", prplane(plane));
1049 plane->pln_effic = 0;
1052 plane->pln_effic = errcheck(arg, PLANE_MINEFF, 100);
1055 plane->pln_mobil = errcheck(arg, -127, 255);
1060 plchr[(int)plane->pln_type].pl_tech, SHRT_MAX));
1064 plane->pln_wing = 0;
1065 else if (isalpha(p[0]))
1066 plane->pln_wing = p[0];
1068 pr("%c: invalid wing\n", p[0]);
1073 warn_deprecated(op);
1074 plane->pln_att = arg;
1077 warn_deprecated(op);
1078 plane->pln_def = arg;
1081 plane->pln_range = (unsigned char)arg;
1084 plane->pln_ship = arg;
1087 plane->pln_land = arg;
1090 plane->pln_flags = arg;
1093 pr("huh? (%c)\n", op);