]> git.pond.sub.org Git - empserver/commitdiff
(nuke): Players need the uid to work with nukes, show it. Show
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 13 May 2006 15:30:30 +0000 (15:30 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 13 May 2006 15:30:30 +0000 (15:30 +0000)
members introduced in nuke.h rev. 1.19 and 1.20: nuk_plane, nuk_effic,
nuk_tech, nuk_stockpile.  Make output similar to the other unit
reports while we're at it.

info/nuke.t
src/lib/commands/nuke.c

index fa3c22f432d06aa3ec287f241ab15dcda9b46200..a5d59de39de873a20f8b5ce4fac00ea601a85ebb 100644 (file)
@@ -1,23 +1,29 @@
 .TH Command NUKE
-.NA nuke "List all nuclear \*Qdevices\*U in a given area"
+.NA nuke "Report status of nukes"
 .LV Expert
-.SY "nuke <SECTS>"
-For each sector in <SECTS>, this command prints the number of each
-type of nuclear device in that sector.  If the sector is a nuclear
-plant whose efficiency is at least 60% (i.e. a sector where you can
-build nuclear warheads), then you will be given additional information
-about the sector relevant to the building of nukes.
+.SY "nuke <NUKES>"
+The nuke report command is a census of your nuke and lists all the
+info available in readable format.
 .s1
-.EX nuke #1
-.NF
-  sect        eff num nuke-type         lcm   hcm   oil   rad avail
-  21,-3   n  100%  2 5mt fusion         499   499  1498   783   549
-                  21 100kt fission
-                   1 250kt fusion
-  19,-3   +  100% 12 5mt fusion
-                   3 50kt neutron
-.FI
-Note that the sector information is printed only once, and all nukes
-in that sector are listed below it.
+The report format contains the following fields:
 .s1
-.SA "build, launch, transport, Planes"
+.in +1i
+.L #
+the nuke number
+.L type
+the type of nuke; \*Q10kt fission\*U, \*Q1mt fusion\*U, etc.,
+.L x,y
+the nuke's current location,
+.L w
+the \*Qstockpile\*U designation letter,
+.L eff
+the nuke's efficiency,
+.L tech
+the tech level at which it was created,
+.L carry
+the plane the nuke is on, if any,
+.L burst
+whether the nuke is programmed to air- or groundburst.
+.in
+.s1
+.SA "arm, build, launch, transport, Planes"
index 03357e0b1f1e55f307e4c0ad342ec608ecc760f1..27769a658bf62c63a7fb17d59ccbb2818bbcdcfd 100644 (file)
 int
 nuke(void)
 {
-    int first_line = 0;
+    int nnukes;
     int show_comm;
     struct nstr_item nstr;
     struct nukstr nuk;
-    struct sctstr sect;
+    struct plnstr plane;
 
     if (!snxtitem(&nstr, EF_NUKE, player->argp[1]))
        return RET_SYN;
-
+    nnukes = 0;
     while (nxtitem(&nstr, &nuk)) {
-       if (!player->god && !player->owner)
-           continue;
-       if (nuk.nuk_own == 0)
+       if (!player->owner || nuk.nuk_own == 0)
            continue;
-       if (first_line++ == 0) {
+       if (nnukes++ == 0) {
            if (player->god)
                pr("own ");
-           pr("  sect        eff num nuke-type         lcm   hcm   oil   rad avail\n");
+           pr("   # nuke type              x,y    s  eff tech carry burst\n");
        }
-       getsect(nuk.nuk_x, nuk.nuk_y, &sect);
-       show_comm = 0;
-       if (sect.sct_type == SCT_NUKE && sect.sct_effic >= 60)
-           show_comm = 1;
        if (player->god)
            pr("%-3d ", nuk.nuk_own);
-       prxy("%4d,%-4d", sect.sct_x, sect.sct_y, player->cnum);
-       pr(" %c", dchr[sect.sct_type].d_mnem);
-       if (sect.sct_newtype != sect.sct_type)
-           pr("%c", dchr[sect.sct_newtype].d_mnem);
-       else
-           pr(" ");
-       pr("%4d%%", sect.sct_effic);
-
-       pr("%3d ", 1);
-       pr("%-16.16s ", nchr[(int)nuk.nuk_type].n_name);
-
-       if (show_comm) {
-           pr("%5d ", sect.sct_item[I_LCM]);
-           pr("%5d ", sect.sct_item[I_HCM]);
-           pr("%5d ", sect.sct_item[I_OIL]);
-           pr("%5d ", sect.sct_item[I_RAD]);
-           pr("%5d", sect.sct_avail);
-           show_comm = 0;
+       pr("%4d %-19.19s ", nstr.cur, nchr[(int)nuk.nuk_type].n_name);
+       prxy("%4d,%-4d", nuk.nuk_x, nuk.nuk_y, player->cnum);
+       pr(" %c %3d%% %4d", nuk.nuk_stockpile, nuk.nuk_effic, nuk.nuk_tech);
+       if (nuk.nuk_plane >= 0) {
+           getplane(nuk.nuk_plane, &plane);
+           pr("%5dP %s",
+              nuk.nuk_plane,
+              plane.pln_flags & PLN_AIRBURST ? "  air" : "ground");
        }
        pr("\n");
     }
+
+    if (nnukes == 0) {
+       if (player->argp[1])
+           pr("%s: No nuke(s)\n", player->argp[1]);
+       else
+           pr("%s: No nuke(s)\n", "");
+       return RET_FAIL;
+    } else
+       pr("%d nuke%s\n", nnukes, splur(nnukes));
+
     return RET_OK;
 }