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\t New 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\t", 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>: %c\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>: %c\n", land->lnd_army);
350 pr("Fortification <F>: %d\t", land->lnd_harden);
351 pr("Fuel <B>: %d\n", land->lnd_fuel);
352 count_land_planes(land);
353 pr("Land unit <Y>: %d\n", land->lnd_land);
354 pr("Ship <S>: %d\t\t", land->lnd_ship);
355 pr("Radius <P>: %d\n", land->lnd_rad_max);
356 pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
357 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
358 land->lnd_rpath, land->lnd_rflags);
359 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
360 pr(" c m u f s g p i d o l h r\n");
361 pr("%3d", land->lnd_item[I_CIVIL]);
362 pr("%4d", land->lnd_item[I_MILIT]);
363 pr("%4d", land->lnd_item[I_UW]);
364 pr("%5d", land->lnd_item[I_FOOD]);
365 pr("%4d", land->lnd_item[I_SHELL]);
366 pr("%4d", land->lnd_item[I_GUN]);
367 pr("%5d", land->lnd_item[I_PETROL]);
368 pr("%5d", land->lnd_item[I_IRON]);
369 pr("%5d", land->lnd_item[I_DUST]);
370 pr("%5d", land->lnd_item[I_OIL]);
371 pr("%5d", land->lnd_item[I_LCM]);
372 pr("%5d", land->lnd_item[I_HCM]);
373 pr("%4d", land->lnd_item[I_RAD]);
378 pr_ship(struct shpstr *ship)
382 if ((natp = getnatp(ship->shp_own)) == 0)
384 pr("%s (#%d) %s\n", natp->nat_cnam, ship->shp_own, prship(ship));
385 pr("UID <U>: %d\n", ship->shp_uid);
386 pr("Owner <O>: %d\t\t\t", ship->shp_own);
387 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
388 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
389 pr("Efficiency <E>: %d\n", ship->shp_effic);
390 pr("Mobility <M>: %d\t\t", ship->shp_mobil);
391 pr("Fleet <F>: %c\n", ship->shp_fleet);
394 /* could depend on opt_FUEL - but a deity might want to set this
395 up before enabling the option */
396 pr("Fuel <B>: %d\t\t\t", ship->shp_fuel);
397 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
398 ship->shp_rpath, ship->shp_rflags);
399 pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
400 pr("Plague Time <b>: %d\n", ship->shp_ptime);
401 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
402 pr(" c m u f s g p i d o l h r\n");
403 pr("%3d", ship->shp_item[I_CIVIL]);
404 pr("%4d", ship->shp_item[I_MILIT]);
405 pr("%4d", ship->shp_item[I_UW]);
406 pr("%5d", ship->shp_item[I_FOOD]);
407 pr("%4d", ship->shp_item[I_SHELL]);
408 pr("%4d", ship->shp_item[I_GUN]);
409 pr("%5d", ship->shp_item[I_PETROL]);
410 pr("%5d", ship->shp_item[I_IRON]);
411 pr("%5d", ship->shp_item[I_DUST]);
412 pr("%5d", ship->shp_item[I_OIL]);
413 pr("%5d", ship->shp_item[I_LCM]);
414 pr("%5d", ship->shp_item[I_HCM]);
415 pr("%4d", ship->shp_item[I_RAD]);
420 errcheck(int num, int min, int max)
430 getin(char *buf, char **valp)
435 p = getstarg(NULL, "%c xxxxx -- thing value : ", buf);
440 for (; isspace(*p); p++) ;
444 for (; *p && !isspace(*p); p++) ;
445 for (; isspace(*p); p++) ;
453 warn_deprecated(char key)
455 pr("Key <%c> is deprecated and will go away in a future release\n", key);
459 doland(char op, int arg, char *p, struct sctstr *sect)
461 natid newown, oldown;
470 sect->sct_coastal = (arg ? 1 : 0);
471 pr("Coastal flag of %s changed to %d\n",
472 xyas(sect->sct_x, sect->sct_y, player->cnum),
478 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
479 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
480 xyas(sect->sct_x, sect->sct_y, player->cnum),
481 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
483 makelost(EF_SECTOR, sect->sct_own, 0,
484 sect->sct_x, sect->sct_y);
485 wu(player->cnum, sect->sct_own,
486 "Sector %s lost to deity intervention\n",
487 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
489 benefit(sect->sct_own, 0);
490 sect->sct_own = newown;
492 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
493 wu(player->cnum, newown,
494 "Sector %s gained from deity intervention\n",
495 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
502 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
503 pr("Old 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_oldown),
506 sect->sct_oldown, cname(oldown), oldown);
507 sect->sct_oldown = oldown;
510 new = errcheck(arg, 0, 100);
511 noise(sect, "Efficiency", sect->sct_effic, new);
512 sect->sct_effic = (unsigned char)new;
515 new = errcheck(arg, -127, 255);
516 noise(sect, "Mobility", sect->sct_mobil, new);
517 sect->sct_mobil = new;
520 new = errcheck(arg, 0, 127);
521 noise(sect, "Iron ore content", sect->sct_min, new);
522 sect->sct_min = (unsigned char)new;
525 new = errcheck(arg, 0, 127);
526 noise(sect, "Gold content", sect->sct_gmin, new);
527 sect->sct_gmin = (unsigned char)new;
530 new = errcheck(arg, 0, 127);
531 noise(sect, "Fertility", sect->sct_fertil, new);
532 sect->sct_fertil = (unsigned char)new;
535 new = errcheck(arg, 0, 127);
536 noise(sect, "Oil content", sect->sct_oil, new);
537 sect->sct_oil = (unsigned char)new;
540 new = errcheck(arg, 0, 127);
541 noise(sect, "Uranium content", sect->sct_uran, new);
542 sect->sct_uran = (unsigned char)new;
545 new = errcheck(arg, 0, 100);
546 noise(sect, "Workforce percentage", sect->sct_work, new);
547 sect->sct_work = (unsigned char)new;
550 new = errcheck(arg, 0, 127);
551 pr("Loyalty of %s changed from %d to %d%%\n",
552 xyas(sect->sct_x, sect->sct_y, player->cnum),
553 sect->sct_loyal, new);
554 sect->sct_loyal = (unsigned char)new;
558 new = errcheck(arg, 0, CHE_MAX);
559 pr("Guerillas in %s changed from %d to %d\n",
560 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
564 old = sect->sct_che_target;
565 new = errcheck(arg, 0, MAXNOC - 1);
566 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
567 xyas(sect->sct_x, sect->sct_y, player->cnum),
568 cname(old), old, cname(new), new);
569 sect->sct_che_target = new;
572 old = sect->sct_pstage;
573 new = errcheck(arg, 0, PLG_EXPOSED);
574 pr("Plague stage of %s changed from %d to %d%%\n",
575 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
576 sect->sct_pstage = new;
579 old = sect->sct_ptime;
580 new = errcheck(arg, 0, 255);
581 pr("Plague time of %s changed from %d to %d%%\n",
582 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
583 sect->sct_ptime = new;
586 old = sect->sct_fallout;
587 new = errcheck(arg, 0, FALLOUT_MAX);
588 pr("Fallout for sector %s changed from %d to %d\n",
589 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
590 sect->sct_fallout = new;
593 new = errcheck(arg, 0, 9999);
594 noise(sect, "Available workforce", sect->sct_avail, new);
595 sect->sct_avail = new;
598 new = errcheck(arg, 0, MINES_MAX);
599 sect->sct_mines = new;
600 pr("Mines changed to %d\n", new);
603 if (!sarg_xy(p, &newx, &newy))
609 if (!sarg_xy(p, &newx, &newy))
611 pr("Distribution Location for sector %s changed from %s to %s\n",
612 xyas(sect->sct_x, sect->sct_y, player->cnum),
613 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
614 xyas(newx, newy, player->cnum));
615 sect->sct_dist_x = newx;
616 sect->sct_dist_y = newy;
619 des = sct_typematch(p);
622 pr("Designation for sector %s changed from %c to %c\n",
623 xyas(sect->sct_x, sect->sct_y, player->cnum),
624 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
625 set_coastal(sect, des);
626 sect->sct_type = des;
629 des = sct_typematch(p);
632 pr("New Designation for sector %s changed from %c to %c\n",
633 xyas(sect->sct_x, sect->sct_y, player->cnum),
634 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
635 sect->sct_newtype = des;
642 noise(sect, "Road percentage", sect->sct_road, arg);
643 sect->sct_road = arg;
650 noise(sect, "Rail percentage", sect->sct_rail, arg);
651 sect->sct_rail = arg;
658 noise(sect, "Defense percentage", sect->sct_defense, arg);
659 sect->sct_defense = arg;
662 pr("huh? (%c)\n", op);
670 docountry(char op, int arg, char *p, struct natstr *np)
673 natid nat = np->nat_cnum;
674 float farg = (float)atof(p);
678 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
679 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
682 pr("Country representative changed from %s to %s\n",
684 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
690 arg = errcheck(arg, 0, 1024);
691 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
695 benefit(nat, np->nat_reserve < arg);
696 pr("Military Reserves changed from %ld to %d\n",
697 np->nat_reserve, arg);
698 wu(player->cnum, nat,
699 "Military Reserves changed from %ld to %d by divine intervention.\n",
700 np->nat_reserve, arg);
701 np->nat_reserve = arg;
704 if (!sarg_xy(p, &newx, &newy))
706 pr("Capital coordinates changed from %s to %s\n",
707 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
708 xyas(newx, newy, player->cnum));
713 if (!sarg_xy(p, &newx, &newy))
715 pr("Origin coordinates changed from %s to %s\n",
716 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
717 xyas(newx, newy, player->cnum));
722 np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
725 arg = errcheck(arg, 0, m_m_p_d);
726 pr("Number of minutes used changed from %d to %d.\n",
727 np->nat_minused, arg);
728 np->nat_minused = arg;
731 pr("Money changed from %ld to %d\n", np->nat_money, arg);
732 wu(player->cnum, nat,
733 "Money changed from %ld to %d by divine intervention.\n",
738 pr("Tech changed from %.2f to %.2f.\n",
739 np->nat_level[NAT_TLEV], farg);
740 np->nat_level[NAT_TLEV] = farg;
743 pr("Research changed from %.2f to %.2f.\n",
744 np->nat_level[NAT_RLEV], farg);
745 np->nat_level[NAT_RLEV] = farg;
748 pr("Education changed from %.2f to %.2f.\n",
749 np->nat_level[NAT_ELEV], farg);
750 np->nat_level[NAT_ELEV] = farg;
753 pr("Happiness changed from %.2f to %.2f.\n",
754 np->nat_level[NAT_HLEV], farg);
755 np->nat_level[NAT_HLEV] = farg;
758 np->nat_missed = arg;
761 pr("huh? (%c)\n", op);
770 doship(char op, int arg, char *p, struct shpstr *ship)
777 ship->shp_pstage = arg;
780 ship->shp_ptime = arg;
783 strncpy(ship->shp_rpath, p, sizeof(ship->shp_rpath) - 1);
786 ship->shp_rflags = arg;
790 ship->shp_nchoppers = arg;
794 ship->shp_nxlight = arg;
801 wu(player->cnum, ship->shp_own,
802 "%s taken from you by deity intervention!\n", prship(ship));
803 if (arg && arg < MAXNOC) {
804 wu(player->cnum, (natid)arg,
805 "%s given to you by deity intervention!\n", prship(ship));
806 makelost(EF_SHIP, ship->shp_own, ship->shp_uid,
807 ship->shp_x, ship->shp_y);
808 ship->shp_own = (natid)arg;
809 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid,
810 ship->shp_x, ship->shp_y);
813 makelost(EF_SHIP, ship->shp_own, ship->shp_uid,
814 ship->shp_x, ship->shp_y);
815 ship->shp_own = (natid)0;
819 if (!sarg_xy(p, &newx, &newy))
827 mchr[(int)ship->shp_type].m_tech, SHRT_MAX));
830 ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
833 ship->shp_mobil = arg;
836 ship->shp_fuel = errcheck(arg, 0, 255);
840 ship->shp_fleet = ' ';
841 else if (isalpha(p[0]))
842 ship->shp_fleet = p[0];
844 pr("%c: invalid fleet\n", p[0]);
850 ship->shp_nland = errcheck(arg, 0, 100);
854 ship->shp_nplane = errcheck(arg, 0, 100);
857 ship->shp_item[I_CIVIL] = arg;
860 ship->shp_item[I_MILIT] = arg;
863 ship->shp_item[I_UW] = arg;
866 ship->shp_item[I_FOOD] = arg;
869 ship->shp_item[I_SHELL] = arg;
872 ship->shp_item[I_GUN] = arg;
875 ship->shp_item[I_PETROL] = arg;
878 ship->shp_item[I_IRON] = arg;
881 ship->shp_item[I_DUST] = arg;
884 ship->shp_item[I_OIL] = arg;
887 ship->shp_item[I_LCM] = arg;
890 ship->shp_item[I_HCM] = arg;
893 ship->shp_item[I_RAD] = arg;
896 pr("huh? (%c)\n", op);
903 dounit(char op, int arg, char *p, struct lndstr *land)
910 land->lnd_land = arg;
917 wu(player->cnum, land->lnd_own,
918 "%s taken from you by deity intervention!\n", prland(land));
920 if (arg && arg < MAXNOC) {
921 wu(player->cnum, (natid)arg,
922 "%s given to you by deity intervention!\n", prland(land));
923 makelost(EF_LAND, land->lnd_own, land->lnd_uid,
924 land->lnd_x, land->lnd_y);
925 land->lnd_own = (natid)arg;
926 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid,
927 land->lnd_x, land->lnd_y);
929 makelost(EF_LAND, land->lnd_own, land->lnd_uid,
930 land->lnd_x, land->lnd_y);
932 land->lnd_own = (natid)0;
936 if (!sarg_xy(p, &newx, &newy))
942 land->lnd_effic = errcheck(arg, LAND_MINEFF, 100);
945 land->lnd_mobil = arg;
950 lchr[(int)land->lnd_type].l_tech, SHRT_MAX));
954 land->lnd_army = ' ';
955 else if (isalpha(p[0]))
956 land->lnd_army = p[0];
958 pr("%c: invalid army\n", p[0]);
963 land->lnd_harden = errcheck(arg, 0, 255);
966 land->lnd_fuel = errcheck(arg, 0, 255);
970 land->lnd_nxlight = arg;
973 land->lnd_ship = arg;
976 land->lnd_rad_max = arg;
979 land->lnd_retreat = arg;
982 strncpy(land->lnd_rpath, p, sizeof(land->lnd_rpath) - 1);
985 land->lnd_rflags = arg;
988 land->lnd_item[I_CIVIL] = arg;
991 land->lnd_item[I_MILIT] = arg;
994 land->lnd_item[I_UW] = arg;
997 land->lnd_item[I_FOOD] = arg;
1000 land->lnd_item[I_SHELL] = arg;
1003 land->lnd_item[I_GUN] = arg;
1006 land->lnd_item[I_PETROL] = arg;
1009 land->lnd_item[I_IRON] = arg;
1012 land->lnd_item[I_DUST] = arg;
1015 land->lnd_item[I_OIL] = arg;
1018 land->lnd_item[I_LCM] = arg;
1021 land->lnd_item[I_HCM] = arg;
1024 land->lnd_item[I_RAD] = arg;
1027 pr("huh? (%c)\n", op);
1035 doplane(char op, int arg, char *p, struct plnstr *plane)
1041 plane->pln_nuketype = arg;
1044 plane->pln_uid = arg;
1047 if (!sarg_xy(p, &newx, &newy))
1049 plane->pln_x = newx;
1050 plane->pln_y = newy;
1054 wu(player->cnum, plane->pln_own,
1055 "%s taken from you by deity intervention!\n",
1057 if (arg && arg < MAXNOC) {
1058 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1059 plane->pln_x, plane->pln_y);
1060 plane->pln_own = (natid)arg;
1061 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1062 plane->pln_x, plane->pln_y);
1063 wu(player->cnum, plane->pln_own,
1064 "%s given to you by deity intervention!\n", prplane(plane));
1066 plane->pln_effic = 0;
1067 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1068 plane->pln_x, plane->pln_y);
1069 plane->pln_own = (natid)0;
1073 plane->pln_effic = errcheck(arg, PLANE_MINEFF, 100);
1076 plane->pln_mobil = errcheck(arg, -127, 255);
1081 plchr[(int)plane->pln_type].pl_tech, SHRT_MAX));
1085 plane->pln_wing = ' ';
1086 else if (isalpha(p[0]))
1087 plane->pln_wing = p[0];
1089 pr("%c: invalid wing\n", p[0]);
1094 warn_deprecated(op);
1095 plane->pln_att = arg;
1098 warn_deprecated(op);
1099 plane->pln_def = arg;
1102 plane->pln_range = (unsigned char)arg;
1105 plane->pln_ship = arg;
1108 plane->pln_land = arg;
1111 plane->pln_flags = arg;
1114 pr("huh? (%c)\n", op);