(pchrstr, MAXPRCON): Simplify variable-style storage of constituents.
Store only up to MAXPRCON constituents, not MAXCHRNV; code doesn't fully support more than three anyway. Remove member p_nv, use item type I_NONE for unused slots. Rename members p_vtype, p_vamt to p_ctype, p_camt to avoid confusion with variable-style storage. (pchr): Initializers adapted. (nullify_objects, materials_cost, materials_charge, prod, show_sect_capab, grind): Adapt, simplify where possible, protect against bad item types in pchr[]. (MAXCHRNV): Unused, remove.
This commit is contained in:
parent
15d4f89951
commit
4d154753b8
8 changed files with 103 additions and 101 deletions
|
@ -701,12 +701,14 @@ show_sect_capab(int foo)
|
|||
|
||||
pr("%c %-23s %-7s ", dchr[x].d_mnem, dchr[x].d_name,
|
||||
pchr[j].p_sname);
|
||||
/*for(i=0;i<MAXCHRNV;i++) */
|
||||
/* XXX currently no more than 3 items actually used */
|
||||
CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */
|
||||
for (i = 0; i < 3; i++) {
|
||||
if ((i < pchr[j].p_nv) && (pchr[j].p_vamt[i] > 0)) {
|
||||
pr("%2d %c ", pchr[j].p_vamt[i],
|
||||
ichr[pchr[j].p_vtype[i] & (~VT_ITEM)].i_name[0]);
|
||||
if (i < MAXPRCON
|
||||
&& pchr[j].p_camt[i]
|
||||
&& pchr[j].p_ctype[i] > I_NONE
|
||||
&& pchr[j].p_ctype[i] <= I_MAX) {
|
||||
pr("%2d %c ", pchr[j].p_camt[i],
|
||||
ichr[pchr[j].p_ctype[i] & (~VT_ITEM)].i_name[0]);
|
||||
} else {
|
||||
pr(" ");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue