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

@ -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)
{