]> git.pond.sub.org Git - empserver/commitdiff
Let players stop/start units:
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 29 May 2006 21:11:14 +0000 (21:11 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 29 May 2006 21:11:14 +0000 (21:11 +0000)
(genitem, lndstr, nukstr, plnstr, shpstr): New members off, lnd_off,
nuk_off, pln_off, shp_off.
(NSC_GENITEM): New selector off.
(land, nuke, plan, shi): Display efficiency prefixed by `=' when off.
(start, stop, player_coms): Rewrite, new syntax.  Print only objects
that actually change.
(start_hdr, stop_hdr, start_stop_hdr): Consolidate.
(item_u, start_stop, start_stop_sector, proff, start_stop_unit)
(start_stop_unit_hdr, unit_type_name): New.
(upd_land, upd_plane, planerepair, upd_ship): Obey and clear stoppage.

22 files changed:
include/genitem.h
include/land.h
include/nuke.h
include/plane.h
include/ship.h
info/land.t
info/nuke.t
info/plane.t
info/ship.t
info/start.t
info/stop.t
src/lib/commands/land.c
src/lib/commands/nuke.c
src/lib/commands/plan.c
src/lib/commands/shi.c
src/lib/commands/star.c [deleted file]
src/lib/commands/stop.c
src/lib/global/nsc.c
src/lib/player/empmod.c
src/lib/update/land.c
src/lib/update/plane.c
src/lib/update/ship.c

index 7e14d960a307516a5bbbe0ff54e27b8204cd911a..a0892b8dec81b3efbfd54eaf71002e4b6ac466a7 100644 (file)
@@ -50,6 +50,7 @@ struct genitem {
     signed char type;
     signed char effic;
     signed char mobil;
+    unsigned char off;
     short tech;
     char group;
     coord opx, opy;
index 7887fe0882ab42be41738966bf29f2c84ed965b6..3a761686ffdb5c58c10446e207653b25fe5f77b0 100644 (file)
@@ -57,6 +57,7 @@ struct lndstr {
     signed char lnd_type;      /* index in lchr[] */
     signed char lnd_effic;     /* 0% to 100% */
     signed char lnd_mobil;     /* mobility units */
+    unsigned char lnd_off;     /* repairs stopped? */
     short lnd_tech;            /* tech level ship was built at */
     char lnd_army;             /* group membership */
     coord lnd_opx, lnd_opy;    /* Op sector coords */
index dc7059184fce08966387b99f1873648cacb6003f..908530a0f8197c44956518399cd2335401658b8d 100644 (file)
@@ -46,6 +46,7 @@ struct nukstr {
     signed char nuk_type;      /* index in plchr[] */
     signed char nuk_effic;     /* unused, always 100% */
     signed char nuk_mobil;     /* unused, always 0 */
+    unsigned char nuk_off;     /* repairs stopped? (unused) */
     short nuk_tech;            /* nuke's tech level */
     char nuk_stockpile;                /* group membership, unused */
     coord nuk_opx, nuk_opy;    /* Op sector coords, unused */
index 8f03dd746994121e01d76efebc45d91dd025d7dc..b501659d59e85887f07e2b403edfa24ff6129a99 100644 (file)
 #define N_MAXPLANE     40
 #define        PLANE_MINEFF    10
 
-/*
- * some routines assume that from pln_x to pln_wing remains
- * exactly equivalent with shp_x to shp_fleet
- */
 struct plnstr {
     /* initial part must match struct genitem */
     short ef_type;
@@ -56,6 +52,7 @@ struct plnstr {
     signed char pln_type;      /* index in plchr[] */
     signed char pln_effic;     /* actually "training" */
     signed char pln_mobil;     /* plane mobility */
+    unsigned char pln_off;     /* repairs stopped? */
     short pln_tech;            /* plane's tech level */
     char pln_wing;             /* like fleet */
     coord pln_opx;             /* Op sector coords */
index c8ba98082d844c962031593409ddbebe7ba93675..e3fd700c6e37f15a852fc6aa3a61f484e59b4dd5 100644 (file)
@@ -69,6 +69,7 @@ struct shpstr {
     signed char shp_type;      /* index in mchr[] */
     signed char shp_effic;     /* 0% to 100% */
     signed char shp_mobil;     /* mobility units */
+    unsigned char shp_off;     /* repairs stopped? */
     short shp_tech;            /* tech level ship was built at */
     char shp_fleet;            /* group membership */
     coord shp_opx, shp_opy;    /* Op sector coords */
index a4ae194c4ca5b0e4c6322552685d348675aa6df5..5cd9c681a8cd12a9c7e29745469b51c26c5dcdaf 100644 (file)
@@ -6,10 +6,10 @@ The land unit report command is a census of your land units.  For
 example:
 .EX land *
 .NF
-   # unit type          x,y   a  eff mil frt  mu  fd tch retr rd xl ln carry
-   0 cav   cavalry      1,-1    100%  10   0 127  12 992  75%  3  0  0
-   1 cav   cavalry      0,0     100%   0   0 127  12 968  75%  3  0  0
-   2 cav   cavalry      0,0     100%  10   0 127  12  40  75%  3  0  0
+   # unit type          x,y   a   eff mil frt  mu  fd tch retr rd xl ln carry
+   0 cav   cavalry      1,-1     100%  10   0 127  12 992  75%  3  0  0
+   1 cav   cavalry      0,0      100%   0   0 127  12 968  75%  3  0  0
+   2 cav   cavalry      0,0      100%  10   0 127  12  40  75%  3  0  0
 3 units
 .FI
 .s1
@@ -25,7 +25,7 @@ the land unit's current location,
 .L a
 the army designation letter (set by \*Qarmy\*U command),
 .L eff
-the land unit's efficiency,
+the land unit's efficiency, prefixed by \*Q=\*U if stopped,
 .L mil
 the number of mil currently in the land unit,
 .L frt
index d86de492fb61412fb1b6850fb5e3bd92422e2e8d..80f2cabc242800f50e67e514e3aa074b1b9a1c26 100644 (file)
@@ -2,13 +2,12 @@
 .NA nuke "Report status of nukes"
 .LV Expert
 .SY "nuke <NUKES>"
-The nuke report command is a census of your nuke and lists all the
-info available in readable format.  For example:
+The nuke report command is a census of your nukes.  For example:
 .EX nuke *
 .NF
-   # nuke type              x,y    s  eff tech carry burst
-   0 10kt  fission        -24,-4     100%  296   19P   air
-   2 15kt  fission        -19,-1     100%  296
+   # nuke type              x,y    s   eff tech carry burst
+   0 10kt  fission        -24,-4      100%  296   19P   air
+   2 15kt  fission        -19,-1      100%  296
 2 nukes
 .FI
 .s1
@@ -24,13 +23,13 @@ the nuke's current location,
 .L s
 the \*Qstockpile\*U designation letter,
 .L eff
-the nuke's efficiency,
+the nuke's efficiency, prefixed by \*Q=\*U if stopped,
 .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.
+whether the nuke is programmed for air or ground burst.
 .in
 .s1
 .SA "arm, build, launch, transport, Planes"
index f37acb1f1cdb1a07266ff96b12f8f727dfa8b401..d31be028fed6ad1b9d783d80b6e1a78a333d530b 100644 (file)
@@ -2,14 +2,14 @@
 .NA plane "Report status of planes"
 .LV Basic
 .SY "plane <PLANES>"
-The plane report command is a census of your planes and lists all the
-information available in readable format.  For example:
+The plane report command is a census of your planes and lists.  For
+example:
 .EX plane *
 .NF
-   #    type                x,y    w  eff  mu def tech ran hard carry special
-   0 f2  P-51 Mustang       1,-1     100%  90   5  110  11    0
-   1 f2  P-51 Mustang       1,-1     100%  90   5  110  11    0
-   3 lb  TBD-1 Devastato    1,-1     100%  90   4  120  11    0
+   #    type                x,y    w   eff  mu def tech ran hard carry special
+   0 f2  P-51 Mustang       1,-1      100%  90   5  110  11    0
+   1 f2  P-51 Mustang       1,-1      100%  90   5  110  11    0
+   3 lb  TBD-1 Devastato    1,-1      100%  90   4  120  11    0
 3 planes
 .FI
 .s1
@@ -21,11 +21,11 @@ the plane number
 .L type
 the type of plane; \*Qfighter 1\*U, \*Qjet hvy bomber\*U, etc.,
 .L x,y
-the plane's current location
+the plane's current location,
 .L w
 the \*Qair wing\*U designation letter (set by \*Qwingadd\*U command),
 .L eff
-the plane's efficiency,
+the plane's efficiency, prefixed by \*Q=\*U if stopped,
 .L mu
 the number of mobility points the plane has,
 .L def
@@ -35,7 +35,7 @@ the tech level at which it was created,
 .L range
 and the range (in sectors) it can fly in one sortie,
 .L carry
-the ship or land unit the plane is on
+the ship or land unit the carrying the plane, if any,
 .L special
 shows \*Qorbit\*U or \*Qgeosync\*U for satellites in (geo-synchronous)
 orbit, else nuclear armament type and programming (\*QA\*U for
index 8fa3a55cbfe2a9a37f07f04498f10fca94d02da1..980ba0fdca32f0b939c506d101a13acbd841c02d 100644 (file)
@@ -5,9 +5,9 @@
 The ship report command is a census of your ships.  For example:
 .EX ship *
 .NF
-shp#     ship type       x,y   fl  eff civ mil  uw  fd pn he xl ln mob tech
-   0 dd  destroyer       1,1      100%   0   0   0   0  0  0  0  0 127  140
-   1 bb  battleship      1,1      100%   0   0   0   0  0  0  0  0 120  200
+shp#     ship type       x,y   fl   eff civ mil  uw  fd pn he xl ln mob tech
+   0 dd  destroyer       1,1       100%   0   0   0   0  0  0  0  0 127  140
+   1 bb  battleship      1,1       100%   0   0   0   0  0  0  0  0 120  200
 2 ships
 .FI
 .s1
@@ -23,7 +23,7 @@ the ship's current location,
 .L flt
 the fleet designation letter (set by \*Qfleetadd\*U command),
 .L eff
-the ship's efficiency,
+the ship's efficiency, prefixed by \*Q=\*U if stopped,
 .L civ
 the number of civilians on board,
 .L mil
index 932d1c2dbbbbc4f3dd432d7914be06f908060d7a..99b98904951226c72d9e81b3fabc08fb28e39296 100644 (file)
@@ -1,11 +1,10 @@
 .TH Command START
-.NA start "Turn sector production on"
+.NA start "Resume production and repairs"
 .LV Basic
-.SY "start <SECTS>"
-The start command orders a sector to start producing for an update.
-This counteracts the stop command.
+.SY "start <TYPE> <SECTS|SHIPS|PLANES|UNITS|NUKES>"
+The start command orders stopped production and repairs to resume.
 .s1
-.EX start 2,0
+.EX start se 2,0
 .NF
 Wed Jan 20 21:37:22 1993
 PRODUCTION STARTING
index 9e1982543c286922630a502daac0ef1a22d16591..8dc87e87fc66d21b568a45061b78280638e6ae65 100644 (file)
@@ -1,15 +1,23 @@
 .TH Command STOP
-.NA stop "Stop sector production"
+.NA stop "Stop production and repairs"
 .LV Expert
-.SY "stop <SECTS>"
-The stop command orders a sector to stop producing for an update.
-After the update, the sector will return to normal.
+.SY "stop <TYPE> <SECTS|SHIPS|PLANES|UNITS|NUKES>"
+The stop command stops production and repairs for one update.
 .s1
-The sector will still distribute, etc, but will not gain in efficiency or
-produce anything. Ships, planes, and units in the sector will
-not gain efficiency.
+Stopped sectors don't gain in efficiency, don't produce anything, and
+don't work on ships, planes or units there, but otherwise function
+normally: they still pay tax, distribute goods and so forth.
 .s1
-.EX stop 2,0
+Stopping ships, planes and land units works just the same: they don't
+gain in efficiency, they don't produce anything (if applicable), and
+they don't work on embarked land units or planes.
+.s1
+Stopping nukes doesn't do anything in particular, right now.
+.s1
+Conquering a sector stops it automatically.  Stop orders expire at the
+update.  Use the start command to countermand them manually.
+.s1
+.EX stop se 2,0
 .NF
 Wed Jan 20 21:35:34 1993
 PRODUCTION STOPPAGE
index a8b28f61c4eb4f8978ce4dc287438d18034c5e18..bfdcbed46d2b9fffaa3e4b04ef0616ba6fa4ad42 100644 (file)
@@ -64,7 +64,7 @@ land(void)
        if (nunits++ == 0) {
            if (player->god)
                pr("own ");
-           pr("   # unit type          x,y   a  eff mil frt  mu  fd");
+           pr("   # unit type          x,y   a   eff mil frt  mu  fd");
            if (opt_FUEL)
                pr(" fl");
            pr(" tch retr rd xl ln carry\n");
@@ -75,7 +75,7 @@ land(void)
        pr("%-15.15s", lchr[(int)land.lnd_type].l_name);
        prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
        pr("%1.1s", &land.lnd_army);
-       pr("%4d%%", land.lnd_effic);
+       pr(" %c%3d%%", land.lnd_off ? '=' : ' ', land.lnd_effic);
        pr("%4d", land.lnd_item[I_MILIT]);
        pr("%4d", land.lnd_harden);
        pr("%4d", land.lnd_mobil);
index 136d1be50b0b9d9a553d0c289d323ce524c45504..bd106f6155e1e7c02581bb60c4953d3cef8ceab0 100644 (file)
@@ -61,14 +61,15 @@ nuke(void)
        if (nnukes++ == 0) {
            if (player->god)
                pr("own ");
-           pr("   # nuke type              x,y    s  eff tech carry burst\n");
+           pr("   # nuke type              x,y    s   eff tech carry burst\n");
        }
        if (player->god)
            pr("%-3d ", nuk.nuk_own);
        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(" %1.1s %3d%% %4d",
-          &nuk.nuk_stockpile, nuk.nuk_effic, nuk.nuk_tech);
+       pr(" %1.1s %c%3d%% %4d",
+          &nuk.nuk_stockpile, nuk.nuk_off ? '=' : ' ', nuk.nuk_effic,
+          nuk.nuk_tech);
        if (nuk.nuk_plane >= 0) {
            getplane(nuk.nuk_plane, &plane);
            pr("%5dP %s",
index b501bf8d3f5eb156d69e76c50da93fcdce4545e9..285080bd08b03fef5e5658b4f2f022d00246866d 100644 (file)
@@ -60,15 +60,15 @@ plan(void)
        if (nplanes++ == 0) {
            if (player->god)
                pr("own ");
-           pr("   #    type                x,y    w  eff  mu def tech ran hard carry special\n");
+           pr("   #    type                x,y    w   eff  mu def tech ran hard carry special\n");
        }
        if (player->god)
            pr("%3d ", plane.pln_own);
        pr("%4d %-19.19s ", np.cur, plchr[(int)plane.pln_type].pl_name);
        prxy("%4d,%-4d", plane.pln_x, plane.pln_y, player->cnum);
-       pr(" %1.1s %3d%% %3d %3d %4d %3d  %3d",
-          &plane.pln_wing, plane.pln_effic, plane.pln_mobil,
-          plane.pln_def, plane.pln_tech,
+       pr(" %1.1s %c%3d%% %3d %3d %4d %3d  %3d",
+          &plane.pln_wing, plane.pln_off ? '=' : ' ', plane.pln_effic,
+          plane.pln_mobil, plane.pln_def, plane.pln_tech,
           plane.pln_range, plane.pln_harden);
        if (plane.pln_ship >= 0)
            pr("%5dS", plane.pln_ship);
index 12a79a29e4196bb6d88759344c2b16e80b15f90d..6371edd5aa5209fb2a118126617f822537590e2d 100644 (file)
@@ -61,11 +61,8 @@ shi(void)
        if (nships++ == 0) {
            if (player->god)
                pr("own ");
-           pr("shp#     ship type       x,y   fl  eff civ mil  uw  fd pn");
-           pr(" he");
-           pr(" xl");
-           pr(" ln");
-           pr(" mob");
+           pr("shp#     ship type       x,y   fl   eff civ mil  uw  fd pn"
+              " he xl ln mob");
            if (opt_FUEL)
                pr(" fuel");
            pr(" tech\n");
@@ -76,7 +73,7 @@ shi(void)
        pr("%-16.16s ", mchr[(int)ship.shp_type].m_name);
        prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
        pr("%1.1s", &ship.shp_fleet);
-       pr("%4d%%", ship.shp_effic);
+       pr(" %c%3d%%", ship.shp_off ? '=' : ' ', ship.shp_effic);
 
        pr("%4d", ship.shp_item[I_CIVIL]);
        pr("%4d", ship.shp_item[I_MILIT]);
diff --git a/src/lib/commands/star.c b/src/lib/commands/star.c
deleted file mode 100644 (file)
index 5d8a588..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  ---
- *
- *  See files README, COPYING and CREDITS in the root of the source
- *  tree for related information and legal notices.  It is expected
- *  that future projects/authors will amend these files as needed.
- *
- *  ---
- *
- *  star.c: Start a sector producing
- * 
- *  Known contributors to this file:
- *     Thomas Ruschak, 1992
- *     Steve McClure, 1998
- */
-
-#include <config.h>
-
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "sect.h"
-#include "nsc.h"
-#include "nat.h"
-#include "path.h"
-#include "file.h"
-#include "commands.h"
-
-static void start_hdr(void);
-
-int
-start(void)
-{
-    struct sctstr sect;
-    int nsect;
-    struct nstr_sect nstr;
-
-    if (!snxtsct(&nstr, player->argp[1]))
-       return RET_SYN;
-    prdate();
-    nsect = 0;
-    while (nxtsct(&nstr, &sect)) {
-       if (!player->owner)
-           continue;
-       if (nsect++ == 0)
-           start_hdr();
-       if (player->god)
-           pr("%3d ", sect.sct_own);
-       prxy("%4d,%-4d", nstr.x, nstr.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(" will be updated normally.\n");
-       if (sect.sct_off != 0) {
-           sect.sct_off = 0;
-           putsect(&sect);
-       }
-    }
-    if (nsect == 0) {
-       if (player->argp[1])
-           pr("%s: No sector(s)\n", player->argp[1]);
-       else
-           pr("%s: No sector(s)\n", "");
-       return RET_FAIL;
-    } else
-       pr("%d sector%s\n", nsect, splur(nsect));
-    return 0;
-}
-
-static void
-start_hdr(void)
-{
-    if (player->god)
-       pr("    ");
-    pr("PRODUCTION STARTING\n");
-    if (player->god)
-       pr("own ");
-    pr("  sect        eff\n");
-}
index d3cddced05ad6b0a7ad06328ac56bc932f9c08e2..507c0f54cc9837393fc41391e3cd8ca7510847ce 100644 (file)
  *
  *  ---
  *
- *  stop.c: Stop a sector from producing
+ *  stop.c: Stop a sector or unit from producing
  * 
  *  Known contributors to this file:
  *     Thomas Ruschak, 1992 
  *     Steve McClure, 1998
+ *     Markus Armbruster, 2006
  */
 
 #include <config.h>
 #include "file.h"
 #include "commands.h"
 
-static void stop_hdr(void);
+union item_u {
+    struct genitem gen;
+    struct shpstr ship;
+    struct plnstr plane;
+    struct lndstr land;
+    struct nukstr nuke;
+};
+
+static int start_stop(int);
+static int start_stop_sector(char *, int);
+static void start_stop_hdr(int);
+static void proff(int);
+static int start_stop_unit(int, char *, int);
+static void start_stop_unit_hdr(int);
+static char *unit_type_name(union item_u *);
+
+int
+start(void)
+{
+    return start_stop(0);
+}
 
 int
 stop(void)
+{
+    return start_stop(1);
+}
+
+static int
+start_stop(int off)
+{
+    static int sct_or_unit[] = {
+       EF_SECTOR, EF_SHIP, EF_PLANE, EF_LAND, EF_NUKE, EF_BAD
+    };
+    int type;
+    char *arg, *p;
+    char buf[1024];
+
+    if (player->argp[1] && !isalpha(*player->argp[1])) {
+       /* accept legacy syntax */
+       type = EF_SECTOR;
+       arg = player->argp[1];
+    } else {
+       p = getstarg(player->argp[1],
+                    "Sector, ship, plane, land unit or nuke? ", buf);
+       if (p == 0)
+           return RET_SYN;
+       type = ef_byname_from(p, sct_or_unit);
+       if (type < 0) {
+           pr("Sectors, ships, planes, land units or nukes only!");
+           return RET_SYN;
+       }
+       arg = player->argp[2];
+    }
+
+    if (type == EF_SECTOR)
+       return start_stop_sector(arg, off);
+    return start_stop_unit(type, arg, off);
+}
+
+static int
+start_stop_sector(char *arg, int off)
 {
     struct sctstr sect;
     int nsect;
     struct nstr_sect nstr;
 
-    if (!snxtsct(&nstr, player->argp[1]))
+    if (!snxtsct(&nstr, arg))
        return RET_SYN;
     prdate();
     nsect = 0;
     while (nxtsct(&nstr, &sect)) {
        if (!player->owner)
            continue;
+       if (!sect.sct_off == !off)
+           continue;
        if (nsect++ == 0)
-           stop_hdr();
+           start_stop_hdr(off);
        if (player->god)
            pr("%3d ", sect.sct_own);
        prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
@@ -71,18 +132,12 @@ stop(void)
        else
            pr(" ");
        pr("%4d%%", sect.sct_effic);
-
-       pr(" will not produce or gain efficiency.\n");
-       if (sect.sct_off != 1) {
-           sect.sct_off = 1;
-           putsect(&sect);
-       }
+       proff(off);
+       sect.sct_off = off;
+       putsect(&sect);
     }
     if (nsect == 0) {
-       if (player->argp[1])
-           pr("%s: No sector(s)\n", player->argp[1]);
-       else
-           pr("%s: No sector(s)\n", "");
+       pr("%s: No sector(s)\n", arg ? arg : "");
        return RET_FAIL;
     } else
        pr("%d sector%s\n", nsect, splur(nsect));
@@ -90,12 +145,86 @@ stop(void)
 }
 
 static void
-stop_hdr(void)
+start_stop_hdr(int off)
 {
     if (player->god)
        pr("    ");
-    pr("PRODUCTION STOPPAGE\n");
+    pr("PRODUCTION %s\n", off ? "STOPPAGE" : "STARTING");
     if (player->god)
        pr("own ");
     pr("  sect        eff\n");
 }
+
+static void
+proff(int off)
+{
+    if (off)
+       pr("  will not produce or gain efficiency.\n");
+    else
+       pr("  will be updated normally.\n");
+}
+
+static int
+start_stop_unit(int type, char *arg, int off)
+{
+    union item_u unit;
+    int nunit;
+    struct nstr_item nstr;
+
+    if (!snxtitem(&nstr, type, arg))
+       return RET_SYN;
+    prdate();
+    nunit = 0;
+    while (nxtitem(&nstr, &unit)) {
+       if (!player->owner)
+           continue;
+       if (!unit.gen.off == !off)
+           continue;
+       if (nunit++ == 0)
+           start_stop_unit_hdr(off);
+       if (player->god)
+           pr("%3d ", unit.gen.own);
+       pr("%4d %-4.4s ", nstr.cur, unit_type_name(&unit));
+       prxy("%4d,%-4d", unit.gen.x, unit.gen.y, player->cnum);
+       pr("%4d%%", unit.gen.effic);
+       proff(off);
+       unit.gen.off = off;
+       ef_write(type, nstr.cur, &unit);
+    }
+    if (nunit == 0) {
+       pr("%s: No %s(s)\n", arg ? arg : "", ef_nameof(type));
+       return RET_FAIL;
+    } else
+       pr("%d %s%s\n", nunit, ef_nameof(type), splur(nunit));
+    return 0;
+}
+
+static void
+start_stop_unit_hdr(int off)
+{
+    if (player->god)
+       pr("    ");
+    pr("PRODUCTION %s\n", off ? "STOPPAGE" : "STARTING");
+    if (player->god)
+       pr("own ");
+    pr("   #         x,y     eff\n");
+}
+
+static char *
+unit_type_name(union item_u *unit)
+{
+    int type = unit->gen.type;
+
+    switch (unit->gen.ef_type) {
+    case EF_SHIP:
+       return mchr[type].m_name;
+    case EF_PLANE:
+       return plchr[type].pl_name;
+    case EF_LAND:
+       return lchr[type].l_name;
+    case EF_NUKE:
+       return nchr[type].n_name;
+    }
+    CANT_REACH();
+    return "?";
+}
index 4a1f8d1b061dd56a419f4ddabddacd10aa207551..8287650a27484e07de738555fe644150a17088e2 100644 (file)
@@ -196,6 +196,7 @@ struct castr dchr_ca[] = {
 { NSC_TYPEID, 0, 0, fldoff(genitem, type), "type", ef_chr},            \
 { NSC_CHAR, 0, 0, fldoff(genitem, effic), "effic", EF_BAD},            \
 { NSC_CHAR , 0, 0, fldoff(genitem, mobil), "mobil", EF_BAD},           \
+{ NSC_UCHAR , 0, 0, fldoff(genitem, off), "off", EF_BAD},              \
 { NSC_SHORT, 0, 0, fldoff(genitem, tech), "tech", EF_BAD},             \
 { NSC_STRINGY, NSC_EXTRA, 1, fldoff(genitem, group), "group", EF_BAD}, \
 { NSC_XCOORD, 0, 0, fldoff(genitem, opx), "opx", EF_BAD},              \
index 02dcbfe740b688bbf3e34f9e509060d81234a7e8..c8b1c9f8696ebc9beb317fb1b587de526149051f 100644 (file)
@@ -237,9 +237,9 @@ struct cmndstr player_coms[] = {
     {"sorder <SHIPS>", 0, sorde, C_MOD, NORM + CAP},
     {"spy <SECTS>", 1, spy, C_MOD, NORM + CAP},
     {"sstat <SHIPS>", 0, sstat, 0, NORM},
-    {"start <SECTS>", 1, start, C_MOD, NORM + CAP},
+    {"start <TYPE> <SECTS|PLANES|SHIPS|UNITS>", 1, start, C_MOD, NORM + CAP},
     {"starvation [<SECTS>|l <UNITS>|s <SHIPS>]", 0, starve, 0, NORM},
-    {"stop <SECTS>", 1, stop, C_MOD, NORM + CAP},
+    {"stop <TYPE> <SECTS|PLANES|SHIPS|UNITS>", 1, stop, C_MOD, NORM + CAP},
     {"strength <SECTS>", 1, stre, C_MOD, NORM},
     {"supply <LAND UNITS>", 1, supp, C_MOD, NORM + CAP},
     {"survey <SELECTOR> <SECTS>", 0, surv, 0, NORM + CAP},
index 254302af429c8589bbd13858baa533ec11fccd15..e664e36f07fb06c01b030192b25326f9d2e17480 100644 (file)
@@ -132,8 +132,9 @@ upd_land(struct lndstr *lp, int etus,
 
     lcp = &lchr[(int)lp->lnd_type];
     if (build == 1) {
-       if (np->nat_money >= 0)
+       if (!lp->lnd_off && np->nat_money >= 0)
            landrepair(lp, np, bp, etus);
+       lp->lnd_off = 0;
     } else {
        mult = 1;
        if (np->nat_level[NAT_TLEV] < lp->lnd_tech * 0.85)
index 802669f0f0cfff79fae5cc029bebcdcc574980e3..a055616292127114486fe1ca52a6af058f0e0d71 100644 (file)
@@ -102,8 +102,9 @@ upd_plane(struct plnstr *pp, int etus,
     int mult, cost, eff;
 
     if (build == 1) {
-       if (np->nat_money >= 0)
+       if (!pp->pln_off && np->nat_money >= 0)
            planerepair(pp, np, bp, etus);
+       pp->pln_off = 0;
     } else {
        mult = 1;
        if (np->nat_level[NAT_TLEV] < pp->pln_tech * 0.85)
@@ -151,6 +152,8 @@ planerepair(struct plnstr *pp, struct natstr *np, int *bp, int etus)
        if (pp->pln_effic >= 80)
            return;
        carrier = getshipp(pp->pln_ship);
+       if (carrier->shp_off)
+           return;
        if (CANT_HAPPEN(!carrier || carrier->shp_own != pp->pln_own))
            return;
     }
index 8bfe670f878d2c2b32575ce939bd3e1006aba611..18518b3a0cb360d99341018eed03679bd464a220 100644 (file)
@@ -136,8 +136,9 @@ upd_ship(struct shpstr *sp, int etus,
 
     mp = &mchr[(int)sp->shp_type];
     if (build == 1) {
-       if (np->nat_money >= 0)
+       if (!sp->shp_off && np->nat_money >= 0)
            shiprepair(sp, np, bp, etus);
+       sp->shp_off = 0;
     } else {
        mult = 1;
        if (np->nat_level[NAT_TLEV] < sp->shp_tech * 0.85)