(nukstr): Make it a struct genitem: add members nuk_effic, nuk_mobil,

nuk_tech, nuk_stockpile, nuk_opx, nuk_opy, nuk_mission, nuk_radius.
These have no effect, yet.
(build_nuke): Initialize them.
(nuke_ca): Add genitem selectors: effic, mobil, tech, group, opx, opy,
mission, radius.
(tran_nuke): Zap mission, just in case somebody invents missions for
nukes.
(trade_desc): Show tech and efficiency, for consistency with other
units.
This commit is contained in:
Markus Armbruster 2006-05-06 07:37:00 +00:00
parent 2e40a4bb90
commit 802f69b039
5 changed files with 23 additions and 22 deletions

View file

@ -44,6 +44,13 @@ struct nukstr {
short nuk_uid; short nuk_uid;
coord nuk_x, nuk_y; /* current loc of device */ coord nuk_x, nuk_y; /* current loc of device */
signed char nuk_type; /* index in plchr[] */ signed char nuk_type; /* index in plchr[] */
signed char nuk_effic; /* unused, always 100% */
signed char nuk_mobil; /* unused, always 0 */
short nuk_tech; /* nuke's tech level */
char nuk_stockpile; /* group membership, unused, always ' ' */
coord nuk_opx, nuk_opy; /* Op sector coords, unused */
short nuk_mission; /* mission code, unused */
short nuk_radius; /* mission radius, unused */
/* end of part matching struct genitem */ /* end of part matching struct genitem */
short nuk_ship; /* currently aboard ship (unused) */ short nuk_ship; /* currently aboard ship (unused) */
short nuk_plane; /* currently aboard plane */ short nuk_plane; /* currently aboard plane */

View file

@ -54,18 +54,15 @@
#include "commands.h" #include "commands.h"
static int build_nuke(struct sctstr *sp, static int build_nuke(struct sctstr *sp,
struct nchrstr *np, short *vec); struct nchrstr *np, short *vec, int tlev);
static int build_ship(struct sctstr *sp, static int build_ship(struct sctstr *sp,
struct mchrstr *mp, short *vec, struct mchrstr *mp, short *vec, int tlev);
int tlev);
static int build_land(struct sctstr *sp, static int build_land(struct sctstr *sp,
struct lchrstr *lp, short *vec, struct lchrstr *lp, short *vec, int tlev);
int tlev);
static int build_bridge(struct sctstr *sp, short *vec); static int build_bridge(struct sctstr *sp, short *vec);
static int build_tower(struct sctstr *sp, short *vec); static int build_tower(struct sctstr *sp, short *vec);
static int build_plane(struct sctstr *sp, static int build_plane(struct sctstr *sp,
struct plchrstr *pp, short *vec, struct plchrstr *pp, short *vec, int tlev);
int tlev);
static int build_can_afford(double, char *); static int build_can_afford(double, char *);
/* /*
@ -267,7 +264,7 @@ buil(void)
built = build_tower(&sect, sect.sct_item); built = build_tower(&sect, sect.sct_item);
break; break;
case 'n': case 'n':
built = build_nuke(&sect, np, sect.sct_item); built = build_nuke(&sect, np, sect.sct_item, tlev);
break; break;
case 'p': case 'p':
built = build_plane(&sect, pp, sect.sct_item, tlev); built = build_plane(&sect, pp, sect.sct_item, tlev);
@ -289,8 +286,7 @@ buil(void)
} }
static int static int
build_ship(struct sctstr *sp, struct mchrstr *mp, build_ship(struct sctstr *sp, struct mchrstr *mp, short *vec, int tlev)
short *vec, int tlev)
{ {
struct shpstr ship; struct shpstr ship;
struct nstr_item nstr; struct nstr_item nstr;
@ -403,8 +399,7 @@ build_ship(struct sctstr *sp, struct mchrstr *mp,
} }
static int static int
build_land(struct sctstr *sp, struct lchrstr *lp, build_land(struct sctstr *sp, struct lchrstr *lp, short *vec, int tlev)
short *vec, int tlev)
{ {
struct lndstr land; struct lndstr land;
struct nstr_item nstr; struct nstr_item nstr;
@ -639,7 +634,7 @@ build_bridge(struct sctstr *sp, short *vec)
} }
static int static int
build_nuke(struct sctstr *sp, struct nchrstr *np, short *vec) build_nuke(struct sctstr *sp, struct nchrstr *np, short *vec, int tlev)
{ {
struct nukstr nuke; struct nukstr nuke;
struct nstr_item nstr; struct nstr_item nstr;
@ -699,8 +694,11 @@ build_nuke(struct sctstr *sp, struct nchrstr *np, short *vec)
nuke.nuk_y = sp->sct_y; nuke.nuk_y = sp->sct_y;
nuke.nuk_own = sp->sct_own; nuke.nuk_own = sp->sct_own;
nuke.nuk_type = np - nchr; nuke.nuk_type = np - nchr;
nuke.nuk_effic = 100;
nuke.nuk_stockpile = ' ';
nuke.nuk_ship = nuke.nuk_plane = nuke.nuk_land = -1; nuke.nuk_ship = nuke.nuk_plane = nuke.nuk_land = -1;
nuke.nuk_uid = nstr.cur; nuke.nuk_uid = nstr.cur;
nuke.nuk_tech = tlev;
vec[I_HCM] -= np->n_hcm; vec[I_HCM] -= np->n_hcm;
vec[I_LCM] -= np->n_lcm; vec[I_LCM] -= np->n_lcm;
@ -716,8 +714,7 @@ build_nuke(struct sctstr *sp, struct nchrstr *np, short *vec)
} }
static int static int
build_plane(struct sctstr *sp, struct plchrstr *pp, build_plane(struct sctstr *sp, struct plchrstr *pp, short *vec, int tlev)
short *vec, int tlev)
{ {
struct plnstr plane; struct plnstr plane;
struct nstr_item nstr; struct nstr_item nstr;

View file

@ -133,6 +133,7 @@ tran_nuke(void)
/* TODO apply dam */ /* TODO apply dam */
nuke.nuk_x = dstx; nuke.nuk_x = dstx;
nuke.nuk_y = dsty; nuke.nuk_y = dsty;
nuke.nuk_mission = 0;
putnuke(nuke.nuk_uid, &nuke); putnuke(nuke.nuk_uid, &nuke);
} }
if (mcost > 0) if (mcost > 0)

