(show_sect_capab, V_ITEM): The difference between variable and

item types was removed some time ago.  Simplify.
(VT_ITEM, VT_TYPE, V_MAX): Unused, remove.

(show_sect_capab): Properly use ichr[] member i_mnem to print item
characters.
This commit is contained in:
Markus Armbruster 2004-08-17 16:07:01 +00:00
parent 4d154753b8
commit 09def8f156
3 changed files with 6 additions and 20 deletions

View file

@ -34,21 +34,13 @@
#ifndef _VAR_H_ #ifndef _VAR_H_
#define _VAR_H_ #define _VAR_H_
#define V_MAX 255
#define PLG_HEALTHY 0 #define PLG_HEALTHY 0
#define PLG_DYING 1 #define PLG_DYING 1
#define PLG_INFECT 2 #define PLG_INFECT 2
#define PLG_INCUBATE 3 #define PLG_INCUBATE 3
#define PLG_EXPOSED 4 #define PLG_EXPOSED 4
#define VT_ITEM 0 #define V_ITEM(x) (x)
#define VT_TYPE (7<<5)
#define isitem(x) (((x) & VT_TYPE) == VT_ITEM)
#define unitem(x) ((x) & (VT_ITEM -1))
#define V_ITEM(x) ((x)|VT_ITEM) /* a moveable, sellable(?) commodity */
#define I_NONE 0 #define I_NONE 0
#define I_CIVIL 1 #define I_CIVIL 1

View file

@ -685,8 +685,6 @@ show_sect_capab(int foo)
{ {
register int x, first = 1, i, j; register int x, first = 1, i, j;
char *tmpstr; char *tmpstr;
char c;
char *outputs = " cmsgpidbfolhur";
for (x = 0; x < SCT_MAXDEF + 2; x++) { for (x = 0; x < SCT_MAXDEF + 2; x++) {
if ((dchr[x].d_mnem == 0) || (dchr[x].d_prd == 0)) if ((dchr[x].d_mnem == 0) || (dchr[x].d_prd == 0))
@ -708,7 +706,7 @@ show_sect_capab(int foo)
&& pchr[j].p_ctype[i] > I_NONE && pchr[j].p_ctype[i] > I_NONE
&& pchr[j].p_ctype[i] <= I_MAX) { && pchr[j].p_ctype[i] <= I_MAX) {
pr("%2d %c ", pchr[j].p_camt[i], pr("%2d %c ", pchr[j].p_camt[i],
ichr[pchr[j].p_ctype[i] & (~VT_ITEM)].i_name[0]); ichr[pchr[j].p_ctype[i]].i_name[0]);
} else { } else {
pr(" "); pr(" ");
} }
@ -730,15 +728,12 @@ show_sect_capab(int foo)
tmpstr = " "; tmpstr = " ";
break; break;
} }
if (pchr[j].p_type)
c = outputs[pchr[j].p_type - VT_ITEM];
else
c = ' ';
pr("%-5s %3d %3d %4d %3d %3d %c", pr("%-5s %3d %3d %4d %3d %3d %c",
tmpstr, tmpstr,
pchr[j].p_nlmin, pchr[j].p_nlmin,
pchr[j].p_nllag, pchr[j].p_nllag,
pchr[j].p_effic, pchr[j].p_cost, pchr[j].p_nrdep, c); pchr[j].p_effic, pchr[j].p_cost, pchr[j].p_nrdep,
pchr[j].p_type ? ichr[pchr[j].p_type].i_mnem : ' ');
pr("\n"); pr("\n");
} }

View file

@ -73,8 +73,7 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
product = &pchr[dchr[desig].d_prd]; product = &pchr[dchr[desig].d_prd];
if (product == &pchr[0]) if (product == &pchr[0])
return 0; return 0;
vtype = product->p_type; item = product->p_type;
item = vtype & ~VT_ITEM;
*amount = 0; *amount = 0;
*cost = 0; *cost = 0;
@ -112,7 +111,7 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
* Adjust produced amount by commodity production ratio * Adjust produced amount by commodity production ratio
*/ */
output = material_consume * prodeff; output = material_consume * prodeff;
if ((vtype == 0) && (!player->simulation)) { if (item == I_NONE && !player->simulation) {
levels[sp->sct_own][product->p_level] += output; levels[sp->sct_own][product->p_level] += output;
wu((natid)0, sp->sct_own, "%s (%.2f) produced in %s\n", wu((natid)0, sp->sct_own, "%s (%.2f) produced in %s\n",
product->p_name, output, ownxy(sp)); product->p_name, output, ownxy(sp));