2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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 the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * 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
60 static void benefit(natid who, int good);
61 static int docountry(s_char op, int arg, s_char *p, float farg, natid nat,
63 static int doland(s_char op, int arg, s_char *p, struct sctstr *sect);
64 static int doplane(s_char op, int arg, s_char *p, struct plnstr *plane);
65 static int doship(s_char op, int arg, s_char *p, struct shpstr *ship);
66 static int dounit(s_char op, int arg, s_char *p, struct lndstr *land);
67 static int getin(s_char **, s_char **, int *, s_char *);
68 static void noise(struct sctstr *sptr, int public_amt, s_char *name,
70 static void pr_land(struct lndstr *land);
71 static void pr_plane(struct plnstr *plane);
72 static void pr_ship(struct shpstr *ship);
73 static void prnat(natid n);
74 static void prsect(struct sctstr *sect);
96 s_char ewhat; /* saves information from the command line
99 if ((what = getstarg(player->argp[1],
100 "Edit What (country, land, ship, plane, nuke, unit)? ",
106 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
108 if (!sarg_xy(ptr, &x, &y))
110 if (!getsect(x, y, §))
114 if ((num = natarg(player->argp[2], "Country number? ")) < 0)
120 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
122 if (!getplane(num, &plane))
126 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
128 if (!getship(num, &ship))
132 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
134 if (!getland(num, &land))
138 pr("Not implemented yet.\n");
144 if (player->argp[3] == 0) {
166 if (player->argp[arg_index] != 0) {
167 if (player->argp[arg_index+1] != 0) {
168 thing = player->argp[arg_index++];
169 ptr = player->argp[arg_index++];
173 } else if (arg_index == 3) {
174 if ((err = getin(&thing, &ptr, &arg, buf)) != RET_OK) {
202 if ((err = docountry(thing[0], arg, ptr, farg, nat, np))
207 if ((err = doland(thing[0], arg, ptr, §)) != RET_OK)
213 if ((err = doship(thing[0], arg, ptr, &ship)) != RET_OK)
215 if (!putship(ship.shp_uid, &ship))
219 if ((err = dounit(thing[0], arg, ptr, &land))
222 if (!putland(land.lnd_uid, &land))
226 if ((err = doplane(thing[0], arg, ptr, &plane))
229 if (!putplane(plane.pln_uid, &plane))
242 benefit(natid who, int good)
249 nreport(player->cnum, N_AIDS, who, 1);
252 nreport(player->cnum, N_HURTS, who, 1);
257 noise(struct sctstr *sptr, int public_amt, s_char *name, int old, int new)
261 pr("%s of %s changed from %d to %d\n",
262 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
264 (void)sprintf(p, "changed from %d to %d", old, new);
266 (void)sprintf(p, "%s", (old < new ? "increased" : "decreased"));
268 wu(player->cnum, sptr->sct_own,
269 "%s in %s was %s by an act of %s\n",
270 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
271 p, cname(player->cnum));
272 benefit(sptr->sct_own, (old < new));
276 prsect(struct sctstr *sect)
278 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
279 pr("Distribution sector <D>: %s\n",
280 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
281 pr("Designation <s>: %c\t New designation <S>: %c\n",
282 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
283 pr("own oo eff mob min gld frt oil urn wrk lty che plg ptime fall avail\n");
284 pr(" o O e m i g f c u w l x p t F a\n");
285 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %4d %3d %5d %4d %5d\n",
286 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
287 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
288 sect->sct_uran, sect->sct_work, sect->sct_loyal,
289 getvar(V_CHE, (s_char *)sect, EF_SECTOR),
290 getvar(V_PSTAGE, (s_char *)sect, EF_SECTOR),
291 getvar(V_PTIME, (s_char *)sect, EF_SECTOR),
292 getvar(V_FALLOUT, (s_char *)sect, EF_SECTOR), sect->sct_avail);
294 pr("Mines <M>: %d\t", getvar(V_MINE, (s_char *)sect, EF_SECTOR));
295 pr("Coastal <C>: %d\n", sect->sct_coastal);
296 pr("Road %% <R>: %d\t", sect->sct_road);
297 pr("Rail %% <r>: %d\t", sect->sct_rail);
298 pr("Defense %% <d>: %d\n", sect->sct_defense);
308 if ((np = getnatp(n)) == 0)
310 pr("Country #: %2d\n", n);
311 pr("Name <n>: %-20s\t", np->nat_cnam);
312 pr("Connected: %d\n", np->nat_connected);
313 pr("Representative <r>: %-20s\n", np->nat_pnam);
314 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
315 pr("Reserves <m>: %5d\n", np->nat_reserve);
316 pr("Capital <c>: %s\t\t",
317 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
318 pr("Origin <o>: %3s\n",
319 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
320 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
321 pr("Min Used <u>: %3d\n", np->nat_minused);
322 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
323 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
324 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
325 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
326 pr("Money <M>: $%6d\n", np->nat_money);
327 pr("Telegrams <t>: %6d\n", np->nat_tgms);
328 if (opt_DEMANDUPDATE)
329 pr("Updates missed <U>: %d\n", np->nat_missed);
331 pr("Countries contacted: ");
332 for (i = 0; i < MAXNOC; i++) {
333 if (getcontact(np, i))
334 pr("%d(%d) ", i, getcontact(np, i));
341 pr_plane(struct plnstr *plane)
343 pr("UID <U>: %d\t\t", (int)plane->pln_uid);
344 pr("Owner <O>: %d\t\t", (int)plane->pln_own);
345 pr("Location <l>: %s\n",
346 xyas(plane->pln_x, plane->pln_y, player->cnum));
347 pr("Efficiency <e>: %d\t", (int)plane->pln_effic);
348 pr("Mobility <m>: %d\n", (int)plane->pln_mobil);
349 pr("Tech <t>: %d\t\t", plane->pln_tech);
350 pr("Wing <w>: %c\n", plane->pln_wing);
351 pr("Attack <a>: %d\t\t", plane->pln_att);
352 pr("Defense <d>: %d\n", plane->pln_def);
353 pr("Range <r>: %d\t\t", plane->pln_range);
354 pr("Flags <f>: %d\n", plane->pln_flags);
355 pr("Ship <s>: %d\t\t", plane->pln_ship);
356 pr("Land Unit <y>: %d\t", plane->pln_land);
357 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
361 pr_land(struct lndstr *land)
366 lcp = &lchr[(int)land->lnd_type];
367 pr("UID <U>: %d\n", (int)land->lnd_uid);
368 pr("Owner <O>: %d\n", (int)land->lnd_own);
369 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
370 pr("Efficiency <e>: %d\t", (int)land->lnd_effic);
371 pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
372 pr("Tech <t>: %d\t\t", land->lnd_tech);
373 pr("Army <a>: %c\n", land->lnd_army);
374 pr("Attack: %f\t", lcp->l_att);
375 pr("Defense: %f\n", lcp->l_def);
376 pr("Fortification <F>: %d\t", land->lnd_harden);
377 pr("Fuel <B>: %d\n", land->lnd_fuel);
378 count_land_planes(land);
379 pr("Xlight planes <X>: %d\n", land->lnd_nxlight);
380 pr("Land unit <Y>: %d\n", land->lnd_land);
381 pr("Ship <S>: %d\t\t", land->lnd_ship);
382 pr("Radius <P>: %d\n", land->lnd_rad_max);
383 pr("Retreat percentage <Z>: %d\n", (int)land->lnd_retreat);
384 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
385 land->lnd_rpath, (int)land->lnd_rflags);
386 getvec(VT_ITEM, vec, (s_char *)land, EF_LAND);
387 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
388 pr(" c m u f s g p i d o l h r\n");
389 pr("%3d", vec[I_CIVIL]);
390 pr("%4d", vec[I_MILIT]);
391 pr("%4d", vec[I_UW]);
392 pr("%5d", vec[I_FOOD]);
393 pr("%4d", vec[I_SHELL]);
394 pr("%4d", vec[I_GUN]);
395 pr("%5d", vec[I_PETROL]);
396 pr("%5d", vec[I_IRON]);
397 pr("%5d", vec[I_DUST]);
398 pr("%5d", vec[I_OIL]);
399 pr("%5d", vec[I_LCM]);
400 pr("%5d", vec[I_HCM]);
401 pr("%4d", vec[I_RAD]);
406 pr_ship(struct shpstr *ship)
411 if ((natp = getnatp(ship->shp_own)) == 0)
413 pr("%s (#%d) %s\n", natp->nat_cnam, (int)ship->shp_own, prship(ship));
414 pr("UID <U>: %d\n", (int)ship->shp_uid);
415 pr("Owner <O>: %d\t\t\t", (int)ship->shp_own);
416 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
417 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
418 pr("Efficiency <E>: %d\n", (int)ship->shp_effic);
419 pr("Mobility <M>: %d\t\t\t", (int)ship->shp_mobil);
420 pr("Fleet <F>: %c\n", ship->shp_fleet);
422 pr("Helos <H>: %d\n", (int)ship->shp_nchoppers);
423 pr("Xlight planes <X>: %d\n", (int)ship->shp_nxlight);
424 pr("Planes <P>: %d\n", (int)ship->shp_nplane);
426 pr("Units <Y>: %d\n", (int)ship->shp_nland);
427 /* could depend on opt_FUEL - but a deity might want to set this
428 up before enabling the option */
429 pr("Fuel <B>: %d\n", (int)ship->shp_fuel);
430 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
431 ship->shp_rpath, (int)ship->shp_rflags);
432 getvec(VT_ITEM, vec, (s_char *)ship, EF_SHIP);
433 pr("Plague Stage <a>: %d\n",
434 getvar(V_PSTAGE, (s_char *)ship, EF_SHIP));
435 pr("Plague Time <b>: %d\n", getvar(V_PTIME, (s_char *)ship, EF_SHIP));
436 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
437 pr(" c m u f s g p i d o l h r\n");
438 pr("%3d", vec[I_CIVIL]);
439 pr("%4d", vec[I_MILIT]);
440 pr("%4d", vec[I_UW]);
441 pr("%5d", vec[I_FOOD]);
442 pr("%4d", vec[I_SHELL]);
443 pr("%4d", vec[I_GUN]);
444 pr("%5d", vec[I_PETROL]);
445 pr("%5d", vec[I_IRON]);
446 pr("%5d", vec[I_DUST]);
447 pr("%5d", vec[I_OIL]);
448 pr("%5d", vec[I_LCM]);
449 pr("%5d", vec[I_HCM]);
450 pr("%4d", vec[I_RAD]);
455 errcheck(int num, int min, int max)
465 getin(s_char **what, s_char **p, int *arg, s_char *buf)
467 if (!(*what = getstarg(*p, "%c xxxxx -- thing value : ", buf))) {
472 while (**what && isspace(**what))
476 for (*p = *what; **p && !isspace(**p); (*p)++) /* skip non spaces */
478 while (**p && isspace(**p))
488 doland(s_char op, int arg, s_char *p, struct sctstr *sect)
490 natid newown, oldown;
498 sect->sct_coastal = (arg ? 1 : 0);
499 pr("Coastal flag of %s changed to %d\n",
500 xyas(sect->sct_x, sect->sct_y, player->cnum),
506 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
507 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
508 xyas(sect->sct_x, sect->sct_y, player->cnum),
509 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
511 makelost(EF_SECTOR, sect->sct_own, 0, sect->sct_x,
513 wu(player->cnum, sect->sct_own,
514 "Sector %s lost to deity intervention\n", xyas(sect->sct_x,
519 benefit(sect->sct_own, 0);
520 sect->sct_own = newown;
522 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
523 wu(player->cnum, newown,
524 "Sector %s gained from deity intervention\n",
525 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
532 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
533 pr("Old player->owner of %s changed from %s (#%d) to %s (#%d).\n",
534 xyas(sect->sct_x, sect->sct_y, player->cnum),
535 cname(sect->sct_oldown),
536 sect->sct_oldown, cname(oldown), oldown);
537 sect->sct_oldown = oldown;
540 new = errcheck(arg, 0, 100);
541 noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
542 sect->sct_effic = (u_char)new;
545 new = errcheck(arg, -127, 255);
546 noise(sect, 1, "Mobility", (int)sect->sct_mobil, new);
547 sect->sct_mobil = new;
550 new = errcheck(arg, 0, 127);
551 noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
552 sect->sct_min = (u_char)new;
555 new = errcheck(arg, 0, 127);
556 noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
557 sect->sct_gmin = (u_char)new;
560 new = errcheck(arg, 0, 127);
561 noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
562 sect->sct_fertil = (u_char)new;
565 new = errcheck(arg, 0, 127);
566 noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
567 sect->sct_oil = (u_char)new;
570 new = errcheck(arg, 0, 127);
571 noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
572 sect->sct_uran = (u_char)new;
575 new = errcheck(arg, 0, 100);
576 noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
577 sect->sct_work = (u_char)new;
580 new = errcheck(arg, 0, 127);
581 pr("Loyalty of %s changed from %d to %d%%\n",
582 xyas(sect->sct_x, sect->sct_y, player->cnum),
583 sect->sct_loyal, new);
584 sect->sct_loyal = (u_char)new;
587 old = getvar(V_CHE, (s_char *)sect, EF_SECTOR);
588 new = errcheck(arg, 0, 65536);
589 pr("Guerillas in %s changed from %d to %d%\n",
590 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
591 putvar(V_CHE, new, (s_char *)sect, EF_SECTOR);
594 old = getvar(V_PSTAGE, (s_char *)sect, EF_SECTOR);
595 new = errcheck(arg, 0, PLG_EXPOSED);
596 pr("Plague stage of %s changed from %d to %d%\n",
597 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
598 putvar(V_PSTAGE, new, (s_char *)sect, EF_SECTOR);
601 old = getvar(V_PTIME, (s_char *)sect, EF_SECTOR);
602 new = errcheck(arg, 0, 255);
603 pr("Plague time of %s changed from %d to %d%\n",
604 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
605 putvar(V_PTIME, new, (s_char *)sect, EF_SECTOR);
608 old = getvar(V_FALLOUT, (s_char *)sect, EF_SECTOR);
609 new = errcheck(arg, 0, 9999);
610 pr("Fallout for sector %s changed from %d to %d\n",
611 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
612 putvar(V_FALLOUT, new, (s_char *)sect, EF_SECTOR);
615 new = errcheck(arg, 0, 9999);
616 noise(sect, 1, "Available workforce", (int)sect->sct_avail, new);
617 sect->sct_avail = new;
620 putvar(V_MINE, arg, (s_char *)sect, EF_SECTOR);
621 pr("Mines changed to %d\n", arg);
624 if (!sarg_xy(p, &newx, &newy))
630 if (!sarg_xy(p, &newx, &newy))
632 pr("Distribtion Location for sector %s changed from %s to %s\n",
633 xyas(sect->sct_x, sect->sct_y, player->cnum),
634 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
635 xyas(newx, newy, player->cnum));
636 sect->sct_dist_x = newx;
637 sect->sct_dist_y = newy;
640 des = typematch(p, EF_SECTOR);
643 pr("Designation for sector %s changed from %c to %c\n",
644 xyas(sect->sct_x, sect->sct_y, player->cnum),
645 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
646 sect->sct_type = des;
649 des = typematch(p, EF_SECTOR);
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(s_char op, int arg, s_char *p, float farg, natid nat,
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 %d to %d\n",
716 np->nat_reserve, arg);
717 if (np->nat_stat == STAT_NORM)
718 wu(player->cnum, nat,
719 "Military Reserves changed from %d to %d by divine intervention.\n",
720 np->nat_reserve, arg);
721 np->nat_reserve = arg;
724 if (!sarg_xy(p, &newx, &newy))
726 pr("Capital coordinates changed from %s to %s\n",
727 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
728 xyas(newx, newy, player->cnum));
733 if (!sarg_xy(p, &newx, &newy))
735 pr("Origin coordinates changed from %s to %s\n",
736 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
737 xyas(newx, newy, player->cnum));
742 np->nat_stat = (s_char)errcheck(arg, 0, STAT_NEW);
745 arg = errcheck(arg, 0, m_m_p_d);
746 pr("Number of minutes used changed from %d to %d.\n",
747 np->nat_minused, arg);
748 np->nat_minused = arg;
751 pr("Money changed from %d to %d\n", np->nat_money, arg);
752 wu(player->cnum, nat,
753 "Money changed from %d to %d by divine intervention.\n",
758 pr("Tech changed from %.2f to %.2f.\n",
759 np->nat_level[NAT_TLEV], farg);
760 np->nat_level[NAT_TLEV] = farg;
763 pr("Research changed from %.2f to %.2f.\n",
764 np->nat_level[NAT_RLEV], farg);
765 np->nat_level[NAT_RLEV] = farg;
768 pr("Education changed from %.2f to %.2f.\n",
769 np->nat_level[NAT_ELEV], farg);
770 np->nat_level[NAT_ELEV] = farg;
773 pr("Happiness changed from %.2f to %.2f.\n",
774 np->nat_level[NAT_HLEV], farg);
775 np->nat_level[NAT_HLEV] = farg;
778 np->nat_missed = arg;
781 pr("huh? (%c)\n", op);
790 doship(s_char op, int arg, s_char *p, struct shpstr *ship)
797 putvar(V_PSTAGE, arg, (s_char *)ship, EF_SHIP);
800 putvar(V_PTIME, arg, (s_char *)ship, EF_SHIP);
803 bcopy(p, ship->shp_rpath, 10);
806 ship->shp_rflags = arg;
809 ship->shp_nchoppers = arg;
812 ship->shp_nxlight = arg;
819 wu(player->cnum, ship->shp_own,
820 "%s taken from you by deity intervention!\n", prship(ship));
821 if (arg && arg < MAXNOC) {
822 wu(player->cnum, (natid)arg,
823 "%s given to you by deity intervention!\n", prship(ship));
824 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
826 ship->shp_own = (natid)arg;
827 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
831 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
833 ship->shp_own = (natid)0;
837 if (!sarg_xy(p, &newx, &newy))
843 ship->shp_tech = arg;
846 ship->shp_effic = errcheck(arg, 0, 100);
849 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
851 ship->shp_own = (natid)0;
855 ship->shp_mobil = arg;
858 ship->shp_fuel = errcheck(arg, 0, 255);
862 ship->shp_fleet = ' ';
863 else if (isalpha(p[0]))
864 ship->shp_fleet = p[0];
866 pr("%c: invalid fleet\n", p[0]);
871 ship->shp_nland = errcheck(arg, 0, 100);
874 ship->shp_nplane = errcheck(arg, 0, 100);
877 if (!putvar(V_CIVIL, arg, (s_char *)ship, EF_SHIP)) {
878 pr("No room on ship!\n");
883 if (!putvar(V_MILIT, arg, (s_char *)ship, EF_SHIP)) {
884 pr("No room on ship!\n");
889 if (!putvar(V_UW, arg, (s_char *)ship, EF_SHIP)) {
890 pr("No room on ship!\n");
895 if (!putvar(V_FOOD, arg, (s_char *)ship, EF_SHIP)) {
896 pr("No room on ship!\n");
901 if (!putvar(V_SHELL, arg, (s_char *)ship, EF_SHIP)) {
902 pr("No room on ship!\n");
907 if (!putvar(V_GUN, arg, (s_char *)ship, EF_SHIP)) {
908 pr("No room on ship!\n");
913 if (!putvar(V_PETROL, arg, (s_char *)ship, EF_SHIP)) {
914 pr("No room on ship!\n");
919 if (!putvar(V_IRON, arg, (s_char *)ship, EF_SHIP)) {
920 pr("No room on ship!\n");
925 if (!putvar(V_DUST, arg, (s_char *)ship, EF_SHIP)) {
926 pr("No room on ship!\n");
931 if (!putvar(V_OIL, arg, (s_char *)ship, EF_SHIP)) {
932 pr("No room on ship!\n");
937 if (!putvar(V_LCM, arg, (s_char *)ship, EF_SHIP)) {
938 pr("No room on ship!\n");
943 if (!putvar(V_HCM, arg, (s_char *)ship, EF_SHIP)) {
944 pr("No room on ship!\n");
949 if (!putvar(V_RAD, arg, (s_char *)ship, EF_SHIP)) {
950 pr("No room on ship!\n");
955 pr("huh? (%c)\n", op);
962 dounit(s_char op, int arg, s_char *p, struct lndstr *land)
969 land->lnd_land = arg;
976 wu(player->cnum, land->lnd_own,
977 "%s taken from you by deity intervention!\n", prland(land));
979 if (arg && arg < MAXNOC) {
980 wu(player->cnum, (natid)arg,
981 "%s given to you by deity intervention!\n", prland(land));
982 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
984 land->lnd_own = (natid)arg;
985 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
988 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
991 land->lnd_own = (natid)0;
995 if (!sarg_xy(p, &newx, &newy))
1001 land->lnd_effic = errcheck(arg, 0, 100);
1003 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
1005 land->lnd_effic = 0;
1006 land->lnd_own = (natid)0;
1010 land->lnd_mobil = arg;
1013 land->lnd_tech = arg;
1017 land->lnd_army = ' ';
1018 else if (isalpha(p[0]))
1019 land->lnd_army = p[0];
1021 pr("%c: invalid army\n", p[0]);
1026 land->lnd_harden = errcheck(arg, 0, 255);
1029 land->lnd_fuel = errcheck(arg, 0, 255);
1032 land->lnd_nxlight = arg;
1035 land->lnd_ship = arg;
1038 land->lnd_rad_max = arg;
1041 land->lnd_retreat = arg;
1044 bcopy(p, land->lnd_rpath, 10);
1047 land->lnd_rflags = arg;
1050 if (!putvar(V_CIVIL, arg, (s_char *)land, EF_LAND)) {
1051 pr("No room on land unit!\n");
1056 if (!putvar(V_MILIT, arg, (s_char *)land, EF_LAND)) {
1057 pr("No room on land!\n");
1062 if (!putvar(V_UW, arg, (s_char *)land, EF_LAND)) {
1063 pr("No room on land!\n");
1068 if (!putvar(V_FOOD, arg, (s_char *)land, EF_LAND)) {
1069 pr("No room on land!\n");
1074 if (!putvar(V_SHELL, arg, (s_char *)land, EF_LAND)) {
1075 pr("No room on land!\n");
1080 if (!putvar(V_GUN, arg, (s_char *)land, EF_LAND)) {
1081 pr("No room on land!\n");
1086 if (!putvar(V_PETROL, arg, (s_char *)land, EF_LAND)) {
1087 pr("No room on land!\n");
1092 if (!putvar(V_IRON, arg, (s_char *)land, EF_LAND)) {
1093 pr("No room on land!\n");
1098 if (!putvar(V_DUST, arg, (s_char *)land, EF_LAND)) {
1099 pr("No room on land!\n");
1104 if (!putvar(V_OIL, arg, (s_char *)land, EF_LAND)) {
1105 pr("No room on land!\n");
1110 if (!putvar(V_LCM, arg, (s_char *)land, EF_LAND)) {
1111 pr("No room on land!\n");
1116 if (!putvar(V_HCM, arg, (s_char *)land, EF_LAND)) {
1117 pr("No room on land!\n");
1122 if (!putvar(V_RAD, arg, (s_char *)land, EF_LAND)) {
1123 pr("No room on land!\n");
1128 pr("huh? (%c)\n", op);
1136 doplane(s_char op, int arg, s_char *p, struct plnstr *plane)
1142 plane->pln_nuketype = arg;
1145 plane->pln_uid = arg;
1148 if (!sarg_xy(p, &newx, &newy))
1150 plane->pln_x = newx;
1151 plane->pln_y = newy;
1155 wu(player->cnum, plane->pln_own,
1156 "%s taken from you by deity intervention!\n",
1158 if (arg && arg < MAXNOC) {
1159 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1160 plane->pln_x, plane->pln_y);
1161 plane->pln_own = (natid)arg;
1162 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1163 plane->pln_x, plane->pln_y);
1164 wu(player->cnum, plane->pln_own,
1165 "%s given to you by deity intervention!\n", prplane(plane));
1167 plane->pln_effic = 0;
1168 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1169 plane->pln_x, plane->pln_y);
1170 plane->pln_own = (natid)0;
1174 plane->pln_effic = errcheck(arg, 0, 100);
1176 plane->pln_effic = 0;
1177 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1178 plane->pln_x, plane->pln_y);
1179 plane->pln_own = (natid)0;
1183 plane->pln_mobil = errcheck(arg, -127, 255);
1186 plane->pln_tech = arg;
1190 plane->pln_wing = ' ';
1191 else if (isalpha(p[0]))
1192 plane->pln_wing = p[0];
1194 pr("%c: invalid wing\n", p[0]);
1199 plane->pln_att = (s_char)errcheck(arg, 0, 127);
1202 plane->pln_def = (s_char)arg;
1205 plane->pln_range = (u_char)arg;
1208 plane->pln_ship = arg;
1211 plane->pln_land = arg;
1214 plane->pln_flags = arg;
1217 pr("huh? (%c)\n", op);