New show product

This is the human-readable buddy of xdump product, which dumps pchr[].
It duplicates much of the information in show sect c, but in more
accessible form.  It's in show_product().

Remove product information from info Quick-ref.  show reflects the
actual game, is more complete, and should be just as readable.
This commit is contained in:
Markus Armbruster 2008-07-27 18:02:06 -04:00
parent ae8c4620b0
commit 71bbd642df
7 changed files with 101 additions and 136 deletions

View file

@ -98,6 +98,10 @@ show(void)
cfunc = show_land_capab;
break;
case 'p':
if (p[1] == 'r') {
show_product(99999);
return RET_OK;
}
bfunc = show_plane_build;
sfunc = show_plane_stats;
cfunc = show_plane_capab;

View file

@ -230,7 +230,7 @@ struct cmndstr player_coms[] = {
{"ship <SHIPS>", 0, shi, 0, NORM},
{"shoot <c|u> <SECTS> <NUMBER>", 3, shoo, C_MOD, NORM + MONEY + CAP},
{"show <TYPE> <\"build\"|\"stats\"|\"cap\"> [<tech>]\n"
"\tshow <bridge|item|news|tower>\n"
"\tshow <bridge|item|news|product|tower>\n"
"\tshow updates [<NUM>]>",
0, show, 0, VIS},
{"shutdown <minutes> <disable update?>", 0, shut, 0, GOD},

View file

@ -597,6 +597,43 @@ show_item(int tlev)
}
}
void
show_product(int tlev)
{
struct pchrstr *pp;
int i;
char *lev;
pr("product cost raw materials reso dep level p.e.\n");
for (pp = pchr; pp->p_sname; pp++) {
pr("%7.7s %c $%-3d ",
pp->p_sname,
pp->p_type < 0 ? ' ' : ichr[pp->p_type].i_mnem,
pp->p_cost);
(void)CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */
for (i = 0; i < 3; i++) {
if (i < MAXPRCON && pp->p_camt[i]
&& pp->p_ctype[i] > I_NONE && pp->p_ctype[i] <= I_MAX)
pr(" %2d%c", pp->p_camt[i], ichr[pp->p_ctype[i]].i_mnem);
else
pr(" ");
}
if (pp->p_nrndx)
pr(" %5.5s %3d ",
symbol_by_value(pp->p_nrndx, resources), pp->p_nrdep);
else
pr(" ");
if (pp->p_nlndx < 0)
pr("1.0\n");
else {
lev = symbol_by_value(pp->p_nlndx, level);
pr("(%.4s%+d)/(%.4s%+d)\n",
lev, -pp->p_nlmin, lev, pp->p_nllag - pp->p_nlmin);
}
}
}
void
show_news(int tlev)
{