View file

@ -380,11 +380,7 @@ struct castr lchr_ca[] = {
}; };
struct castr nuke_ca[] = { struct castr nuke_ca[] = {
{NSC_SHORT, 0, 0, fldoff(nukstr, nuk_uid), "uid", EF_NUKE}, NSC_GENITEM(EF_NUKE, EF_NUKE_CHR),
{NSC_NATID, 0, 0, fldoff(nukstr, nuk_own), "owner", EF_NATION},
{NSC_XCOORD, 0, 0, fldoff(nukstr, nuk_x), "xloc", EF_BAD},
{NSC_YCOORD, 0, 0, fldoff(nukstr, nuk_y), "yloc", EF_BAD},
{NSC_TYPEID, 0, 0, fldoff(nukstr, nuk_type), "type", EF_NUKE_CHR},
{NSC_SHORT, 0, 0, fldoff(nukstr, nuk_plane), "plane", EF_BAD}, {NSC_SHORT, 0, 0, fldoff(nukstr, nuk_plane), "plane", EF_BAD},
{NSC_TIME, NSC_EXTRA, 0, fldoff(nukstr, nuk_timestamp), "timestamp", {NSC_TIME, NSC_EXTRA, 0, fldoff(nukstr, nuk_timestamp), "timestamp",
EF_BAD}, EF_BAD},

View file

@ -114,8 +114,8 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
case EF_NUKE: case EF_NUKE:
np = &tgp->nuk; np = &tgp->nuk;
tp->trd_owner = np->nuk_own; tp->trd_owner = np->nuk_own;
pr("(%3d) %s #%d", pr("(%3d) tech %d %d%% %s #%d",
tp->trd_owner, tp->trd_owner, np->nuk_tech, np->nuk_effic,
nchr[(int)np->nuk_type].n_name, tp->trd_unitid); nchr[(int)np->nuk_type].n_name, tp->trd_unitid);
break; break;
case EF_SHIP: case EF_SHIP: