float nat_level[4]; /* technology, etc */
short nat_relate[MAXNOC];
unsigned char nat_contact[MAXNOC];
- short nat_rejects[(MAXNOC + 3) / 4]; /* four bits for each country */
+ unsigned char nat_rejects[MAXNOC];
signed char nat_priorities[PRI_MAX+1]; /* budget priority */
long nat_flags; /* nation flags */
char nat_spare[15];
natp->nat_level[NAT_RLEV] = start_research;
natp->nat_level[NAT_ELEV] = start_education;
natp->nat_level[NAT_HLEV] = start_happiness;
- for (i = 0; i < MAXNOC / 4; i++)
+ for (i = 0; i < MAXNOC; i++)
natp->nat_rejects[i] = 0;
natp->nat_newstim = 0;
natp->nat_annotim = 0;
int
getrejects(natid them, struct natstr *np)
{
- int ind;
- int shift;
- int reject;
-
- ind = them / 4;
- shift = 12 - ((them - ((them / 4) << 2)) * 4);
- reject = (np->nat_rejects[ind] >> shift) & 0x0f;
- return reject;
+ return np->nat_rejects[them];
}
void
void
putreject(struct natstr *np, natid them, int how, int what)
{
- int shift;
- int newrej;
- int ind;
-
- what &= 0x0f;
- ind = them / 4;
- shift = 12 - ((them - ((them / 4) << 2)) * 4);
- newrej = np->nat_rejects[ind];
if (how)
- newrej |= (what << shift);
+ np->nat_rejects[them] |= what;
else
- newrej &= ~(what << shift);
- np->nat_rejects[ind] = newrej;
+ np->nat_rejects[them] &= what;
}
void
/* should show mortals whether there's contact (obvious from relations?) */
{NSC_UCHAR, NSC_DEITY, MAXNOC, fldoff(natstr, nat_contact), "contacts",
EF_BAD},
- /* FIXME nat_rejects[], nat_priorities[] */
+ {NSC_UCHAR, 0, MAXNOC, fldoff(natstr, nat_rejects), "rejects",
+ EF_BAD},
+ /* FIXME nat_priorities[] */
{NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
EF_NATION_FLAGS},
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}