(getcontact, putcontact, nat_contact): Change nat_contact

to unsigned char to reduce the space required for natstr.
This commit is contained in:
Ron Koenderink 2005-11-18 23:40:30 +00:00
parent ac25058b50
commit 762d39d905
2 changed files with 6 additions and 5 deletions

View file

@ -86,7 +86,7 @@ struct natstr {
float nat_level[4]; /* technology, etc */ float nat_level[4]; /* technology, etc */
struct boundstr nat_b[MAXNOR]; /* realm bounds */ struct boundstr nat_b[MAXNOR]; /* realm bounds */
short nat_relate[MAXNOC]; short nat_relate[MAXNOC];
short nat_contact[MAXNOC]; unsigned char nat_contact[MAXNOC];
short nat_rejects[(MAXNOC + 3) / 4]; /* four bits for each country */ short nat_rejects[(MAXNOC + 3) / 4]; /* four bits for each country */
s_char nat_priorities[PRI_MAX+1]; /* budget priority */ s_char nat_priorities[PRI_MAX+1]; /* budget priority */
long nat_flags; /* nation flags */ long nat_flags; /* nation flags */
@ -167,10 +167,11 @@ extern s_char *rejectname(struct natstr *np, natid other);
extern s_char *natstate(struct natstr *np); extern s_char *natstate(struct natstr *np);
extern int getrel(struct natstr *np, natid them); extern int getrel(struct natstr *np, natid them);
extern int getrejects(natid them, struct natstr *np); extern int getrejects(natid them, struct natstr *np);
extern int getcontact(struct natstr *np, natid them); extern unsigned char getcontact(struct natstr *np, natid them);
extern void putrel(struct natstr *np, natid them, int relate); extern void putrel(struct natstr *np, natid them, int relate);
extern void putreject(struct natstr *np, natid them, int how, int what); extern void putreject(struct natstr *np, natid them, int how, int what);
extern void putcontact(struct natstr *np, natid them, int contact); extern void putcontact(struct natstr *np, natid them,
unsigned char contact);
extern void agecontact(struct natstr *np); extern void agecontact(struct natstr *np);
/* nation flags */ /* nation flags */

View file

@ -128,7 +128,7 @@ agecontact(struct natstr *np)
} }
} }
int unsigned char
getcontact(struct natstr *np, natid them) getcontact(struct natstr *np, natid them)
{ {
return np->nat_contact[them]; return np->nat_contact[them];
@ -159,7 +159,7 @@ putreject(struct natstr *np, natid them, int how, int what)
} }
void void
putcontact(struct natstr *np, natid them, int contact) putcontact(struct natstr *np, natid them, unsigned char contact)
{ {
if (np->nat_contact[them] < contact) if (np->nat_contact[them] < contact)
np->nat_contact[them] = contact; np->nat_contact[them] = contact;