(I_NONE, I_CIVIL, I_MILIT, I_SHELL, I_GUN, I_PETROL, I_IRON, I_DUST,

I_BAR, I_FOOD, I_OIL, I_LCM, I_HCM, I_UW, I_RAD, I_MAX): Turn macros
into enumeration constants.
(i_type): New.  Use where appropriate.  No functional changes, except
that I_NONE is now catched properly in a few places.
This commit is contained in:
Marc Olzheim 2004-09-16 21:18:01 +00:00
parent 308430e751
commit d30942632b
38 changed files with 143 additions and 134 deletions

View file

@ -1264,7 +1264,7 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
struct lndstr land;
struct shpstr ship;
struct sctstr sect;
int itype;
i_type itype;
int rval;
short *item;

View file

@ -567,7 +567,7 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, s_char mission)
struct lndstr land;
struct shpstr ship;
struct sctstr sect;
int itype;
i_type itype;
int rval;
short *item;
int own;

View file

@ -419,8 +419,9 @@ show_ship_stats(int tlev)
void
show_ship_capab(int tlev)
{
register struct mchrstr *mp;
register int i;
struct mchrstr *mp;
i_type i;
int j;
int scount;
int n;
s_char *p;
@ -436,14 +437,14 @@ show_ship_capab(int tlev)
pr("%-25.25s ", mp->m_name);
for (i = 0; i <= I_MAX; ++i)
for (i = I_NONE + 1; i <= I_MAX; ++i)
if (mp->m_item[i])
pr(" %d%c", mp->m_item[i], ichr[i].i_mnem);
pr(" ");
for (i = n = 0; i < 32; i++) {
if (!(mp->m_flags & bit(i)))
for (j = n = 0; j < 32; j++) {
if (!(mp->m_flags & bit(j)))
continue;
if (NULL != (p = lookup(bit(i), ship_flags))) {
if (NULL != (p = lookup(bit(j), ship_flags))) {
if (n++ > 0)
pr(" ");
pr(p);
@ -546,8 +547,9 @@ show_land_capab(int tlev)
{
struct lchrstr *lcp;
int lcount;
register int i, n;
register s_char *p;
i_type i;
int j, n;
s_char *p;
pr("%25s capabilities\n", "");
@ -559,14 +561,14 @@ show_land_capab(int tlev)
pr("%-25s ", lcp->l_name);
for (i = 0; i <= I_MAX; ++i)
for (i = I_NONE + 1; i <= I_MAX; ++i)
if (lcp->l_item[i])
pr(" %d%c", lcp->l_item[i], ichr[i].i_mnem);
pr(" ");
for (i = n = 0; i < 32; i++) {
if (!(lcp->l_flags & bit(i)))
for (j = n = 0; j < 32; j++) {
if (!(lcp->l_flags & bit(j)))
continue;
if (NULL != (p = lookup(bit(i), land_flags))) {
if (NULL != (p = lookup(bit(j), land_flags))) {
if (n++ > 0)
pr(" ");
pr(p);

View file

@ -49,8 +49,8 @@
#include "player.h"
#include "prototypes.h"
static int get_minimum(struct lndstr *, int);
static int s_commod(int, int, int, int, int, int);
static int get_minimum(struct lndstr *, i_type);
static int s_commod(int, int, int, i_type, int, int);
/*
* We want to get enough guns to be maxed out, enough shells to
@ -84,7 +84,7 @@ resupply_all(struct lndstr *lp)
*/
void
resupply_commod(struct lndstr *lp, int type)
resupply_commod(struct lndstr *lp, i_type type)
{
int amt;
struct lchrstr *lcp;
@ -131,7 +131,7 @@ resupply_commod(struct lndstr *lp, int type)
* Actually get the commod
*/
int
supply_commod(int own, int x, int y, int type, int total_wanted)
supply_commod(int own, int x, int y, i_type type, int total_wanted)
{
if (total_wanted < 0)
return 0;
@ -142,7 +142,7 @@ supply_commod(int own, int x, int y, int type, int total_wanted)
* Just return the number you COULD get, without doing it
*/
int
try_supply_commod(int own, int x, int y, int type, int total_wanted)
try_supply_commod(int own, int x, int y, i_type type, int total_wanted)
{
if (total_wanted < 0)
return 0;
@ -152,7 +152,7 @@ try_supply_commod(int own, int x, int y, int type, int total_wanted)
/* Get supplies of a certain type */
static int
s_commod(int own, int x, int y, int type, int total_wanted,
s_commod(int own, int x, int y, i_type type, int total_wanted,
int actually_doit)
{
int wanted = total_wanted;
@ -433,7 +433,7 @@ s_commod(int own, int x, int y, int type, int total_wanted,
*/
static int
get_minimum(struct lndstr *lp, int type)
get_minimum(struct lndstr *lp, i_type type)
{
struct lchrstr *lcp;
int max, want = 0;

View file

@ -133,7 +133,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
pr("(%3d) tech %d %d%% %s [",
tp->trd_owner, sp->shp_tech, sp->shp_effic, prship(sp));
for (i = 1; i <= I_MAX; ++i) {
for (i = I_NONE + 1; i <= I_MAX; ++i) {
if (sp->shp_item[i])
pr("%c:%d ", ichr[i].i_mnem, sp->shp_item[i]);
}
@ -191,7 +191,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
pr("(%3d) tech %d %d%% %s [",
tp->trd_owner,
lp->lnd_tech, lp->lnd_effic, lchr[(int)lp->lnd_type].l_name);
for (i = 1; i <= I_MAX; ++i) {
for (i = I_NONE + 1; i <= I_MAX; ++i) {
if (lp->lnd_item[i])
pr("%c:%d ", ichr[i].i_mnem, lp->lnd_item[i]);
}
@ -252,7 +252,7 @@ get_couval(int cnum)
secttot += (long)(dchr[sp->sct_type].d_value *
((float)sp->sct_effic + 100.0));
for (k = 0; ichr[k].i_name; k++) {
if (ichr[k].i_value == 0 || ichr[k].i_vtype == 0)
if (ichr[k].i_value == 0 || ichr[k].i_vtype == I_NONE)
continue;
val = sp->sct_item[ichr[k].i_vtype];
secttot += val * ichr[k].i_value;