Let players stop/start units:
(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.
This commit is contained in:
parent
520446ef39
commit
eb1512d75f
22 changed files with 218 additions and 179 deletions
|
@ -50,6 +50,7 @@ struct genitem {
|
||||||
signed char type;
|
signed char type;
|
||||||
signed char effic;
|
signed char effic;
|
||||||
signed char mobil;
|
signed char mobil;
|
||||||
|
unsigned char off;
|
||||||
short tech;
|
short tech;
|
||||||
char group;
|
char group;
|
||||||
coord opx, opy;
|
coord opx, opy;
|
||||||
|
|
|
@ -57,6 +57,7 @@ struct lndstr {
|
||||||
signed char lnd_type; /* index in lchr[] */
|
signed char lnd_type; /* index in lchr[] */
|
||||||
signed char lnd_effic; /* 0% to 100% */
|
signed char lnd_effic; /* 0% to 100% */
|
||||||
signed char lnd_mobil; /* mobility units */
|
signed char lnd_mobil; /* mobility units */
|
||||||
|
unsigned char lnd_off; /* repairs stopped? */
|
||||||
short lnd_tech; /* tech level ship was built at */
|
short lnd_tech; /* tech level ship was built at */
|
||||||
char lnd_army; /* group membership */
|
char lnd_army; /* group membership */
|
||||||
coord lnd_opx, lnd_opy; /* Op sector coords */
|
coord lnd_opx, lnd_opy; /* Op sector coords */
|
||||||
|
|
|
@ -46,6 +46,7 @@ struct nukstr {
|
||||||
signed char nuk_type; /* index in plchr[] */
|
signed char nuk_type; /* index in plchr[] */
|
||||||
signed char nuk_effic; /* unused, always 100% */
|
signed char nuk_effic; /* unused, always 100% */
|
||||||
signed char nuk_mobil; /* unused, always 0 */
|
signed char nuk_mobil; /* unused, always 0 */
|
||||||
|
unsigned char nuk_off; /* repairs stopped? (unused) */
|
||||||
short nuk_tech; /* nuke's tech level */
|
short nuk_tech; /* nuke's tech level */
|
||||||
char nuk_stockpile; /* group membership, unused */
|
char nuk_stockpile; /* group membership, unused */
|
||||||
coord nuk_opx, nuk_opy; /* Op sector coords, unused */
|
coord nuk_opx, nuk_opy; /* Op sector coords, unused */
|
||||||
|
|
|
@ -42,10 +42,6 @@
|
||||||
#define N_MAXPLANE 40
|
#define N_MAXPLANE 40
|
||||||
#define PLANE_MINEFF 10
|
#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 {
|
struct plnstr {
|
||||||
/* initial part must match struct genitem */
|
/* initial part must match struct genitem */
|
||||||
short ef_type;
|
short ef_type;
|
||||||
|
@ -56,6 +52,7 @@ struct plnstr {
|
||||||
signed char pln_type; /* index in plchr[] */
|
signed char pln_type; /* index in plchr[] */
|
||||||
signed char pln_effic; /* actually "training" */
|
signed char pln_effic; /* actually "training" */
|
||||||
signed char pln_mobil; /* plane mobility */
|
signed char pln_mobil; /* plane mobility */
|
||||||
|
unsigned char pln_off; /* repairs stopped? */
|
||||||
short pln_tech; /* plane's tech level */
|
short pln_tech; /* plane's tech level */
|
||||||
char pln_wing; /* like fleet */
|
char pln_wing; /* like fleet */
|
||||||
coord pln_opx; /* Op sector coords */
|
coord pln_opx; /* Op sector coords */
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct shpstr {
|
||||||
signed char shp_type; /* index in mchr[] */
|
signed char shp_type; /* index in mchr[] */
|
||||||
signed char shp_effic; /* 0% to 100% */
|
signed char shp_effic; /* 0% to 100% */
|
||||||
signed char shp_mobil; /* mobility units */
|
signed char shp_mobil; /* mobility units */
|
||||||
|
unsigned char shp_off; /* repairs stopped? */
|
||||||
short shp_tech; /* tech level ship was built at */
|
short shp_tech; /* tech level ship was built at */
|
||||||
char shp_fleet; /* group membership */
|
char shp_fleet; /* group membership */
|
||||||
coord shp_opx, shp_opy; /* Op sector coords */
|
coord shp_opx, shp_opy; /* Op sector coords */
|
||||||
|
|
10
info/land.t
10
info/land.t
|
@ -6,10 +6,10 @@ The land unit report command is a census of your land units. For
|
||||||
example:
|
example:
|
||||||
.EX land *
|
.EX land *
|
||||||
.NF
|
.NF
|
||||||
# unit type x,y a eff mil frt mu fd tch retr rd xl ln carry
|
# 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
|
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
|
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
|
2 cav cavalry 0,0 100% 10 0 127 12 40 75% 3 0 0
|
||||||
3 units
|
3 units
|
||||||
.FI
|
.FI
|
||||||
.s1
|
.s1
|
||||||
|
@ -25,7 +25,7 @@ the land unit's current location,
|
||||||
.L a
|
.L a
|
||||||
the army designation letter (set by \*Qarmy\*U command),
|
the army designation letter (set by \*Qarmy\*U command),
|
||||||
.L eff
|
.L eff
|
||||||
the land unit's efficiency,
|
the land unit's efficiency, prefixed by \*Q=\*U if stopped,
|
||||||
.L mil
|
.L mil
|
||||||
the number of mil currently in the land unit,
|
the number of mil currently in the land unit,
|
||||||
.L frt
|
.L frt
|
||||||
|
|
13
info/nuke.t
13
info/nuke.t
|
@ -2,13 +2,12 @@
|
||||||
.NA nuke "Report status of nukes"
|
.NA nuke "Report status of nukes"
|
||||||
.LV Expert
|
.LV Expert
|
||||||
.SY "nuke <NUKES>"
|
.SY "nuke <NUKES>"
|
||||||
The nuke report command is a census of your nuke and lists all the
|
The nuke report command is a census of your nukes. For example:
|
||||||
info available in readable format. For example:
|
|
||||||
.EX nuke *
|
.EX nuke *
|
||||||
.NF
|
.NF
|
||||||
# nuke type x,y s eff tech carry burst
|
# nuke type x,y s eff tech carry burst
|
||||||
0 10kt fission -24,-4 100% 296 19P air
|
0 10kt fission -24,-4 100% 296 19P air
|
||||||
2 15kt fission -19,-1 100% 296
|
2 15kt fission -19,-1 100% 296
|
||||||
2 nukes
|
2 nukes
|
||||||
.FI
|
.FI
|
||||||
.s1
|
.s1
|
||||||
|
@ -24,13 +23,13 @@ the nuke's current location,
|
||||||
.L s
|
.L s
|
||||||
the \*Qstockpile\*U designation letter,
|
the \*Qstockpile\*U designation letter,
|
||||||
.L eff
|
.L eff
|
||||||
the nuke's efficiency,
|
the nuke's efficiency, prefixed by \*Q=\*U if stopped,
|
||||||
.L tech
|
.L tech
|
||||||
the tech level at which it was created,
|
the tech level at which it was created,
|
||||||
.L carry
|
.L carry
|
||||||
the plane the nuke is on, if any,
|
the plane the nuke is on, if any,
|
||||||
.L burst
|
.L burst
|
||||||
whether the nuke is programmed to air- or groundburst.
|
whether the nuke is programmed for air or ground burst.
|
||||||
.in
|
.in
|
||||||
.s1
|
.s1
|
||||||
.SA "arm, build, launch, transport, Planes"
|
.SA "arm, build, launch, transport, Planes"
|
||||||
|
|
18
info/plane.t
18
info/plane.t
|
@ -2,14 +2,14 @@
|
||||||
.NA plane "Report status of planes"
|
.NA plane "Report status of planes"
|
||||||
.LV Basic
|
.LV Basic
|
||||||
.SY "plane <PLANES>"
|
.SY "plane <PLANES>"
|
||||||
The plane report command is a census of your planes and lists all the
|
The plane report command is a census of your planes and lists. For
|
||||||
information available in readable format. For example:
|
example:
|
||||||
.EX plane *
|
.EX plane *
|
||||||
.NF
|
.NF
|
||||||
# type x,y w eff mu def tech ran hard carry special
|
# 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
|
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
|
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 lb TBD-1 Devastato 1,-1 100% 90 4 120 11 0
|
||||||
3 planes
|
3 planes
|
||||||
.FI
|
.FI
|
||||||
.s1
|
.s1
|
||||||
|
@ -21,11 +21,11 @@ the plane number
|
||||||
.L type
|
.L type
|
||||||
the type of plane; \*Qfighter 1\*U, \*Qjet hvy bomber\*U, etc.,
|
the type of plane; \*Qfighter 1\*U, \*Qjet hvy bomber\*U, etc.,
|
||||||
.L x,y
|
.L x,y
|
||||||
the plane's current location
|
the plane's current location,
|
||||||
.L w
|
.L w
|
||||||
the \*Qair wing\*U designation letter (set by \*Qwingadd\*U command),
|
the \*Qair wing\*U designation letter (set by \*Qwingadd\*U command),
|
||||||
.L eff
|
.L eff
|
||||||
the plane's efficiency,
|
the plane's efficiency, prefixed by \*Q=\*U if stopped,
|
||||||
.L mu
|
.L mu
|
||||||
the number of mobility points the plane has,
|
the number of mobility points the plane has,
|
||||||
.L def
|
.L def
|
||||||
|
@ -35,7 +35,7 @@ the tech level at which it was created,
|
||||||
.L range
|
.L range
|
||||||
and the range (in sectors) it can fly in one sortie,
|
and the range (in sectors) it can fly in one sortie,
|
||||||
.L carry
|
.L carry
|
||||||
the ship or land unit the plane is on
|
the ship or land unit the carrying the plane, if any,
|
||||||
.L special
|
.L special
|
||||||
shows \*Qorbit\*U or \*Qgeosync\*U for satellites in (geo-synchronous)
|
shows \*Qorbit\*U or \*Qgeosync\*U for satellites in (geo-synchronous)
|
||||||
orbit, else nuclear armament type and programming (\*QA\*U for
|
orbit, else nuclear armament type and programming (\*QA\*U for
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
The ship report command is a census of your ships. For example:
|
The ship report command is a census of your ships. For example:
|
||||||
.EX ship *
|
.EX ship *
|
||||||
.NF
|
.NF
|
||||||
shp# ship type x,y fl eff civ mil uw fd pn he xl ln mob tech
|
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
|
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
|
1 bb battleship 1,1 100% 0 0 0 0 0 0 0 0 120 200
|
||||||
2 ships
|
2 ships
|
||||||
.FI
|
.FI
|
||||||
.s1
|
.s1
|
||||||
|
@ -23,7 +23,7 @@ the ship's current location,
|
||||||
.L flt
|
.L flt
|
||||||
the fleet designation letter (set by \*Qfleetadd\*U command),
|
the fleet designation letter (set by \*Qfleetadd\*U command),
|
||||||
.L eff
|
.L eff
|
||||||
the ship's efficiency,
|
the ship's efficiency, prefixed by \*Q=\*U if stopped,
|
||||||
.L civ
|
.L civ
|
||||||
the number of civilians on board,
|
the number of civilians on board,
|
||||||
.L mil
|
.L mil
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
.TH Command START
|
.TH Command START
|
||||||
.NA start "Turn sector production on"
|
.NA start "Resume production and repairs"
|
||||||
.LV Basic
|
.LV Basic
|
||||||
.SY "start <SECTS>"
|
.SY "start <TYPE> <SECTS|SHIPS|PLANES|UNITS|NUKES>"
|
||||||
The start command orders a sector to start producing for an update.
|
The start command orders stopped production and repairs to resume.
|
||||||
This counteracts the stop command.
|
|
||||||
.s1
|
.s1
|
||||||
.EX start 2,0
|
.EX start se 2,0
|
||||||
.NF
|
.NF
|
||||||
Wed Jan 20 21:37:22 1993
|
Wed Jan 20 21:37:22 1993
|
||||||
PRODUCTION STARTING
|
PRODUCTION STARTING
|
||||||
|
|
24
info/stop.t
24
info/stop.t
|
@ -1,15 +1,23 @@
|
||||||
.TH Command STOP
|
.TH Command STOP
|
||||||
.NA stop "Stop sector production"
|
.NA stop "Stop production and repairs"
|
||||||
.LV Expert
|
.LV Expert
|
||||||
.SY "stop <SECTS>"
|
.SY "stop <TYPE> <SECTS|SHIPS|PLANES|UNITS|NUKES>"
|
||||||
The stop command orders a sector to stop producing for an update.
|
The stop command stops production and repairs for one update.
|
||||||
After the update, the sector will return to normal.
|
|
||||||
.s1
|
.s1
|
||||||
The sector will still distribute, etc, but will not gain in efficiency or
|
Stopped sectors don't gain in efficiency, don't produce anything, and
|
||||||
produce anything. Ships, planes, and units in the sector will
|
don't work on ships, planes or units there, but otherwise function
|
||||||
not gain efficiency.
|
normally: they still pay tax, distribute goods and so forth.
|
||||||
.s1
|
.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
|
.NF
|
||||||
Wed Jan 20 21:35:34 1993
|
Wed Jan 20 21:35:34 1993
|
||||||
PRODUCTION STOPPAGE
|
PRODUCTION STOPPAGE
|
||||||
|
|
|
@ -64,7 +64,7 @@ land(void)
|
||||||
if (nunits++ == 0) {
|
if (nunits++ == 0) {
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
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)
|
if (opt_FUEL)
|
||||||
pr(" fl");
|
pr(" fl");
|
||||||
pr(" tch retr rd xl ln carry\n");
|
pr(" tch retr rd xl ln carry\n");
|
||||||
|
@ -75,7 +75,7 @@ land(void)
|
||||||
pr("%-15.15s", lchr[(int)land.lnd_type].l_name);
|
pr("%-15.15s", lchr[(int)land.lnd_type].l_name);
|
||||||
prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
|
prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
|
||||||
pr("%1.1s", &land.lnd_army);
|
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_item[I_MILIT]);
|
||||||
pr("%4d", land.lnd_harden);
|
pr("%4d", land.lnd_harden);
|
||||||
pr("%4d", land.lnd_mobil);
|
pr("%4d", land.lnd_mobil);
|
||||||
|
|
|
@ -61,14 +61,15 @@ nuke(void)
|
||||||
if (nnukes++ == 0) {
|
if (nnukes++ == 0) {
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
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)
|
if (player->god)
|
||||||
pr("%-3d ", nuk.nuk_own);
|
pr("%-3d ", nuk.nuk_own);
|
||||||
pr("%4d %-19.19s ", nstr.cur, nchr[(int)nuk.nuk_type].n_name);
|
pr("%4d %-19.19s ", nstr.cur, nchr[(int)nuk.nuk_type].n_name);
|
||||||
prxy("%4d,%-4d", nuk.nuk_x, nuk.nuk_y, player->cnum);
|
prxy("%4d,%-4d", nuk.nuk_x, nuk.nuk_y, player->cnum);
|
||||||
pr(" %1.1s %3d%% %4d",
|
pr(" %1.1s %c%3d%% %4d",
|
||||||
&nuk.nuk_stockpile, nuk.nuk_effic, nuk.nuk_tech);
|
&nuk.nuk_stockpile, nuk.nuk_off ? '=' : ' ', nuk.nuk_effic,
|
||||||
|
nuk.nuk_tech);
|
||||||
if (nuk.nuk_plane >= 0) {
|
if (nuk.nuk_plane >= 0) {
|
||||||
getplane(nuk.nuk_plane, &plane);
|
getplane(nuk.nuk_plane, &plane);
|
||||||
pr("%5dP %s",
|
pr("%5dP %s",
|
||||||
|
|
|
@ -60,15 +60,15 @@ plan(void)
|
||||||
if (nplanes++ == 0) {
|
if (nplanes++ == 0) {
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
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)
|
if (player->god)
|
||||||
pr("%3d ", plane.pln_own);
|
pr("%3d ", plane.pln_own);
|
||||||
pr("%4d %-19.19s ", np.cur, plchr[(int)plane.pln_type].pl_name);
|
pr("%4d %-19.19s ", np.cur, plchr[(int)plane.pln_type].pl_name);
|
||||||
prxy("%4d,%-4d", plane.pln_x, plane.pln_y, player->cnum);
|
prxy("%4d,%-4d", plane.pln_x, plane.pln_y, player->cnum);
|
||||||
pr(" %1.1s %3d%% %3d %3d %4d %3d %3d",
|
pr(" %1.1s %c%3d%% %3d %3d %4d %3d %3d",
|
||||||
&plane.pln_wing, plane.pln_effic, plane.pln_mobil,
|
&plane.pln_wing, plane.pln_off ? '=' : ' ', plane.pln_effic,
|
||||||
plane.pln_def, plane.pln_tech,
|
plane.pln_mobil, plane.pln_def, plane.pln_tech,
|
||||||
plane.pln_range, plane.pln_harden);
|
plane.pln_range, plane.pln_harden);
|
||||||
if (plane.pln_ship >= 0)
|
if (plane.pln_ship >= 0)
|
||||||
pr("%5dS", plane.pln_ship);
|
pr("%5dS", plane.pln_ship);
|
||||||
|
|
|
@ -61,11 +61,8 @@ shi(void)
|
||||||
if (nships++ == 0) {
|
if (nships++ == 0) {
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("shp# ship type x,y fl eff civ mil uw fd pn");
|
pr("shp# ship type x,y fl eff civ mil uw fd pn"
|
||||||
pr(" he");
|
" he xl ln mob");
|
||||||
pr(" xl");
|
|
||||||
pr(" ln");
|
|
||||||
pr(" mob");
|
|
||||||
if (opt_FUEL)
|
if (opt_FUEL)
|
||||||
pr(" fuel");
|
pr(" fuel");
|
||||||
pr(" tech\n");
|
pr(" tech\n");
|
||||||
|
@ -76,7 +73,7 @@ shi(void)
|
||||||
pr("%-16.16s ", mchr[(int)ship.shp_type].m_name);
|
pr("%-16.16s ", mchr[(int)ship.shp_type].m_name);
|
||||||
prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
|
prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
|
||||||
pr("%1.1s", &ship.shp_fleet);
|
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_CIVIL]);
|
||||||
pr("%4d", ship.shp_item[I_MILIT]);
|
pr("%4d", ship.shp_item[I_MILIT]);
|
||||||
|
|
|
@ -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, §)) {
|
|
||||||
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(§);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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");
|
|
||||||
}
|
|
|
@ -25,11 +25,12 @@
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* stop.c: Stop a sector from producing
|
* stop.c: Stop a sector or unit from producing
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Thomas Ruschak, 1992
|
* Thomas Ruschak, 1992
|
||||||
* Steve McClure, 1998
|
* Steve McClure, 1998
|
||||||
|
* Markus Armbruster, 2006
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -44,24 +45,84 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "commands.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
|
int
|
||||||
stop(void)
|
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;
|
struct sctstr sect;
|
||||||
int nsect;
|
int nsect;
|
||||||
struct nstr_sect nstr;
|
struct nstr_sect nstr;
|
||||||
|
|
||||||
if (!snxtsct(&nstr, player->argp[1]))
|
if (!snxtsct(&nstr, arg))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
prdate();
|
prdate();
|
||||||
nsect = 0;
|
nsect = 0;
|
||||||
while (nxtsct(&nstr, §)) {
|
while (nxtsct(&nstr, §)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
|
if (!sect.sct_off == !off)
|
||||||
|
continue;
|
||||||
if (nsect++ == 0)
|
if (nsect++ == 0)
|
||||||
stop_hdr();
|
start_stop_hdr(off);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("%3d ", sect.sct_own);
|
pr("%3d ", sect.sct_own);
|
||||||
prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
|
prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
|
||||||
|
@ -71,18 +132,12 @@ stop(void)
|
||||||
else
|
else
|
||||||
pr(" ");
|
pr(" ");
|
||||||
pr("%4d%%", sect.sct_effic);
|
pr("%4d%%", sect.sct_effic);
|
||||||
|
proff(off);
|
||||||
pr(" will not produce or gain efficiency.\n");
|
sect.sct_off = off;
|
||||||
if (sect.sct_off != 1) {
|
putsect(§);
|
||||||
sect.sct_off = 1;
|
|
||||||
putsect(§);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (nsect == 0) {
|
if (nsect == 0) {
|
||||||
if (player->argp[1])
|
pr("%s: No sector(s)\n", arg ? arg : "");
|
||||||
pr("%s: No sector(s)\n", player->argp[1]);
|
|
||||||
else
|
|
||||||
pr("%s: No sector(s)\n", "");
|
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
} else
|
} else
|
||||||
pr("%d sector%s\n", nsect, splur(nsect));
|
pr("%d sector%s\n", nsect, splur(nsect));
|
||||||
|
@ -90,12 +145,86 @@ stop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stop_hdr(void)
|
start_stop_hdr(int off)
|
||||||
{
|
{
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" ");
|
pr(" ");
|
||||||
pr("PRODUCTION STOPPAGE\n");
|
pr("PRODUCTION %s\n", off ? "STOPPAGE" : "STARTING");
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr(" sect eff\n");
|
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 "?";
|
||||||
|
}
|
||||||
|
|
|
@ -196,6 +196,7 @@ struct castr dchr_ca[] = {
|
||||||
{ NSC_TYPEID, 0, 0, fldoff(genitem, type), "type", ef_chr}, \
|
{ 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, effic), "effic", EF_BAD}, \
|
||||||
{ NSC_CHAR , 0, 0, fldoff(genitem, mobil), "mobil", 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_SHORT, 0, 0, fldoff(genitem, tech), "tech", EF_BAD}, \
|
||||||
{ NSC_STRINGY, NSC_EXTRA, 1, fldoff(genitem, group), "group", EF_BAD}, \
|
{ NSC_STRINGY, NSC_EXTRA, 1, fldoff(genitem, group), "group", EF_BAD}, \
|
||||||
{ NSC_XCOORD, 0, 0, fldoff(genitem, opx), "opx", EF_BAD}, \
|
{ NSC_XCOORD, 0, 0, fldoff(genitem, opx), "opx", EF_BAD}, \
|
||||||
|
|
|
@ -237,9 +237,9 @@ struct cmndstr player_coms[] = {
|
||||||
{"sorder <SHIPS>", 0, sorde, C_MOD, NORM + CAP},
|
{"sorder <SHIPS>", 0, sorde, C_MOD, NORM + CAP},
|
||||||
{"spy <SECTS>", 1, spy, C_MOD, NORM + CAP},
|
{"spy <SECTS>", 1, spy, C_MOD, NORM + CAP},
|
||||||
{"sstat <SHIPS>", 0, sstat, 0, NORM},
|
{"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},
|
{"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},
|
{"strength <SECTS>", 1, stre, C_MOD, NORM},
|
||||||
{"supply <LAND UNITS>", 1, supp, C_MOD, NORM + CAP},
|
{"supply <LAND UNITS>", 1, supp, C_MOD, NORM + CAP},
|
||||||
{"survey <SELECTOR> <SECTS>", 0, surv, 0, NORM + CAP},
|
{"survey <SELECTOR> <SECTS>", 0, surv, 0, NORM + CAP},
|
||||||
|
|
|
@ -132,8 +132,9 @@ upd_land(struct lndstr *lp, int etus,
|
||||||
|
|
||||||
lcp = &lchr[(int)lp->lnd_type];
|
lcp = &lchr[(int)lp->lnd_type];
|
||||||
if (build == 1) {
|
if (build == 1) {
|
||||||
if (np->nat_money >= 0)
|
if (!lp->lnd_off && np->nat_money >= 0)
|
||||||
landrepair(lp, np, bp, etus);
|
landrepair(lp, np, bp, etus);
|
||||||
|
lp->lnd_off = 0;
|
||||||
} else {
|
} else {
|
||||||
mult = 1;
|
mult = 1;
|
||||||
if (np->nat_level[NAT_TLEV] < lp->lnd_tech * 0.85)
|
if (np->nat_level[NAT_TLEV] < lp->lnd_tech * 0.85)
|
||||||
|
|
|
@ -102,8 +102,9 @@ upd_plane(struct plnstr *pp, int etus,
|
||||||
int mult, cost, eff;
|
int mult, cost, eff;
|
||||||
|
|
||||||
if (build == 1) {
|
if (build == 1) {
|
||||||
if (np->nat_money >= 0)
|
if (!pp->pln_off && np->nat_money >= 0)
|
||||||
planerepair(pp, np, bp, etus);
|
planerepair(pp, np, bp, etus);
|
||||||
|
pp->pln_off = 0;
|
||||||
} else {
|
} else {
|
||||||
mult = 1;
|
mult = 1;
|
||||||
if (np->nat_level[NAT_TLEV] < pp->pln_tech * 0.85)
|
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)
|
if (pp->pln_effic >= 80)
|
||||||
return;
|
return;
|
||||||
carrier = getshipp(pp->pln_ship);
|
carrier = getshipp(pp->pln_ship);
|
||||||
|
if (carrier->shp_off)
|
||||||
|
return;
|
||||||
if (CANT_HAPPEN(!carrier || carrier->shp_own != pp->pln_own))
|
if (CANT_HAPPEN(!carrier || carrier->shp_own != pp->pln_own))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,8 +136,9 @@ upd_ship(struct shpstr *sp, int etus,
|
||||||
|
|
||||||
mp = &mchr[(int)sp->shp_type];
|
mp = &mchr[(int)sp->shp_type];
|
||||||
if (build == 1) {
|
if (build == 1) {
|
||||||
if (np->nat_money >= 0)
|
if (!sp->shp_off && np->nat_money >= 0)
|
||||||
shiprepair(sp, np, bp, etus);
|
shiprepair(sp, np, bp, etus);
|
||||||
|
sp->shp_off = 0;
|
||||||
} else {
|
} else {
|
||||||
mult = 1;
|
mult = 1;
|
||||||
if (np->nat_level[NAT_TLEV] < sp->shp_tech * 0.85)
|
if (np->nat_level[NAT_TLEV] < sp->shp_tech * 0.85)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue