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
35 * Markus Armbruster, 2003-2006
62 static void benefit(natid, int);
63 static int docountry(char, int, char *, struct natstr *);
64 static int doland(char, int, char *, struct sctstr *);
65 static int doplane(char, int, char *, struct plnstr *);
66 static int doship(char, int, char *, struct shpstr *);
67 static int dounit(char, int, char *, struct lndstr *);
68 static int getin(char *, char **);
69 static void noise(struct sctstr *, char *, int, int);
70 static void pr_land(struct lndstr *);
71 static void pr_plane(struct plnstr *);
72 static void pr_ship(struct shpstr *);
73 static void prnat(struct natstr *);
74 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 np = natargp(player->argp[2], "Country? ");
116 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
118 if (!getplane(num, &plane))
122 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
124 if (!getship(num, &ship))
128 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
130 if (!getland(num, &land))
134 pr("Not implemented yet.\n");
140 if (player->argp[3] == 0) {
160 if (player->argp[arg_index] != 0) {
161 if (player->argp[arg_index+1] != 0) {
162 thing = player->argp[arg_index++][0];
163 ptr = player->argp[arg_index++];
167 } else if (arg_index == 3) {
168 err = getin(buf, &ptr);
198 if ((err = docountry(thing, arg, ptr, np)) != RET_OK)
202 if ((err = doland(thing, arg, ptr, §)) != RET_OK)
208 if ((err = doship(thing, arg, ptr, &ship)) != RET_OK)
210 if (!ef_ensure_space(EF_SHIP, ship.shp_uid, 50))
212 if (!putship(ship.shp_uid, &ship))
216 if ((err = dounit(thing, arg, ptr, &land)) != RET_OK)
218 if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50))
220 if (!putland(land.lnd_uid, &land))
224 if ((err = doplane(thing, arg, ptr, &plane)) != RET_OK)
226 if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))
228 if (!putplane(plane.pln_uid, &plane))
236 benefit(natid who, int good)
243 nreport(player->cnum, N_AIDS, who, 1);
246 nreport(player->cnum, N_HURTS, who, 1);
251 noise(struct sctstr *sptr, char *name, int old, int new)
253 pr("%s of %s changed from %d to %d\n",
254 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
256 wu(player->cnum, sptr->sct_own,
257 "%s in %s was changed from %d to %d by an act of %s\n",
258 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
259 old, new, cname(player->cnum));
260 benefit(sptr->sct_own, old < new);
264 prsect(struct sctstr *sect)
266 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
267 pr("Distribution sector <D>: %s\n",
268 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
269 pr("Designation <s>: %c\tNew designation <S>: %c\n",
270 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
271 pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
272 pr(" o O e m i g f c u w l x X p t F a\n");
273 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
274 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
275 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
276 sect->sct_uran, sect->sct_work, sect->sct_loyal,
277 sect->sct_che, sect->sct_che_target,
278 sect->sct_pstage, sect->sct_ptime,
279 sect->sct_fallout, sect->sct_avail);
281 pr("Mines <M>: %d\n", sect->sct_mines);
282 pr("Road %% <R>: %d\t", sect->sct_road);
283 pr("Rail %% <r>: %d\t", sect->sct_rail);
284 pr("Defense %% <d>: %d\n", sect->sct_defense);
289 prnat(struct natstr *np)
293 pr("Country #: %2d\n", np->nat_cnum);
294 pr("Name <n>: %-20s\t", np->nat_cnam);
295 pr("Representative <r>: %-20s\n", np->nat_pnam);
296 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
297 pr("Reserves <m>: %5ld\n", np->nat_reserve);
298 pr("Capital <c>: %s\t\t",
299 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
300 pr("Origin <o>: %3s\n",
301 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
302 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
303 pr("Min Used <u>: %3d\n", np->nat_minused);
304 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
305 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
306 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
307 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
308 pr("Money <M>: $%6ld\n", np->nat_money);
309 pr("Telegrams <t>: %6d\n", np->nat_tgms);
310 if (opt_DEMANDUPDATE)
311 pr("Updates missed <U>: %d\n", np->nat_missed);
313 pr("Countries contacted: ");
314 for (i = 0; i < MAXNOC; i++) {
315 if (getcontact(np, i))
316 pr("%d(%d) ", i, getcontact(np, i));
323 pr_plane(struct plnstr *plane)
325 pr("UID <U>: %d\t\t", plane->pln_uid);
326 pr("Owner <O>: %d\t\t", plane->pln_own);
327 pr("Location <l>: %s\n",
328 xyas(plane->pln_x, plane->pln_y, player->cnum));
329 pr("Efficiency <e>: %d\t", plane->pln_effic);
330 pr("Mobility <m>: %d\n", plane->pln_mobil);
331 pr("Tech <t>: %d\t\t", plane->pln_tech);
332 pr("Wing <w>: %.1s\n", &plane->pln_wing);
333 pr("Range <r>: %d\t\t", plane->pln_range);
334 pr("Flags <f>: %d\n", plane->pln_flags);
335 pr("Ship <s>: %d\t\t", plane->pln_ship);
336 pr("Land Unit <y>: %d\t", plane->pln_land);
337 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
341 pr_land(struct lndstr *land)
343 pr("UID <U>: %d\n", land->lnd_uid);
344 pr("Owner <O>: %d\n", land->lnd_own);
345 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
346 pr("Efficiency <e>: %d\t", land->lnd_effic);
347 pr("Mobility <M>: %d\n", land->lnd_mobil);
348 pr("Tech <t>: %d\t\t", land->lnd_tech);
349 pr("Army <a>: %.1s\n", &land->lnd_army);
350 pr("Fortification <F>: %d\t", land->lnd_harden);
351 pr("Fuel <B>: %d\n", land->lnd_fuel);
352 pr("Land unit <Y>: %d\n", land->lnd_land);
353 pr("Ship <S>: %d\t\t", land->lnd_ship);
354 pr("Radius <P>: %d\n", land->lnd_rad_max);
355 pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
356 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
357 land->lnd_rpath, land->lnd_rflags);
358 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
359 pr(" c m u f s g p i d o l h r\n");
360 pr("%3d", land->lnd_item[I_CIVIL]);
361 pr("%4d", land->lnd_item[I_MILIT]);
362 pr("%4d", land->lnd_item[I_UW]);
363 pr("%5d", land->lnd_item[I_FOOD]);
364 pr("%4d", land->lnd_item[I_SHELL]);
365 pr("%4d", land->lnd_item[I_GUN]);
366 pr("%5d", land->lnd_item[I_PETROL]);
367 pr("%5d", land->lnd_item[I_IRON]);
368 pr("%5d", land->lnd_item[I_DUST]);
369 pr("%5d", land->lnd_item[I_OIL]);
370 pr("%5d", land->lnd_item[I_LCM]);
371 pr("%5d", land->lnd_item[I_HCM]);
372 pr("%4d", land->lnd_item[I_RAD]);
377 pr_ship(struct shpstr *ship)
381 if ((natp = getnatp(ship->shp_own)) == 0)
383 pr("%s (#%d) %s\n", natp->nat_cnam, ship->shp_own, prship(ship));
384 pr("UID <U>: %d\n", ship->shp_uid);
385 pr("Owner <O>: %d\t\t\t", ship->shp_own);
386 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
387 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
388 pr("Efficiency <E>: %d\n", ship->shp_effic);
389 pr("Mobility <M>: %d\t\t", ship->shp_mobil);
390 pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
391 /* could depend on opt_FUEL - but a deity might want to set this
392 up before enabling the option */
393 pr("Fuel <B>: %d\n", ship->shp_fuel);
394 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
395 ship->shp_rpath, ship->shp_rflags);
396 pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
397 pr("Plague Time <b>: %d\n", ship->shp_ptime);
398 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
399 pr(" c m u f s g p i d o l h r\n");
400 pr("%3d", ship->shp_item[I_CIVIL]);
401 pr("%4d", ship->shp_item[I_MILIT]);
402 pr("%4d", ship->shp_item[I_UW]);
403 pr("%5d", ship->shp_item[I_FOOD]);
404 pr("%4d", ship->shp_item[I_SHELL]);
405 pr("%4d", ship->shp_item[I_GUN]);
406 pr("%5d", ship->shp_item[I_PETROL]);
407 pr("%5d", ship->shp_item[I_IRON]);
408 pr("%5d", ship->shp_item[I_DUST]);
409 pr("%5d", ship->shp_item[I_OIL]);
410 pr("%5d", ship->shp_item[I_LCM]);
411 pr("%5d", ship->shp_item[I_HCM]);
412 pr("%4d", ship->shp_item[I_RAD]);
417 errcheck(int num, int min, int max)
427 getin(char *buf, char **valp)
432 p = getstarg(NULL, "%c xxxxx -- thing value : ", buf);
437 for (; isspace(*p); p++) ;
441 for (; *p && !isspace(*p); p++) ;
442 for (; isspace(*p); p++) ;
450 warn_deprecated(char key)
452 pr("Key <%c> is deprecated and will go away in a future release\n", key);
456 doland(char op, int arg, char *p, struct sctstr *sect)
458 natid newown, oldown;
467 sect->sct_coastal = (arg ? 1 : 0);
468 pr("Coastal flag of %s changed to %d\n",
469 xyas(sect->sct_x, sect->sct_y, player->cnum),
475 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
476 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
477 xyas(sect->sct_x, sect->sct_y, player->cnum),
478 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
480 makelost(EF_SECTOR, sect->sct_own, 0,
481 sect->sct_x, sect->sct_y);
482 wu(player->cnum, sect->sct_own,
483 "Sector %s lost to deity intervention\n",
484 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
486 benefit(sect->sct_own, 0);
487 sect->sct_own = newown;
489 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
490 wu(player->cnum, newown,
491 "Sector %s gained from deity intervention\n",
492 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
499 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
500 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
501 xyas(sect->sct_x, sect->sct_y, player->cnum),
502 cname(sect->sct_oldown),
503 sect->sct_oldown, cname(oldown), oldown);
504 sect->sct_oldown = oldown;
507 new = errcheck(arg, 0, 100);
508 noise(sect, "Efficiency", sect->sct_effic, new);
509 sect->sct_effic = (unsigned char)new;
512 new = errcheck(arg, -127, 255);
513 noise(sect, "Mobility", sect->sct_mobil, new);
514 sect->sct_mobil = new;
517 new = errcheck(arg, 0, 127);
518 noise(sect, "Iron ore content", sect->sct_min, new);
519 sect->sct_min = (unsigned char)new;
522 new = errcheck(arg, 0, 127);
523 noise(sect, "Gold content", sect->sct_gmin, new);
524 sect->sct_gmin = (unsigned char)new;
527 new = errcheck(arg, 0, 127);
528 noise(sect, "Fertility", sect->sct_fertil, new);
529 sect->sct_fertil = (unsigned char)new;
532 new = errcheck(arg, 0, 127);
533 noise(sect, "Oil content", sect->sct_oil, new);
534 sect->sct_oil = (unsigned char)new;
537 new = errcheck(arg, 0, 127);
538 noise(sect, "Uranium content", sect->sct_uran, new);
539 sect->sct_uran = (unsigned char)new;
542 new = errcheck(arg, 0, 100);
543 noise(sect, "Workforce percentage", sect->sct_work, new);
544 sect->sct_work = (unsigned char)new;
547 new = errcheck(arg, 0, 127);
548 pr("Loyalty of %s changed from %d to %d%%\n",
549 xyas(sect->sct_x, sect->sct_y, player->cnum),
550 sect->sct_loyal, new);
551 sect->sct_loyal = (unsigned char)new;
555 new = errcheck(arg, 0, CHE_MAX);
556 pr("Guerillas in %s changed from %d to %d\n",
557 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
561 old = sect->sct_che_target;
562 new = errcheck(arg, 0, MAXNOC - 1);
563 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
564 xyas(sect->sct_x, sect->sct_y, player->cnum),
565 cname(old), old, cname(new), new);
566 sect->sct_che_target = new;
569 old = sect->sct_pstage;
570 new = errcheck(arg, 0, PLG_EXPOSED);
571 pr("Plague stage of %s changed from %d to %d%%\n",
572 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
573 sect->sct_pstage = new;
576 old = sect->sct_ptime;
577 new = errcheck(arg, 0, 255);
578 pr("Plague time of %s changed from %d to %d%%\n",
579 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
580 sect->sct_ptime = new;
583 old = sect->sct_fallout;
584 new = errcheck(arg, 0, FALLOUT_MAX);
585 pr("Fallout for sector %s changed from %d to %d\n",
586 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
587 sect->sct_fallout = new;
590 new = errcheck(arg, 0, 9999);
591 noise(sect, "Available workforce", sect->sct_avail, new);
592 sect->sct_avail = new;
595 new = errcheck(arg, 0, MINES_MAX);
596 sect->sct_mines = new;
597 pr("Mines changed to %d\n", new);
600 if (!sarg_xy(p, &newx, &newy))
606 if (!sarg_xy(p, &newx, &newy))
608 pr("Distribution Location for sector %s changed from %s to %s\n",
609 xyas(sect->sct_x, sect->sct_y, player->cnum),
610 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
611 xyas(newx, newy, player->cnum));
612 sect->sct_dist_x = newx;
613 sect->sct_dist_y = newy;
616 des = sct_typematch(p);
619 pr("Designation for sector %s changed from %c to %c\n",
620 xyas(sect->sct_x, sect->sct_y, player->cnum),
621 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
622 set_coastal(sect, des);
623 sect->sct_type = des;
626 des = sct_typematch(p);
629 pr("New Designation for sector %s changed from %c to %c\n",
630 xyas(sect->sct_x, sect->sct_y, player->cnum),
631 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
632 sect->sct_newtype = des;
639 noise(sect, "Road percentage", sect->sct_road, arg);
640 sect->sct_road = arg;
647 noise(sect, "Rail percentage", sect->sct_rail, arg);
648 sect->sct_rail = arg;
655 noise(sect, "Defense percentage", sect->sct_defense, arg);
656 sect->sct_defense = arg;
659 pr("huh? (%c)\n", op);
667 docountry(char op, int arg, char *p, struct natstr *np)
670 natid nat = np->nat_cnum;
671 float farg = (float)atof(p);
675 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
676 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
679 pr("Country representative changed from %s to %s\n",
681 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
687 arg = errcheck(arg, 0, 1024);
688 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
692 benefit(nat, np->nat_reserve < arg);
693 pr("Military Reserves changed from %ld to %d\n",
694 np->nat_reserve, arg);
695 wu(player->cnum, nat,
696 "Military Reserves changed from %ld to %d by divine intervention.\n",
697 np->nat_reserve, arg);
698 np->nat_reserve = arg;
701 if (!sarg_xy(p, &newx, &newy))
703 pr("Capital coordinates changed from %s to %s\n",
704 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
705 xyas(newx, newy, player->cnum));
710 if (!sarg_xy(p, &newx, &newy))
712 pr("Origin coordinates changed from %s to %s\n",
713 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
714 xyas(newx, newy, player->cnum));
719 np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
722 arg = errcheck(arg, 0, m_m_p_d);
723 pr("Number of minutes used changed from %d to %d.\n",
724 np->nat_minused, arg);
725 np->nat_minused = arg;
728 pr("Money changed from %ld to %d\n", np->nat_money, arg);
729 wu(player->cnum, nat,
730 "Money changed from %ld to %d by divine intervention.\n",
735 pr("Tech changed from %.2f to %.2f.\n",
736 np->nat_level[NAT_TLEV], farg);
737 np->nat_level[NAT_TLEV] = farg;
740 pr("Research changed from %.2f to %.2f.\n",
741 np->nat_level[NAT_RLEV], farg);
742 np->nat_level[NAT_RLEV] = farg;
745 pr("Education changed from %.2f to %.2f.\n",
746 np->nat_level[NAT_ELEV], farg);
747 np->nat_level[NAT_ELEV] = farg;
750 pr("Happiness changed from %.2f to %.2f.\n",
751 np->nat_level[NAT_HLEV], farg);
752 np->nat_level[NAT_HLEV] = farg;
755 np->nat_missed = arg;
758 pr("huh? (%c)\n", op);
767 doship(char op, int arg, char *p, struct shpstr *ship)
774 ship->shp_pstage = arg;
777 ship->shp_ptime = arg;
780 strncpy(ship->shp_rpath, p, sizeof(ship->shp_rpath) - 1);
783 ship->shp_rflags = arg;
787 ship->shp_nchoppers = arg;
791 ship->shp_nxlight = arg;
798 wu(player->cnum, ship->shp_own,
799 "%s taken from you by deity intervention!\n", prship(ship));
800 if (arg && arg < MAXNOC) {
801 wu(player->cnum, (natid)arg,
802 "%s given to you by deity intervention!\n", prship(ship));
803 makelost(EF_SHIP, ship->shp_own, ship->shp_uid,
804 ship->shp_x, ship->shp_y);
805 ship->shp_own = (natid)arg;
806 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid,
807 ship->shp_x, ship->shp_y);
810 makelost(EF_SHIP, ship->shp_own, ship->shp_uid,
811 ship->shp_x, ship->shp_y);
812 ship->shp_own = (natid)0;
816 if (!sarg_xy(p, &newx, &newy))
824 mchr[(int)ship->shp_type].m_tech, SHRT_MAX));
827 ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
830 ship->shp_mobil = arg;
833 ship->shp_fuel = errcheck(arg, 0, 255);
838 else if (isalpha(p[0]))
839 ship->shp_fleet = p[0];
841 pr("%c: invalid fleet\n", p[0]);
847 ship->shp_nland = errcheck(arg, 0, 100);
851 ship->shp_nplane = errcheck(arg, 0, 100);
854 ship->shp_item[I_CIVIL] = arg;
857 ship->shp_item[I_MILIT] = arg;
860 ship->shp_item[I_UW] = arg;
863 ship->shp_item[I_FOOD] = arg;
866 ship->shp_item[I_SHELL] = arg;
869 ship->shp_item[I_GUN] = arg;
872 ship->shp_item[I_PETROL] = arg;
875 ship->shp_item[I_IRON] = arg;
878 ship->shp_item[I_DUST] = arg;
881 ship->shp_item[I_OIL] = arg;
884 ship->shp_item[I_LCM] = arg;
887 ship->shp_item[I_HCM] = arg;
890 ship->shp_item[I_RAD] = arg;
893 pr("huh? (%c)\n", op);
900 dounit(char op, int arg, char *p, struct lndstr *land)
907 land->lnd_land = arg;
914 wu(player->cnum, land->lnd_own,
915 "%s taken from you by deity intervention!\n", prland(land));
917 if (arg && arg < MAXNOC) {
918 wu(player->cnum, (natid)arg,
919 "%s given to you by deity intervention!\n", prland(land));
920 makelost(EF_LAND, land->lnd_own, land->lnd_uid,
921 land->lnd_x, land->lnd_y);
922 land->lnd_own = (natid)arg;
923 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid,
924 land->lnd_x, land->lnd_y);
926 makelost(EF_LAND, land->lnd_own, land->lnd_uid,
927 land->lnd_x, land->lnd_y);
929 land->lnd_own = (natid)0;
933 if (!sarg_xy(p, &newx, &newy))
939 land->lnd_effic = errcheck(arg, LAND_MINEFF, 100);
942 land->lnd_mobil = arg;
947 lchr[(int)land->lnd_type].l_tech, SHRT_MAX));
952 else if (isalpha(p[0]))
953 land->lnd_army = p[0];
955 pr("%c: invalid army\n", p[0]);
960 land->lnd_harden = errcheck(arg, 0, 255);
963 land->lnd_fuel = errcheck(arg, 0, 255);
967 land->lnd_nxlight = arg;
970 land->lnd_ship = arg;
973 land->lnd_rad_max = arg;
976 land->lnd_retreat = arg;
979 strncpy(land->lnd_rpath, p, sizeof(land->lnd_rpath) - 1);
982 land->lnd_rflags = arg;
985 land->lnd_item[I_CIVIL] = arg;
988 land->lnd_item[I_MILIT] = arg;
991 land->lnd_item[I_UW] = arg;
994 land->lnd_item[I_FOOD] = arg;
997 land->lnd_item[I_SHELL] = arg;
1000 land->lnd_item[I_GUN] = arg;
1003 land->lnd_item[I_PETROL] = arg;
1006 land->lnd_item[I_IRON] = arg;
1009 land->lnd_item[I_DUST] = arg;
1012 land->lnd_item[I_OIL] = arg;
1015 land->lnd_item[I_LCM] = arg;
1018 land->lnd_item[I_HCM] = arg;
1021 land->lnd_item[I_RAD] = arg;
1024 pr("huh? (%c)\n", op);
1032 doplane(char op, int arg, char *p, struct plnstr *plane)
1038 plane->pln_nuketype = arg;
1041 plane->pln_uid = arg;
1044 if (!sarg_xy(p, &newx, &newy))
1046 plane->pln_x = newx;
1047 plane->pln_y = newy;
1051 wu(player->cnum, plane->pln_own,
1052 "%s taken from you by deity intervention!\n",
1054 if (arg && arg < MAXNOC) {
1055 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1056 plane->pln_x, plane->pln_y);
1057 plane->pln_own = (natid)arg;
1058 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1059 plane->pln_x, plane->pln_y);
1060 wu(player->cnum, plane->pln_own,
1061 "%s given to you by deity intervention!\n", prplane(plane));
1063 plane->pln_effic = 0;
1064 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1065 plane->pln_x, plane->pln_y);
1066 plane->pln_own = (natid)0;
1070 plane->pln_effic = errcheck(arg, PLANE_MINEFF, 100);
1073 plane->pln_mobil = errcheck(arg, -127, 255);
1078 plchr[(int)plane->pln_type].pl_tech, SHRT_MAX));
1082 plane->pln_wing = 0;
1083 else if (isalpha(p[0]))
1084 plane->pln_wing = p[0];
1086 pr("%c: invalid wing\n", p[0]);
1091 warn_deprecated(op);
1092 plane->pln_att = arg;
1095 warn_deprecated(op);
1096 plane->pln_def = arg;
1099 plane->pln_range = (unsigned char)arg;
1102 plane->pln_ship = arg;
1105 plane->pln_land = arg;
1108 plane->pln_flags = arg;
1111 pr("huh? (%c)\n", op);