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
59 static void prnat(natid n);
60 static void pr_plane(struct plnstr *plane);
61 static void pr_land(struct lndstr *land);
62 static void pr_ship(struct shpstr *ship);
63 static void prsect(struct sctstr *sect);
64 static void noise(struct sctstr *sptr, int public_amt, s_char *name,
66 static void benefit(natid who, int good);
67 int doland(s_char op, int arg, s_char *p, struct sctstr *sect);
68 int docountry(s_char op, int arg, s_char *p, float farg, natid nat,
70 int doship(s_char op, int arg, s_char *p, struct shpstr *ship);
71 int dounit(s_char op, int arg, s_char *p, struct lndstr *land);
72 int doplane(s_char op, int arg, s_char *p, struct plnstr *plane);
94 s_char ewhat; /* saves information from the command line
97 if ((what = getstarg(player->argp[1],
98 "Edit What (country, land, ship, plane, nuke, unit)? ",
104 if (!(ptr = getstarg(player->argp[2], "Sector : ", buf)))
106 if (!sarg_xy(ptr, &x, &y))
108 if (!getsect(x, y, §))
112 if ((num = natarg(player->argp[2], "Country number? ")) < 0)
118 if ((num = onearg(player->argp[2], "Plane number? ")) < 0)
120 if (!getplane(num, &plane))
124 if ((num = onearg(player->argp[2], "Ship number? ")) < 0)
126 if (!getship(num, &ship))
130 if ((num = onearg(player->argp[2], "Unit number? ")) < 0)
132 if (!getland(num, &land))
136 pr("Not implemented yet.\n");
142 if (player->argp[3] == 0) {
164 if (player->argp[arg_index] != 0) {
165 if (player->argp[arg_index+1] != 0) {
166 thing = player->argp[arg_index++];
167 ptr = player->argp[arg_index++];
171 } else if (arg_index == 3) {
172 if ((err = getin(&thing, &ptr, &arg, buf)) != RET_OK) {
200 if ((err = docountry(thing[0], arg, ptr, farg, nat, np))
205 if ((err = doland(thing[0], arg, ptr, §)) != RET_OK)
211 if ((err = doship(thing[0], arg, ptr, &ship)) != RET_OK)
213 if (!putship(ship.shp_uid, &ship))
217 if ((err = dounit(thing[0], arg, ptr, &land))
220 if (!putland(land.lnd_uid, &land))
224 if ((err = doplane(thing[0], arg, ptr, &plane))
227 if (!putplane(plane.pln_uid, &plane))
240 benefit(natid who, int good)
247 nreport(player->cnum, N_AIDS, who, 1);
250 nreport(player->cnum, N_HURTS, who, 1);
255 noise(struct sctstr *sptr, int public_amt, s_char *name, int old, int new)
259 pr("%s of %s changed from %d to %d\n",
260 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
262 (void)sprintf(p, "changed from %d to %d", old, new);
264 (void)sprintf(p, "%s", (old < new ? "increased" : "decreased"));
266 wu(player->cnum, sptr->sct_own,
267 "%s in %s was %s by an act of %s\n",
268 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
269 p, cname(player->cnum));
270 benefit(sptr->sct_own, (old < new));
274 prsect(struct sctstr *sect)
276 pr("Location <L>: %s\t", xyas(sect->sct_x, sect->sct_y, player->cnum));
277 pr("Distribution sector <D>: %s\n",
278 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
279 pr("Designation <s>: %c\t New designation <S>: %c\n",
280 dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
281 pr("own oo eff mob min gld frt oil urn wrk lty che plg ptime fall avail\n");
282 pr(" o O e m i g f c u w l x p t F a\n");
283 pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %4d %3d %5d %4d %5d\n",
284 sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
285 sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
286 sect->sct_uran, sect->sct_work, sect->sct_loyal,
287 getvar(V_CHE, (s_char *)sect, EF_SECTOR),
288 getvar(V_PSTAGE, (s_char *)sect, EF_SECTOR),
289 getvar(V_PTIME, (s_char *)sect, EF_SECTOR),
290 getvar(V_FALLOUT, (s_char *)sect, EF_SECTOR), sect->sct_avail);
292 pr("Mines <M>: %d\t", getvar(V_MINE, (s_char *)sect, EF_SECTOR));
293 pr("Coastal <C>: %d\n", sect->sct_coastal);
294 pr("Road %% <R>: %d\t", sect->sct_road);
295 pr("Rail %% <r>: %d\t", sect->sct_rail);
296 pr("Defense %% <d>: %d\n", sect->sct_defense);
306 if ((np = getnatp(n)) == 0)
308 pr("Country #: %2d\n", n);
309 pr("Name <n>: %-20s\t", np->nat_cnam);
310 pr("Connected: %d\n", np->nat_connected);
311 pr("Representative <r>: %-20s\n", np->nat_pnam);
312 pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
313 pr("Reserves <m>: %5d\n", np->nat_reserve);
314 pr("Capital <c>: %s\t\t",
315 xyas(np->nat_xcap, np->nat_ycap, player->cnum));
316 pr("Origin <o>: %3s\n",
317 xyas(np->nat_xorg, np->nat_yorg, player->cnum));
318 pr("Status <s>: 0x%x\t\t\t", np->nat_stat);
319 pr("Min Used <u>: %3d\n", np->nat_minused);
320 pr("Technology <T>: %.2f\t\t", np->nat_level[NAT_TLEV]);
321 pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
322 pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
323 pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
324 pr("Money <M>: $%6d\n", np->nat_money);
325 pr("Telegrams <t>: %6d\n", np->nat_tgms);
326 if (opt_DEMANDUPDATE)
327 pr("Updates missed <U>: %d\n", np->nat_missed);
329 pr("Countries contacted: ");
330 for (i = 0; i < MAXNOC; i++) {
331 if (getcontact(np, i))
332 pr("%d(%d) ", i, getcontact(np, i));
339 pr_plane(struct plnstr *plane)
341 pr("UID <U>: %d\t\t", (int)plane->pln_uid);
342 pr("Owner <O>: %d\t\t", (int)plane->pln_own);
343 pr("Location <l>: %s\n",
344 xyas(plane->pln_x, plane->pln_y, player->cnum));
345 pr("Efficiency <e>: %d\t", (int)plane->pln_effic);
346 pr("Mobility <m>: %d\n", (int)plane->pln_mobil);
347 pr("Tech <t>: %d\t\t", plane->pln_tech);
348 pr("Wing <w>: %c\n", plane->pln_wing);
349 pr("Attack <a>: %d\t\t", plane->pln_att);
350 pr("Defense <d>: %d\n", plane->pln_def);
351 pr("Range <r>: %d\t\t", plane->pln_range);
352 pr("Flags <f>: %d\n", plane->pln_flags);
353 pr("Ship <s>: %d\t\t", plane->pln_ship);
354 pr("Land Unit <y>: %d\t", plane->pln_land);
355 pr("Nuke Type <n>: %d\n", plane->pln_nuketype);
359 pr_land(struct lndstr *land)
364 lcp = &lchr[(int)land->lnd_type];
365 pr("UID <U>: %d\n", (int)land->lnd_uid);
366 pr("Owner <O>: %d\n", (int)land->lnd_own);
367 pr("Location <L>: %s\n", xyas(land->lnd_x, land->lnd_y, player->cnum));
368 pr("Efficiency <e>: %d\t", (int)land->lnd_effic);
369 pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
370 pr("Tech <t>: %d\t\t", land->lnd_tech);
371 pr("Army <a>: %c\n", land->lnd_army);
372 pr("Attack: %f\t", lcp->l_att);
373 pr("Defense: %f\n", lcp->l_def);
374 pr("Fortification <F>: %d\t", land->lnd_harden);
375 pr("Fuel <B>: %d\n", land->lnd_fuel);
376 count_land_planes(land);
377 pr("Xlight planes <X>: %d\n", land->lnd_nxlight);
378 pr("Land unit <Y>: %d\n", land->lnd_land);
379 pr("Ship <S>: %d\t\t", land->lnd_ship);
380 pr("Radius <P>: %d\n", land->lnd_rad_max);
381 pr("Retreat percentage <Z>: %d\n", (int)land->lnd_retreat);
382 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
383 land->lnd_rpath, (int)land->lnd_rflags);
384 getvec(VT_ITEM, vec, (s_char *)land, EF_LAND);
385 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
386 pr(" c m u f s g p i d o l h r\n");
387 pr("%3d", vec[I_CIVIL]);
388 pr("%4d", vec[I_MILIT]);
389 pr("%4d", vec[I_UW]);
390 pr("%5d", vec[I_FOOD]);
391 pr("%4d", vec[I_SHELL]);
392 pr("%4d", vec[I_GUN]);
393 pr("%5d", vec[I_PETROL]);
394 pr("%5d", vec[I_IRON]);
395 pr("%5d", vec[I_DUST]);
396 pr("%5d", vec[I_OIL]);
397 pr("%5d", vec[I_LCM]);
398 pr("%5d", vec[I_HCM]);
399 pr("%4d", vec[I_RAD]);
404 pr_ship(struct shpstr *ship)
409 if ((natp = getnatp(ship->shp_own)) == 0)
411 pr("%s (#%d) %s\n", natp->nat_cnam, (int)ship->shp_own, prship(ship));
412 pr("UID <U>: %d\n", (int)ship->shp_uid);
413 pr("Owner <O>: %d\t\t\t", (int)ship->shp_own);
414 pr("Location <L>: %s\n", xyas(ship->shp_x, ship->shp_y, player->cnum));
415 pr("Tech <T>: %d\t\t\t", ship->shp_tech);
416 pr("Efficiency <E>: %d\n", (int)ship->shp_effic);
417 pr("Mobility <M>: %d\t\t\t", (int)ship->shp_mobil);
418 pr("Fleet <F>: %c\n", ship->shp_fleet);
420 pr("Helos <H>: %d\n", (int)ship->shp_nchoppers);
421 pr("Xlight planes <X>: %d\n", (int)ship->shp_nxlight);
422 pr("Planes <P>: %d\n", (int)ship->shp_nplane);
424 pr("Units <Y>: %d\n", (int)ship->shp_nland);
425 /* could depend on opt_FUEL - but a deity might want to set this
426 up before enabling the option */
427 pr("Fuel <B>: %d\n", (int)ship->shp_fuel);
428 pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
429 ship->shp_rpath, (int)ship->shp_rflags);
430 getvec(VT_ITEM, vec, (s_char *)ship, EF_SHIP);
431 pr("Plague Stage <a>: %d\n",
432 getvar(V_PSTAGE, (s_char *)ship, EF_SHIP));
433 pr("Plague Time <b>: %d\n", getvar(V_PTIME, (s_char *)ship, EF_SHIP));
434 pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
435 pr(" c m u f s g p i d o l h r\n");
436 pr("%3d", vec[I_CIVIL]);
437 pr("%4d", vec[I_MILIT]);
438 pr("%4d", vec[I_UW]);
439 pr("%5d", vec[I_FOOD]);
440 pr("%4d", vec[I_SHELL]);
441 pr("%4d", vec[I_GUN]);
442 pr("%5d", vec[I_PETROL]);
443 pr("%5d", vec[I_IRON]);
444 pr("%5d", vec[I_DUST]);
445 pr("%5d", vec[I_OIL]);
446 pr("%5d", vec[I_LCM]);
447 pr("%5d", vec[I_HCM]);
448 pr("%4d", vec[I_RAD]);
453 errcheck(int num, int min, int max)
463 getin(s_char **what, s_char **p, int *arg, s_char *buf)
465 if (!(*what = getstarg(*p, "%c xxxxx -- thing value : ", buf))) {
470 while (**what && isspace(**what))
474 for (*p = *what; **p && !isspace(**p); (*p)++) /* skip non spaces */
476 while (**p && isspace(**p))
486 doland(s_char op, int arg, s_char *p, struct sctstr *sect)
488 natid newown, oldown;
496 sect->sct_coastal = (arg ? 1 : 0);
497 pr("Coastal flag of %s changed to %d\n",
498 xyas(sect->sct_x, sect->sct_y, player->cnum),
504 newown = (natid)errcheck(arg, 0, MAXNOC - 1);
505 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
506 xyas(sect->sct_x, sect->sct_y, player->cnum),
507 cname(sect->sct_own), sect->sct_own, cname(newown), newown);
509 makelost(EF_SECTOR, sect->sct_own, 0, sect->sct_x,
511 wu(player->cnum, sect->sct_own,
512 "Sector %s lost to deity intervention\n", xyas(sect->sct_x,
517 benefit(sect->sct_own, 0);
518 sect->sct_own = newown;
520 makenotlost(EF_SECTOR, newown, 0, sect->sct_x, sect->sct_y);
521 wu(player->cnum, newown,
522 "Sector %s gained from deity intervention\n",
523 xyas(sect->sct_x, sect->sct_y, sect->sct_own));
530 oldown = (natid)errcheck(arg, 0, MAXNOC - 1);
531 pr("Old player->owner of %s changed from %s (#%d) to %s (#%d).\n",
532 xyas(sect->sct_x, sect->sct_y, player->cnum),
533 cname(sect->sct_oldown),
534 sect->sct_oldown, cname(oldown), oldown);
535 sect->sct_oldown = oldown;
538 new = errcheck(arg, 0, 100);
539 noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
540 sect->sct_effic = (u_char)new;
543 new = errcheck(arg, -127, 255);
544 noise(sect, 1, "Mobility", (int)sect->sct_mobil, new);
545 sect->sct_mobil = new;
548 new = errcheck(arg, 0, 127);
549 noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
550 sect->sct_min = (u_char)new;
553 new = errcheck(arg, 0, 127);
554 noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
555 sect->sct_gmin = (u_char)new;
558 new = errcheck(arg, 0, 127);
559 noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
560 sect->sct_fertil = (u_char)new;
563 new = errcheck(arg, 0, 127);
564 noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
565 sect->sct_oil = (u_char)new;
568 new = errcheck(arg, 0, 127);
569 noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
570 sect->sct_uran = (u_char)new;
573 new = errcheck(arg, 0, 100);
574 noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
575 sect->sct_work = (u_char)new;
578 new = errcheck(arg, 0, 127);
579 pr("Loyalty of %s changed from %d to %d%%\n",
580 xyas(sect->sct_x, sect->sct_y, player->cnum),
581 sect->sct_loyal, new);
582 sect->sct_loyal = (u_char)new;
585 old = getvar(V_CHE, (s_char *)sect, EF_SECTOR);
586 new = errcheck(arg, 0, 65536);
587 pr("Guerillas in %s changed from %d to %d%\n",
588 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
589 putvar(V_CHE, new, (s_char *)sect, EF_SECTOR);
592 old = getvar(V_PSTAGE, (s_char *)sect, EF_SECTOR);
593 new = errcheck(arg, 0, PLG_EXPOSED);
594 pr("Plague stage of %s changed from %d to %d%\n",
595 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
596 putvar(V_PSTAGE, new, (s_char *)sect, EF_SECTOR);
599 old = getvar(V_PTIME, (s_char *)sect, EF_SECTOR);
600 new = errcheck(arg, 0, 255);
601 pr("Plague time of %s changed from %d to %d%\n",
602 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
603 putvar(V_PTIME, new, (s_char *)sect, EF_SECTOR);
606 old = getvar(V_FALLOUT, (s_char *)sect, EF_SECTOR);
607 new = errcheck(arg, 0, 9999);
608 pr("Fallout for sector %s changed from %d to %d\n",
609 xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
610 putvar(V_FALLOUT, new, (s_char *)sect, EF_SECTOR);
613 new = errcheck(arg, 0, 9999);
614 noise(sect, 1, "Available workforce", (int)sect->sct_avail, new);
615 sect->sct_avail = new;
618 putvar(V_MINE, arg, (s_char *)sect, EF_SECTOR);
619 pr("Mines changed to %d\n", arg);
622 if (!sarg_xy(p, &newx, &newy))
628 if (!sarg_xy(p, &newx, &newy))
630 pr("Distribtion Location for sector %s changed from %s to %s\n",
631 xyas(sect->sct_x, sect->sct_y, player->cnum),
632 xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
633 xyas(newx, newy, player->cnum));
634 sect->sct_dist_x = newx;
635 sect->sct_dist_y = newy;
638 des = typematch(p, EF_SECTOR);
641 pr("Designation for sector %s changed from %c to %c\n",
642 xyas(sect->sct_x, sect->sct_y, player->cnum),
643 dchr[sect->sct_type].d_mnem, dchr[des].d_mnem);
644 sect->sct_type = des;
647 des = typematch(p, EF_SECTOR);
650 pr("New Designation for sector %s changed from %c to %c\n",
651 xyas(sect->sct_x, sect->sct_y, player->cnum),
652 dchr[sect->sct_newtype].d_mnem, dchr[des].d_mnem);
653 sect->sct_newtype = des;
660 noise(sect, 1, "Road percentage", (int)sect->sct_road, arg);
661 sect->sct_road = arg;
668 noise(sect, 1, "Rail percentage", (int)sect->sct_rail, arg);
669 sect->sct_rail = arg;
676 noise(sect, 1, "Defense percentage", (int)sect->sct_defense, arg);
677 sect->sct_defense = arg;
680 pr("huh? (%c)\n", op);
689 docountry(s_char op, int arg, s_char *p, float farg, natid nat,
696 pr("Country name changed from %s to %s\n", np->nat_cnam, p);
697 strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
700 pr("Country representative changed from %s to %s\n",
702 strncpy(np->nat_pnam, p, sizeof(np->nat_pnam) - 1);
708 arg = errcheck(arg, 0, 1024);
709 pr("BTU's changed from %d to %d\n", np->nat_btu, arg);
713 benefit(nat, np->nat_reserve < arg);
714 pr("Military Reserves changed from %d to %d\n",
715 np->nat_reserve, arg);
716 if (np->nat_stat == STAT_NORM)
717 wu(player->cnum, nat,
718 "Military Reserves changed from %d to %d by divine intervention.\n",
719 np->nat_reserve, arg);
720 np->nat_reserve = arg;
723 if (!sarg_xy(p, &newx, &newy))
725 pr("Capital coordinates changed from %s to %s\n",
726 xyas(np->nat_xcap, np->nat_ycap, player->cnum),
727 xyas(newx, newy, player->cnum));
732 if (!sarg_xy(p, &newx, &newy))
734 pr("Origin coordinates changed from %s to %s\n",
735 xyas(np->nat_xorg, np->nat_yorg, player->cnum),
736 xyas(newx, newy, player->cnum));
741 np->nat_stat = (s_char)errcheck(arg, 0, STAT_NEW);
744 arg = errcheck(arg, 0, m_m_p_d);
745 pr("Number of minutes used changed from %d to %d.\n",
746 np->nat_minused, arg);
747 np->nat_minused = arg;
750 pr("Money changed from %d to %d\n", np->nat_money, arg);
751 wu(player->cnum, nat,
752 "Money changed from %d to %d by divine intervention.\n",
757 pr("Tech changed from %.2f to %.2f.\n",
758 np->nat_level[NAT_TLEV], farg);
759 np->nat_level[NAT_TLEV] = farg;
762 pr("Research changed from %.2f to %.2f.\n",
763 np->nat_level[NAT_RLEV], farg);
764 np->nat_level[NAT_RLEV] = farg;
767 pr("Education changed from %.2f to %.2f.\n",
768 np->nat_level[NAT_ELEV], farg);
769 np->nat_level[NAT_ELEV] = farg;
772 pr("Happiness changed from %.2f to %.2f.\n",
773 np->nat_level[NAT_HLEV], farg);
774 np->nat_level[NAT_HLEV] = farg;
777 np->nat_missed = arg;
780 pr("huh? (%c)\n", op);
789 doship(s_char op, int arg, s_char *p, struct shpstr *ship)
796 putvar(V_PSTAGE, arg, (s_char *)ship, EF_SHIP);
799 putvar(V_PTIME, arg, (s_char *)ship, EF_SHIP);
802 bcopy(p, ship->shp_rpath, 10);
805 ship->shp_rflags = arg;
808 ship->shp_nchoppers = arg;
811 ship->shp_nxlight = arg;
818 wu(player->cnum, ship->shp_own,
819 "%s taken from you by deity intervention!\n", prship(ship));
820 if (arg && arg < MAXNOC) {
821 wu(player->cnum, (natid)arg,
822 "%s given to you by deity intervention!\n", prship(ship));
823 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
825 ship->shp_own = (natid)arg;
826 makenotlost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
830 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
832 ship->shp_own = (natid)0;
836 if (!sarg_xy(p, &newx, &newy))
842 ship->shp_tech = arg;
845 ship->shp_effic = errcheck(arg, 0, 100);
848 makelost(EF_SHIP, ship->shp_own, ship->shp_uid, ship->shp_x,
850 ship->shp_own = (natid)0;
854 ship->shp_mobil = arg;
857 ship->shp_fuel = errcheck(arg, 0, 255);
861 ship->shp_fleet = ' ';
862 else if (isalpha(p[0]))
863 ship->shp_fleet = p[0];
865 pr("%c: invalid fleet\n", p[0]);
870 ship->shp_nland = errcheck(arg, 0, 100);
873 ship->shp_nplane = errcheck(arg, 0, 100);
876 if (!putvar(V_CIVIL, arg, (s_char *)ship, EF_SHIP)) {
877 pr("No room on ship!\n");
882 if (!putvar(V_MILIT, arg, (s_char *)ship, EF_SHIP)) {
883 pr("No room on ship!\n");
888 if (!putvar(V_UW, arg, (s_char *)ship, EF_SHIP)) {
889 pr("No room on ship!\n");
894 if (!putvar(V_FOOD, arg, (s_char *)ship, EF_SHIP)) {
895 pr("No room on ship!\n");
900 if (!putvar(V_SHELL, arg, (s_char *)ship, EF_SHIP)) {
901 pr("No room on ship!\n");
906 if (!putvar(V_GUN, arg, (s_char *)ship, EF_SHIP)) {
907 pr("No room on ship!\n");
912 if (!putvar(V_PETROL, arg, (s_char *)ship, EF_SHIP)) {
913 pr("No room on ship!\n");
918 if (!putvar(V_IRON, arg, (s_char *)ship, EF_SHIP)) {
919 pr("No room on ship!\n");
924 if (!putvar(V_DUST, arg, (s_char *)ship, EF_SHIP)) {
925 pr("No room on ship!\n");
930 if (!putvar(V_OIL, arg, (s_char *)ship, EF_SHIP)) {
931 pr("No room on ship!\n");
936 if (!putvar(V_LCM, arg, (s_char *)ship, EF_SHIP)) {
937 pr("No room on ship!\n");
942 if (!putvar(V_HCM, arg, (s_char *)ship, EF_SHIP)) {
943 pr("No room on ship!\n");
948 if (!putvar(V_RAD, arg, (s_char *)ship, EF_SHIP)) {
949 pr("No room on ship!\n");
954 pr("huh? (%c)\n", op);
961 dounit(s_char op, int arg, s_char *p, struct lndstr *land)
968 land->lnd_land = arg;
975 wu(player->cnum, land->lnd_own,
976 "%s taken from you by deity intervention!\n", prland(land));
978 if (arg && arg < MAXNOC) {
979 wu(player->cnum, (natid)arg,
980 "%s given to you by deity intervention!\n", prland(land));
981 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
983 land->lnd_own = (natid)arg;
984 makenotlost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
987 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
990 land->lnd_own = (natid)0;
994 if (!sarg_xy(p, &newx, &newy))
1000 land->lnd_effic = errcheck(arg, 0, 100);
1002 makelost(EF_LAND, land->lnd_own, land->lnd_uid, land->lnd_x,
1004 land->lnd_effic = 0;
1005 land->lnd_own = (natid)0;
1009 land->lnd_mobil = arg;
1012 land->lnd_tech = arg;
1016 land->lnd_army = ' ';
1017 else if (isalpha(p[0]))
1018 land->lnd_army = p[0];
1020 pr("%c: invalid army\n", p[0]);
1025 land->lnd_harden = errcheck(arg, 0, 255);
1028 land->lnd_fuel = errcheck(arg, 0, 255);
1031 land->lnd_nxlight = arg;
1034 land->lnd_ship = arg;
1037 land->lnd_rad_max = arg;
1040 land->lnd_retreat = arg;
1043 bcopy(p, land->lnd_rpath, 10);
1046 land->lnd_rflags = arg;
1049 if (!putvar(V_CIVIL, arg, (s_char *)land, EF_LAND)) {
1050 pr("No room on land unit!\n");
1055 if (!putvar(V_MILIT, arg, (s_char *)land, EF_LAND)) {
1056 pr("No room on land!\n");
1061 if (!putvar(V_UW, arg, (s_char *)land, EF_LAND)) {
1062 pr("No room on land!\n");
1067 if (!putvar(V_FOOD, arg, (s_char *)land, EF_LAND)) {
1068 pr("No room on land!\n");
1073 if (!putvar(V_SHELL, arg, (s_char *)land, EF_LAND)) {
1074 pr("No room on land!\n");
1079 if (!putvar(V_GUN, arg, (s_char *)land, EF_LAND)) {
1080 pr("No room on land!\n");
1085 if (!putvar(V_PETROL, arg, (s_char *)land, EF_LAND)) {
1086 pr("No room on land!\n");
1091 if (!putvar(V_IRON, arg, (s_char *)land, EF_LAND)) {
1092 pr("No room on land!\n");
1097 if (!putvar(V_DUST, arg, (s_char *)land, EF_LAND)) {
1098 pr("No room on land!\n");
1103 if (!putvar(V_OIL, arg, (s_char *)land, EF_LAND)) {
1104 pr("No room on land!\n");
1109 if (!putvar(V_LCM, arg, (s_char *)land, EF_LAND)) {
1110 pr("No room on land!\n");
1115 if (!putvar(V_HCM, arg, (s_char *)land, EF_LAND)) {
1116 pr("No room on land!\n");
1121 if (!putvar(V_RAD, arg, (s_char *)land, EF_LAND)) {
1122 pr("No room on land!\n");
1127 pr("huh? (%c)\n", op);
1135 doplane(s_char op, int arg, s_char *p, struct plnstr *plane)
1141 plane->pln_nuketype = arg;
1144 plane->pln_uid = arg;
1147 if (!sarg_xy(p, &newx, &newy))
1149 plane->pln_x = newx;
1150 plane->pln_y = newy;
1154 wu(player->cnum, plane->pln_own,
1155 "%s taken from you by deity intervention!\n",
1157 if (arg && arg < MAXNOC) {
1158 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1159 plane->pln_x, plane->pln_y);
1160 plane->pln_own = (natid)arg;
1161 makenotlost(EF_PLANE, plane->pln_own, plane->pln_uid,
1162 plane->pln_x, plane->pln_y);
1163 wu(player->cnum, plane->pln_own,
1164 "%s given to you by deity intervention!\n", prplane(plane));
1166 plane->pln_effic = 0;
1167 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1168 plane->pln_x, plane->pln_y);
1169 plane->pln_own = (natid)0;
1173 plane->pln_effic = errcheck(arg, 0, 100);
1175 plane->pln_effic = 0;
1176 makelost(EF_PLANE, plane->pln_own, plane->pln_uid,
1177 plane->pln_x, plane->pln_y);
1178 plane->pln_own = (natid)0;
1182 plane->pln_mobil = errcheck(arg, -127, 255);
1185 plane->pln_tech = arg;
1189 plane->pln_wing = ' ';
1190 else if (isalpha(p[0]))
1191 plane->pln_wing = p[0];
1193 pr("%c: invalid wing\n", p[0]);
1198 plane->pln_att = (s_char)errcheck(arg, 0, 127);
1201 plane->pln_def = (s_char)arg;
1204 plane->pln_range = (u_char)arg;
1207 plane->pln_ship = arg;
1210 plane->pln_land = arg;
1213 plane->pln_flags = arg;
1216 pr("huh? (%c)\n", op);