Change nation status from bits to a simple enum:
(nat_status, STAT_UNUSED, STAT_VIS, STAT_ACTIVE): New. (STAT_NEW, STAT_SANCT, STAT_GOD): Change into nat_status members. (STAT_INUSE, STAT_NORM): Remove. (natstr): Use new nat_status for nat_stat. New value Old value STAT_UNUSED 0 STAT_NEW STAT_INUSE | STAT_NEW STAT_VIS STAT_INUSE STAT_SANCT STAT_INUSE | STAT_SANCT STAT_ACTIVE STAT_INUSE | STAT_NORM STAT_GOD STAT_INUSE | STAT_NORM | STAT_GOD Users changed.
This commit is contained in:
parent
41c2c27376
commit
8b16c31223
35 changed files with 113 additions and 151 deletions
|
@ -40,6 +40,20 @@
|
||||||
|
|
||||||
#define MAXNOR 50 /* max # realms */
|
#define MAXNOR 50 /* max # realms */
|
||||||
|
|
||||||
|
/* Nation status */
|
||||||
|
typedef enum {
|
||||||
|
/*
|
||||||
|
* Don't change order without checking inequality comparisons and
|
||||||
|
* array initializers!
|
||||||
|
*/
|
||||||
|
STAT_UNUSED, /* not in use */
|
||||||
|
STAT_NEW, /* just initialized */
|
||||||
|
STAT_VIS, /* visitor */
|
||||||
|
STAT_SANCT, /* still in sanctuary */
|
||||||
|
STAT_ACTIVE, /* active (sanctuary broken) */
|
||||||
|
STAT_GOD /* deity powers */
|
||||||
|
} nat_status;
|
||||||
|
|
||||||
enum { /* Priorities */
|
enum { /* Priorities */
|
||||||
/* sector types are also priorities */
|
/* sector types are also priorities */
|
||||||
PRI_SMAINT = SCT_MAXDEF+1, /* ship maintenance */
|
PRI_SMAINT = SCT_MAXDEF+1, /* ship maintenance */
|
||||||
|
@ -61,7 +75,7 @@ struct natstr {
|
||||||
short ef_type;
|
short ef_type;
|
||||||
natid nat_cnum; /* our country number */
|
natid nat_cnum; /* our country number */
|
||||||
/* end of part matching struct genitem */
|
/* end of part matching struct genitem */
|
||||||
s_char nat_stat; /* inuse, norm, god, abs */
|
nat_status nat_stat;
|
||||||
char nat_cnam[20]; /* country name */
|
char nat_cnam[20]; /* country name */
|
||||||
char nat_pnam[20]; /* representative */
|
char nat_pnam[20]; /* representative */
|
||||||
char nat_hostaddr[32]; /* host addr of last user */
|
char nat_hostaddr[32]; /* host addr of last user */
|
||||||
|
@ -92,21 +106,14 @@ struct natstr {
|
||||||
char nat_spare[15];
|
char nat_spare[15];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* nation status types */
|
|
||||||
#define STAT_INUSE bit(0) /* cnum in use */
|
|
||||||
#define STAT_SANCT bit(1) /* country in sanctuary */
|
|
||||||
#define STAT_NORM bit(2) /* normal country */
|
|
||||||
#define STAT_GOD bit(3) /* deity powers */
|
|
||||||
#define STAT_NEW bit(5) /* just initialized */
|
|
||||||
|
|
||||||
/* Update fields. */
|
/* Update fields. */
|
||||||
#define WUPD_WANT bit(0)
|
#define WUPD_WANT bit(0)
|
||||||
|
|
||||||
/* nstat values */
|
/* nstat values */
|
||||||
#define VIS STAT_INUSE
|
#define VIS bit(0)
|
||||||
#define NORM (STAT_INUSE|STAT_NORM)
|
#define SANCT (bit(1) | VIS)
|
||||||
#define GOD (STAT_INUSE|STAT_GOD)
|
#define NORM (bit(2) | VIS)
|
||||||
#define SANCT (STAT_INUSE|STAT_SANCT)
|
#define GOD (bit(3) | NORM | VIS)
|
||||||
#define CAP bit(6)
|
#define CAP bit(6)
|
||||||
#define MONEY bit(7)
|
#define MONEY bit(7)
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,7 @@ acce(void)
|
||||||
break;
|
break;
|
||||||
if (cn == as)
|
if (cn == as)
|
||||||
continue;
|
continue;
|
||||||
if ((np->nat_stat & STAT_NORM) == 0 &&
|
if (np->nat_stat < STAT_SANCT)
|
||||||
(np->nat_stat & STAT_SANCT) == 0)
|
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !getcontact(getnatp(player->cnum), cn))
|
if (!player->god && !getcontact(getnatp(player->cnum), cn))
|
||||||
|
|
|
@ -68,7 +68,7 @@ add(void)
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
|
|
||||||
for (freecn = 0; NULL != (natp = getnatp(freecn)); freecn++) {
|
for (freecn = 0; NULL != (natp = getnatp(freecn)); freecn++) {
|
||||||
if ((natp->nat_stat & STAT_INUSE) == 0)
|
if (natp->nat_stat == STAT_UNUSED)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (freecn < MAXNOC)
|
if (freecn < MAXNOC)
|
||||||
|
@ -111,19 +111,19 @@ add(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'v':
|
case 'v':
|
||||||
stat = STAT_INUSE;
|
stat = STAT_VIS;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
stat = STAT_NEW | STAT_INUSE;
|
stat = STAT_NEW;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
stat = STAT_NORM | STAT_INUSE;
|
stat = STAT_ACTIVE;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
stat = STAT_GOD | STAT_NORM | STAT_INUSE;
|
stat = STAT_GOD;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
stat = 0;
|
stat = STAT_UNUSED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr("Illegal status\n");
|
pr("Illegal status\n");
|
||||||
|
@ -189,8 +189,7 @@ add(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((natp->nat_stat & (STAT_INUSE | STAT_NORM | STAT_GOD)) ==
|
if (natp->nat_stat == STAT_NEW || natp->nat_stat == STAT_VIS) {
|
||||||
STAT_INUSE) {
|
|
||||||
*natp->nat_hostaddr = '\0';
|
*natp->nat_hostaddr = '\0';
|
||||||
*natp->nat_hostname = '\0';
|
*natp->nat_hostname = '\0';
|
||||||
*natp->nat_userid = '\0';
|
*natp->nat_userid = '\0';
|
||||||
|
|
|
@ -45,13 +45,12 @@ brea(void)
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
|
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
if ((natp->nat_stat & STAT_SANCT) == 0) {
|
if (natp->nat_stat != STAT_SANCT) {
|
||||||
pr("You aren't in sanctuary!\n");
|
pr("You aren't in sanctuary!\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
bsanct();
|
bsanct();
|
||||||
natp->nat_stat &= ~STAT_SANCT;
|
natp->nat_stat = STAT_ACTIVE;
|
||||||
natp->nat_stat |= STAT_NORM;
|
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
player->nstat |= NORM;
|
player->nstat |= NORM;
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
|
|
|
@ -99,7 +99,7 @@ cede(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
natp = getnatp(n);
|
natp = getnatp(n);
|
||||||
if (natp->nat_stat & STAT_GOD) {
|
if (natp->nat_stat == STAT_GOD) {
|
||||||
pr("You can only give to normal countries...\n");
|
pr("You can only give to normal countries...\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ chan(void)
|
||||||
buf)) == 0)
|
buf)) == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
us = getnatp(player->cnum);
|
us = getnatp(player->cnum);
|
||||||
if (us->nat_stat == VIS) {
|
if (us->nat_stat == STAT_VIS) {
|
||||||
pr("Visitor countries can't change their country name or representative.\n");
|
pr("Visitor countries can't change their country name or representative.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ chan(void)
|
||||||
case 'c':
|
case 'c':
|
||||||
charge = 0;
|
charge = 0;
|
||||||
btucost = 0;
|
btucost = 0;
|
||||||
if (!player->god && (us->nat_stat & STAT_NORM)) {
|
if (us->nat_stat == STAT_ACTIVE) {
|
||||||
if (opt_BLITZ == 0) {
|
if (opt_BLITZ == 0) {
|
||||||
if (us->nat_btu < 254) {
|
if (us->nat_btu < 254) {
|
||||||
pr("You need 254 btus to change your country name!\n");
|
pr("You need 254 btus to change your country name!\n");
|
||||||
|
|
|
@ -59,7 +59,7 @@ coun(void)
|
||||||
pr(" # last access %sstatus country name\n",
|
pr(" # last access %sstatus country name\n",
|
||||||
player->god ? "BTU " : "");
|
player->god ? "BTU " : "");
|
||||||
while (nxtitem(&ni, &nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if ((nat.nat_stat & STAT_INUSE) == 0)
|
if (nat.nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
coun_list(&nat);
|
coun_list(&nat);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ coun_list(struct natstr *natp)
|
||||||
|
|
||||||
if (getplayer(cn)
|
if (getplayer(cn)
|
||||||
&& (player->god
|
&& (player->god
|
||||||
|| (natp->nat_stat & STAT_GOD)
|
|| natp->nat_stat == STAT_GOD
|
||||||
|| cn == player->cnum || getrel(natp, player->cnum) == ALLIED))
|
|| cn == player->cnum || getrel(natp, player->cnum) == ALLIED))
|
||||||
pr(" Now logged on ");
|
pr(" Now logged on ");
|
||||||
else if (player->god) {
|
else if (player->god) {
|
||||||
|
@ -94,13 +94,13 @@ coun_list(struct natstr *natp)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" %4d", natp->nat_btu);
|
pr(" %4d", natp->nat_btu);
|
||||||
|
|
||||||
if (natp->nat_stat & STAT_GOD)
|
if (natp->nat_stat == STAT_GOD)
|
||||||
status = "DEITY";
|
status = "DEITY";
|
||||||
else if (natp->nat_stat & STAT_NEW)
|
else if (natp->nat_stat == STAT_NEW)
|
||||||
status = "New";
|
status = "New";
|
||||||
else if (natp->nat_stat & STAT_SANCT)
|
else if (natp->nat_stat == STAT_SANCT)
|
||||||
status = "Sanctuary";
|
status = "Sanctuary";
|
||||||
else if (natp->nat_stat & STAT_NORM) {
|
else if (natp->nat_stat == STAT_ACTIVE) {
|
||||||
status = "Active";
|
status = "Active";
|
||||||
if (!opt_HIDDEN || player->god) {
|
if (!opt_HIDDEN || player->god) {
|
||||||
if (influx(natp))
|
if (influx(natp))
|
||||||
|
|
|
@ -102,7 +102,7 @@ decl(void)
|
||||||
|
|
||||||
natp = getnatp(who);
|
natp = getnatp(who);
|
||||||
while (nxtitem(&ni, &nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if (!(nat.nat_stat & STAT_INUSE))
|
if (nat.nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (player->cnum == (natid)ni.cur)
|
if (player->cnum == (natid)ni.cur)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -748,7 +748,7 @@ docountry(s_char op, int arg, s_char *p, float farg, natid nat,
|
||||||
np->nat_yorg = newy;
|
np->nat_yorg = newy;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
np->nat_stat = (s_char)errcheck(arg, 0, STAT_NEW);
|
np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
arg = errcheck(arg, 0, m_m_p_d);
|
arg = errcheck(arg, 0, m_m_p_d);
|
||||||
|
|
|
@ -58,18 +58,17 @@ flash(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (us->nat_stat & STAT_GOD) {
|
if (us->nat_stat == STAT_GOD) {
|
||||||
/* We are gods, we can flash anyone */
|
/* We are gods, we can flash anyone */
|
||||||
} else if (us->nat_stat == VIS) {
|
} else if (us->nat_stat == STAT_VIS) {
|
||||||
/* We are a visitor. We can only flash the gods. :) */
|
/* We are a visitor. We can only flash the gods. :) */
|
||||||
if (!(to->nat_stat & STAT_GOD)) {
|
if (to->nat_stat != STAT_GOD) {
|
||||||
pr("Visitors can only flash the gods.\n");
|
pr("Visitors can only flash the gods.\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Ok, we are a normal country, can we flash them? */
|
/* Ok, we are a normal country, can we flash them? */
|
||||||
if ((!(to->nat_stat & STAT_GOD)) &&
|
if (to->nat_stat != STAT_GOD && getrel(to, player->cnum) < FRIENDLY) {
|
||||||
(getrel(to, player->cnum) < FRIENDLY)) {
|
|
||||||
pr("%s is not a deity or friendly with us.\n", to->nat_cnam);
|
pr("%s is not a deity or friendly with us.\n", to->nat_cnam);
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ nati(void)
|
||||||
prdate();
|
prdate();
|
||||||
pr("Nation status is %s", natstate(natp));
|
pr("Nation status is %s", natstate(natp));
|
||||||
pr(" Bureaucratic Time Units: %d\n", natp->nat_btu);
|
pr(" Bureaucratic Time Units: %d\n", natp->nat_btu);
|
||||||
if (natp->nat_stat & STAT_INUSE) {
|
if (natp->nat_stat != STAT_UNUSED) {
|
||||||
getsect(natp->nat_xcap, natp->nat_ycap, §);
|
getsect(natp->nat_xcap, natp->nat_ycap, §);
|
||||||
if (influx(natp))
|
if (influx(natp))
|
||||||
pr("No capital (was at %s).\n",
|
pr("No capital (was at %s).\n",
|
||||||
|
|
|
@ -80,7 +80,7 @@ new(void)
|
||||||
}
|
}
|
||||||
num = n;
|
num = n;
|
||||||
natp = getnatp(num);
|
natp = getnatp(num);
|
||||||
if ((natp->nat_stat & STAT_NEW) == 0) {
|
if (natp->nat_stat != STAT_NEW) {
|
||||||
pr("Country #%d (%s) isn't a new country!\n", num, cname(num));
|
pr("Country #%d (%s) isn't a new country!\n", num, cname(num));
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
|
@ -180,8 +180,7 @@ new(void)
|
||||||
sect.sct_item[I_UW] = 75;
|
sect.sct_item[I_UW] = 75;
|
||||||
putsect(§);
|
putsect(§);
|
||||||
natp->nat_btu = max_btus;
|
natp->nat_btu = max_btus;
|
||||||
natp->nat_stat &= ~STAT_NEW;
|
natp->nat_stat = STAT_SANCT;
|
||||||
natp->nat_stat |= STAT_SANCT;
|
|
||||||
natp->nat_xcap = x;
|
natp->nat_xcap = x;
|
||||||
natp->nat_ycap = y;
|
natp->nat_ycap = y;
|
||||||
natp->nat_xorg = x;
|
natp->nat_xorg = x;
|
||||||
|
|
|
@ -87,12 +87,12 @@ play_list(struct player *joe)
|
||||||
/* It's a blitz, we see everything */
|
/* It's a blitz, we see everything */
|
||||||
} else if (joe->god) {
|
} else if (joe->god) {
|
||||||
/* This country is a god, so we see it */
|
/* This country is a god, so we see it */
|
||||||
} else if (us->nat_stat == VIS) {
|
} else if (us->nat_stat == STAT_VIS) {
|
||||||
/* We are a visitor country, we can't see squat, except deities */
|
/* We are a visitor country, we can't see squat, except deities */
|
||||||
return 0;
|
return 0;
|
||||||
} else if (joe->cnum != player->cnum) {
|
} else if (joe->cnum != player->cnum) {
|
||||||
/* This isn't us. Can we see it? */
|
/* This isn't us. Can we see it? */
|
||||||
if (natp->nat_stat == VIS) {
|
if (natp->nat_stat == STAT_VIS) {
|
||||||
/* Yes, we can see visitors are logged on */
|
/* Yes, we can see visitors are logged on */
|
||||||
} else if (getrel(natp, player->cnum) < ALLIED) {
|
} else if (getrel(natp, player->cnum) < ALLIED) {
|
||||||
/* This is a non-allied country, don't show it. */
|
/* This is a non-allied country, don't show it. */
|
||||||
|
|
|
@ -144,7 +144,7 @@ powe(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
natp2 = getnatp(pow.p_nation);
|
natp2 = getnatp(pow.p_nation);
|
||||||
if (natp2->nat_stat & STAT_GOD)
|
if (natp2->nat_stat == STAT_GOD)
|
||||||
continue;
|
continue;
|
||||||
if (use_targets && !targets[pow.p_nation])
|
if (use_targets && !targets[pow.p_nation])
|
||||||
continue;
|
continue;
|
||||||
|
@ -288,12 +288,7 @@ gen_power(void)
|
||||||
for (i = 1; NULL != (natp = getnatp(i)); i++) {
|
for (i = 1; NULL != (natp = getnatp(i)); i++) {
|
||||||
pow = &powbuf[i];
|
pow = &powbuf[i];
|
||||||
pow->p_nation = i;
|
pow->p_nation = i;
|
||||||
if ((natp->nat_stat & STAT_INUSE) == 0 ||
|
if (natp->nat_stat != STAT_ACTIVE) {
|
||||||
(natp->nat_stat & STAT_NORM) == 0) {
|
|
||||||
pow->p_power = 0.;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (natp->nat_stat & STAT_GOD) {
|
|
||||||
pow->p_power = 0.;
|
pow->p_power = 0.;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -397,11 +392,11 @@ set_target(s_char *p, int *targets)
|
||||||
target = cnumb(p);
|
target = cnumb(p);
|
||||||
|
|
||||||
if (target > 0 && target < MAXNOC && (natp = getnatp(target))) {
|
if (target > 0 && target < MAXNOC && (natp = getnatp(target))) {
|
||||||
if (natp->nat_stat & STAT_GOD) {
|
if (natp->nat_stat == STAT_GOD) {
|
||||||
pr("Country #%d is a deity country\n", target);
|
pr("Country #%d is a deity country\n", target);
|
||||||
} else if (!(natp->nat_stat & STAT_INUSE)) {
|
} else if (natp->nat_stat == STAT_UNUSED) {
|
||||||
pr("Country #%d is not in use\n", target);
|
pr("Country #%d is not in use\n", target);
|
||||||
} else if (!(natp->nat_stat & STAT_NORM)) {
|
} else if (natp->nat_stat != STAT_ACTIVE) {
|
||||||
pr("Country #%d is not a normal country\n", target);
|
pr("Country #%d is not a normal country\n", target);
|
||||||
} else {
|
} else {
|
||||||
targets[target] = 1;
|
targets[target] = 1;
|
||||||
|
|
|
@ -89,13 +89,7 @@ reje(void)
|
||||||
if (!snxtitem(&ni, EF_NATION, player->argp[3]))
|
if (!snxtitem(&ni, EF_NATION, player->argp[3]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&ni, &nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
#if 0
|
if (nat.nat_stat == STAT_GOD) {
|
||||||
if ((nat.nat_stat & STAT_NORM) == 0) {
|
|
||||||
pr("You may not reject/accept stuff from %s\nbecause they are not a normal country.\n", nat.nat_cnam);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (nat.nat_stat & STAT_GOD) {
|
|
||||||
pr("You may not reject/accept stuff from %s\nbecause they are a deity.\n", nat.nat_cnam);
|
pr("You may not reject/accept stuff from %s\nbecause they are a deity.\n", nat.nat_cnam);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,7 @@ rela(void)
|
||||||
break;
|
break;
|
||||||
if (cn == as)
|
if (cn == as)
|
||||||
continue;
|
continue;
|
||||||
if ((np->nat_stat & STAT_NORM) == 0 &&
|
if (np->nat_stat < STAT_SANCT)
|
||||||
(np->nat_stat & STAT_SANCT) == 0)
|
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !getcontact(natp, cn))
|
if (!player->god && !getcontact(natp, cn))
|
||||||
|
|
|
@ -78,7 +78,7 @@ repo(void)
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
memset(&mystat, 0, sizeof(struct stats));
|
memset(&mystat, 0, sizeof(struct stats));
|
||||||
mystat.stat = natp->nat_stat;
|
mystat.stat = natp->nat_stat;
|
||||||
if (mystat.stat & STAT_NORM) {
|
if (mystat.stat >= STAT_ACTIVE) {
|
||||||
mystat.res = natp->nat_level[NAT_RLEV];
|
mystat.res = natp->nat_level[NAT_RLEV];
|
||||||
mystat.tech = natp->nat_level[NAT_TLEV];
|
mystat.tech = natp->nat_level[NAT_TLEV];
|
||||||
mystat.edu = natp->nat_level[NAT_ELEV];
|
mystat.edu = natp->nat_level[NAT_ELEV];
|
||||||
|
@ -91,7 +91,7 @@ repo(void)
|
||||||
first = 1;
|
first = 1;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, &nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if (!(nat.nat_stat & STAT_INUSE))
|
if (nat.nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !getcontact(getnatp(player->cnum), ni.cur))
|
if (!player->god && !getcontact(getnatp(player->cnum), ni.cur))
|
||||||
|
@ -132,8 +132,7 @@ repo_list(struct stats *stat, natid cn, struct natstr *natp)
|
||||||
prxy(" %4d,%-4d\n", natp->nat_xcap, natp->nat_ycap, player->cnum);
|
prxy(" %4d,%-4d\n", natp->nat_xcap, natp->nat_ycap, player->cnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (natp->nat_stat & (STAT_NORM | STAT_GOD | STAT_NEW | STAT_SANCT)) {
|
if (natp->nat_stat == STAT_ACTIVE) {
|
||||||
case STAT_NORM:
|
|
||||||
pr(" %-3d %-14.14s ", cn, natp->nat_cnam);
|
pr(" %-3d %-14.14s ", cn, natp->nat_cnam);
|
||||||
printdiff(stat->stat, stat->tech, natp, NAT_TLEV);
|
printdiff(stat->stat, stat->tech, natp, NAT_TLEV);
|
||||||
printdiff(stat->stat, stat->res, natp, NAT_RLEV);
|
printdiff(stat->stat, stat->res, natp, NAT_RLEV);
|
||||||
|
@ -149,19 +148,6 @@ repo_list(struct stats *stat, natid cn, struct natstr *natp)
|
||||||
else
|
else
|
||||||
pr("Active\n");
|
pr("Active\n");
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case STAT_SANCT:
|
|
||||||
break;
|
|
||||||
case STAT_NEW:
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case STAT_SANCT | STAT_NORM | STAT_GOD:
|
|
||||||
case STAT_NORM | STAT_GOD:
|
|
||||||
case STAT_GOD:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pr("???? ???? ???? ????\n");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +163,7 @@ printdiff(int mystat, double ours, struct natstr *natp, int what)
|
||||||
pr(" %7.2f ", ours);
|
pr(" %7.2f ", ours);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ours && mystat & STAT_NORM && natp->nat_stat & STAT_NORM) {
|
if (ours && mystat >= STAT_ACTIVE && natp->nat_stat >= STAT_ACTIVE) {
|
||||||
theirs = natp->nat_level[what];
|
theirs = natp->nat_level[what];
|
||||||
if ((shift = min((int)theirs, (int)ours) - 100) > 0) {
|
if ((shift = min((int)theirs, (int)ours) - 100) > 0) {
|
||||||
ours -= shift;
|
ours -= shift;
|
||||||
|
|
|
@ -103,8 +103,7 @@ tele(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
natp = getnatp(to);
|
natp = getnatp(to);
|
||||||
if (((natp->nat_stat & STAT_NORM) == 0) &&
|
if (natp->nat_stat < STAT_SANCT) {
|
||||||
((natp->nat_stat & STAT_SANCT) == 0)) {
|
|
||||||
pr("%s has no \"telegram priveleges\".\n", cname(to));
|
pr("%s has no \"telegram priveleges\".\n", cname(to));
|
||||||
kk++;
|
kk++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -119,8 +118,8 @@ tele(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->god &&
|
if (!player->god && natp->nat_stat != STAT_GOD
|
||||||
(natp->nat_stat & GOD) != GOD && player->cnum != to)
|
&& player->cnum != to)
|
||||||
nreport(player->cnum, N_SENT_TEL, to, 1);
|
nreport(player->cnum, N_SENT_TEL, to, 1);
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
setcont(to, player->cnum, FOUND_TELE);
|
setcont(to, player->cnum, FOUND_TELE);
|
||||||
|
|
|
@ -204,7 +204,7 @@ xdvisible(int type, void *p)
|
||||||
case EF_LOST:
|
case EF_LOST:
|
||||||
return gp->own != 0 && (gp->own == player->cnum || player->god);
|
return gp->own != 0 && (gp->own == player->cnum || player->god);
|
||||||
case EF_NATION:
|
case EF_NATION:
|
||||||
return ((struct natstr *)p)->nat_stat != 0
|
return ((struct natstr *)p)->nat_stat != STAT_UNUSED
|
||||||
&& (gp->own == player->cnum || player->god);
|
&& (gp->own == player->cnum || player->god);
|
||||||
case EF_NEWS:
|
case EF_NEWS:
|
||||||
return ((struct nwsstr *)p)->nws_vrb != 0
|
return ((struct nwsstr *)p)->nws_vrb != 0
|
||||||
|
|
|
@ -90,15 +90,11 @@ rejectname(struct natstr *np, natid other)
|
||||||
char *
|
char *
|
||||||
natstate(struct natstr *np)
|
natstate(struct natstr *np)
|
||||||
{
|
{
|
||||||
if ((np->nat_stat & STAT_INUSE) == 0)
|
static char *stnam[] = {
|
||||||
return "FREE";
|
/* must match nat_status */
|
||||||
if (np->nat_stat & STAT_GOD)
|
"FREE", "VISITOR", "VISITOR", "SANCTUARY", "ACTIVE", "DEITY"
|
||||||
return "DEITY";
|
};
|
||||||
if (np->nat_stat & STAT_SANCT)
|
return stnam[np->nat_stat];
|
||||||
return "SANCTUARY";
|
|
||||||
if ((np->nat_stat & STAT_NORM) == 0)
|
|
||||||
return "VISITOR";
|
|
||||||
return "ACTIVE";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This returns the relations that np has with them */
|
/* This returns the relations that np has with them */
|
||||||
|
|
|
@ -129,8 +129,7 @@ demand_update_want(int *want, int *pop, int which)
|
||||||
for (cn = 1; 0 != (natp = getnatp(cn)); cn++) {
|
for (cn = 1; 0 != (natp = getnatp(cn)); cn++) {
|
||||||
/* Only countries which are normal. */
|
/* Only countries which are normal. */
|
||||||
/* Should probably include sanctuaries ..... */
|
/* Should probably include sanctuaries ..... */
|
||||||
if (((natp->nat_stat & NORM) == NORM) &&
|
if (natp->nat_stat == STAT_ACTIVE) {
|
||||||
((natp->nat_stat & GOD) != GOD)) {
|
|
||||||
totpop++;
|
totpop++;
|
||||||
if ((natp->nat_update & WUPD_WANT) == WUPD_WANT) {
|
if ((natp->nat_update & WUPD_WANT) == WUPD_WANT) {
|
||||||
totwant++;
|
totwant++;
|
||||||
|
@ -175,8 +174,7 @@ demand_check(void)
|
||||||
|
|
||||||
veto = 0;
|
veto = 0;
|
||||||
for (cn = 1; 0 != (natp = getnatp(cn)); cn++) {
|
for (cn = 1; 0 != (natp = getnatp(cn)); cn++) {
|
||||||
if (((natp->nat_stat & NORM) == NORM) &&
|
if (natp->nat_stat == STAT_ACTIVE) {
|
||||||
((natp->nat_stat & GOD) != GOD)) {
|
|
||||||
if (natp->nat_missed >= update_missed)
|
if (natp->nat_missed >= update_missed)
|
||||||
veto = cn;
|
veto = cn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,7 +485,8 @@ struct castr trade_ca[] = {
|
||||||
|
|
||||||
struct castr nat_ca[] = {
|
struct castr nat_ca[] = {
|
||||||
{NSC_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
|
{NSC_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
|
||||||
{NSC_CHAR, NSC_BITS, 0, fldoff(natstr, nat_stat), "stat", EF_BAD /* FIXME */},
|
{NSC_CHAR, NSC_SITYPE(nat_status), 0, fldoff(natstr, nat_stat), "stat",
|
||||||
|
EF_BAD /* FIXME */},
|
||||||
{NSC_STRINGY, 0, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
|
{NSC_STRINGY, 0, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
|
||||||
{NSC_STRINGY, NSC_DEITY, 20, fldoff(natstr, nat_pnam), "passwd", EF_BAD},
|
{NSC_STRINGY, NSC_DEITY, 20, fldoff(natstr, nat_pnam), "passwd", EF_BAD},
|
||||||
{NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", EF_BAD},
|
{NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", EF_BAD},
|
||||||
|
|
|
@ -49,12 +49,16 @@ static int nat_cap(int);
|
||||||
int
|
int
|
||||||
init_nats(void)
|
init_nats(void)
|
||||||
{
|
{
|
||||||
|
static int nstat[] = {
|
||||||
|
/* must match nat_status */
|
||||||
|
0, VIS, VIS, SANCT, NORM, GOD
|
||||||
|
};
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
if ((np = getnatp(player->cnum)) == 0)
|
if ((np = getnatp(player->cnum)) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
player->nstat = np->nat_stat;
|
player->nstat = nstat[np->nat_stat];
|
||||||
player->god = np->nat_stat & STAT_GOD;
|
player->god = np->nat_stat == STAT_GOD;
|
||||||
player->map = ef_ptr(EF_MAP, player->cnum);
|
player->map = ef_ptr(EF_MAP, player->cnum);
|
||||||
player->bmap = ef_ptr(EF_BMAP, player->cnum);
|
player->bmap = ef_ptr(EF_BMAP, player->cnum);
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
|
@ -86,7 +90,7 @@ nat_cap(int btu)
|
||||||
np->nat_cnam, np->nat_xcap, np->nat_ycap);
|
np->nat_cnam, np->nat_xcap, np->nat_ycap);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((player->nstat & NORM) == NORM) {
|
if (np->nat_stat >= STAT_ACTIVE) {
|
||||||
if (influx(np))
|
if (influx(np))
|
||||||
player->nstat &= ~CAP;
|
player->nstat &= ~CAP;
|
||||||
else
|
else
|
||||||
|
@ -110,7 +114,7 @@ nat_cap(int btu)
|
||||||
else
|
else
|
||||||
np->nat_btu += delta;
|
np->nat_btu += delta;
|
||||||
}
|
}
|
||||||
if (np->nat_stat == VIS)
|
if (np->nat_stat == STAT_VIS)
|
||||||
np->nat_btu = max_btus;
|
np->nat_btu = max_btus;
|
||||||
putnat(np);
|
putnat(np);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -152,7 +152,7 @@ sanc_cmd(void)
|
||||||
|
|
||||||
snxtitem_all(&ni, EF_NATION);
|
snxtitem_all(&ni, EF_NATION);
|
||||||
while (nxtitem(&ni, &nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if (nat.nat_stat != (STAT_INUSE | STAT_SANCT))
|
if (nat.nat_stat != STAT_SANCT)
|
||||||
continue;
|
continue;
|
||||||
if (first) {
|
if (first) {
|
||||||
pr_id(player, C_DATA,
|
pr_id(player, C_DATA,
|
||||||
|
@ -293,7 +293,7 @@ play_cmd(void)
|
||||||
other = getplayer((natid)player->cnum);
|
other = getplayer((natid)player->cnum);
|
||||||
if (other) {
|
if (other) {
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
if (natp->nat_stat != VIS) {
|
if (natp->nat_stat != STAT_VIS) {
|
||||||
pr_id(player, C_EXIT, "country in use by %s\n", praddr(other));
|
pr_id(player, C_EXIT, "country in use by %s\n", praddr(other));
|
||||||
} else {
|
} else {
|
||||||
pr_id(player, C_EXIT, "country in use\n");
|
pr_id(player, C_EXIT, "country in use\n");
|
||||||
|
@ -331,7 +331,7 @@ kill_cmd(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
np = getnatp(player->cnum);
|
np = getnatp(player->cnum);
|
||||||
if (np->nat_stat & STAT_GOD && !match_user(authfil, player)) {
|
if (np->nat_stat == STAT_GOD && !match_user(authfil, player)) {
|
||||||
logerror("NON-AUTHed Login attempted by %s", praddr(player));
|
logerror("NON-AUTHed Login attempted by %s", praddr(player));
|
||||||
pr_id(player, C_EXIT, "You're not a deity!\n");
|
pr_id(player, C_EXIT, "You're not a deity!\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -47,8 +47,7 @@ natbyname(s_char *name, natid *result)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
||||||
if ((np->nat_stat & STAT_INUSE) &&
|
if (np->nat_stat != STAT_UNUSED && !strcmp(np->nat_cnam, name)) {
|
||||||
(strcmp(np->nat_cnam, name) == 0)) {
|
|
||||||
*result = i;
|
*result = i;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +62,7 @@ natpass(int cn, s_char *pass)
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
np = getnatp((natid)cn);
|
np = getnatp((natid)cn);
|
||||||
if (np->nat_stat == VIS)
|
if (np->nat_stat == STAT_VIS)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(np->nat_pnam, pass) == 0)
|
if (strcmp(np->nat_pnam, pass) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -86,7 +86,7 @@ player_main(struct player *p)
|
||||||
}
|
}
|
||||||
if (!gamehours(player->curup)) {
|
if (!gamehours(player->curup)) {
|
||||||
pr("Empire hours restriction in force\n");
|
pr("Empire hours restriction in force\n");
|
||||||
if ((natp->nat_stat & STAT_GOD) == 0)
|
if (natp->nat_stat != STAT_GOD)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
daychange(player->curup);
|
daychange(player->curup);
|
||||||
|
@ -94,7 +94,7 @@ player_main(struct player *p)
|
||||||
pr("Time exceeded today\n");
|
pr("Time exceeded today\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (natp->nat_stat != VIS
|
if (natp->nat_stat != STAT_VIS
|
||||||
&& natp->nat_last_login
|
&& natp->nat_last_login
|
||||||
&& (strcmp(natp->nat_hostaddr, player->hostaddr)
|
&& (strcmp(natp->nat_hostaddr, player->hostaddr)
|
||||||
|| strcmp(natp->nat_userid, player->userid))) {
|
|| strcmp(natp->nat_userid, player->userid))) {
|
||||||
|
@ -186,7 +186,7 @@ status(void)
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
player->visitor = (natp->nat_stat & (STAT_NORM | STAT_GOD)) == 0;
|
player->visitor = natp->nat_stat < STAT_SANCT;
|
||||||
if (player->dolcost != 0.0) {
|
if (player->dolcost != 0.0) {
|
||||||
if (player->dolcost > 100.0)
|
if (player->dolcost > 100.0)
|
||||||
pr("That just cost you $%.2f\n", player->dolcost);
|
pr("That just cost you $%.2f\n", player->dolcost);
|
||||||
|
@ -233,7 +233,7 @@ status(void)
|
||||||
daychange(player->curup);
|
daychange(player->curup);
|
||||||
if (!gamehours(player->curup)) {
|
if (!gamehours(player->curup)) {
|
||||||
pr("Empire hours restriction in force\n");
|
pr("Empire hours restriction in force\n");
|
||||||
if ((natp->nat_stat & STAT_GOD) == 0) {
|
if (natp->nat_stat != STAT_GOD) {
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -243,8 +243,7 @@ status(void)
|
||||||
player->lasttime += minute * 60;
|
player->lasttime += minute * 60;
|
||||||
natp->nat_minused += minute;
|
natp->nat_minused += minute;
|
||||||
}
|
}
|
||||||
if ((player->nstat & STAT_NORM) && !player->god
|
if (natp->nat_stat == STAT_ACTIVE && natp->nat_minused > m_m_p_d) {
|
||||||
&& natp->nat_minused > m_m_p_d) {
|
|
||||||
pr("Max minutes per day limit exceeded.\n");
|
pr("Max minutes per day limit exceeded.\n");
|
||||||
player->ncomstat = VIS;
|
player->ncomstat = VIS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ natarg(s_char *arg, s_char *prompt)
|
||||||
if (!player->god && !getcontact(getnatp(player->cnum), n)) {
|
if (!player->god && !getcontact(getnatp(player->cnum), n)) {
|
||||||
if ((np = getnatp(n)) == 0)
|
if ((np = getnatp(n)) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
if ((np->nat_stat & STAT_GOD) == 0) {
|
if (np->nat_stat != STAT_GOD) {
|
||||||
if (byname) {
|
if (byname) {
|
||||||
pr("No such country exists.\n");
|
pr("No such country exists.\n");
|
||||||
n = -1;
|
n = -1;
|
||||||
|
|
|
@ -102,7 +102,7 @@ wu(natid from, natid to, char *format, ...)
|
||||||
np = getnatp(from);
|
np = getnatp(from);
|
||||||
if (update_pending)
|
if (update_pending)
|
||||||
return typed_wu(from, to, buf, TEL_UPDATE);
|
return typed_wu(from, to, buf, TEL_UPDATE);
|
||||||
else if (np->nat_stat & STAT_GOD)
|
else if (np->nat_stat == STAT_GOD)
|
||||||
return typed_wu(from, to, buf, TEL_BULLETIN);
|
return typed_wu(from, to, buf, TEL_BULLETIN);
|
||||||
else
|
else
|
||||||
return typed_wu(from, to, buf, TEL_NORM);
|
return typed_wu(from, to, buf, TEL_NORM);
|
||||||
|
@ -136,11 +136,8 @@ typed_wu(natid from, natid to, char *message, int type)
|
||||||
mailbox(box, to);
|
mailbox(box, to);
|
||||||
|
|
||||||
if (type != TEL_ANNOUNCE)
|
if (type != TEL_ANNOUNCE)
|
||||||
if ((np = getnatp(to)) == 0 ||
|
if ((np = getnatp(to)) == 0 || np->nat_stat < STAT_SANCT)
|
||||||
((np->nat_stat & STAT_NORM) == 0 &&
|
|
||||||
(np->nat_stat & STAT_SANCT) == 0)) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
if ((fd = open(box, O_WRONLY | O_APPEND, 0)) < 0) {
|
if ((fd = open(box, O_WRONLY | O_APPEND, 0)) < 0) {
|
||||||
#else
|
#else
|
||||||
|
@ -176,8 +173,7 @@ typed_wu(natid from, natid to, char *message, int type)
|
||||||
logerror("telegram 'write' to #%d failed to close.", to);
|
logerror("telegram 'write' to #%d failed to close.", to);
|
||||||
} else if (write_ok && type == TEL_ANNOUNCE) {
|
} else if (write_ok && type == TEL_ANNOUNCE) {
|
||||||
for (to = 0; NULL != (np = getnatp(to)); to++) {
|
for (to = 0; NULL != (np = getnatp(to)); to++) {
|
||||||
if (!(np->nat_stat & STAT_NORM) &&
|
if (np->nat_stat < STAT_SANCT)
|
||||||
!(np->nat_stat & STAT_SANCT))
|
|
||||||
continue;
|
continue;
|
||||||
if (!player->god && (getrejects(from, np) & REJ_ANNO))
|
if (!player->god && (getrejects(from, np) & REJ_ANNO))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -54,13 +54,7 @@ age_levels(int etu)
|
||||||
best_tech = 0.0;
|
best_tech = 0.0;
|
||||||
best_res = 0.0;
|
best_res = 0.0;
|
||||||
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
||||||
if ((np->nat_stat & STAT_NORM) == 0)
|
if (np->nat_stat != STAT_ACTIVE)
|
||||||
continue;
|
|
||||||
|
|
||||||
if (np->nat_stat & STAT_GOD)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (np->nat_stat == VIS)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (best_tech < np->nat_level[NAT_TLEV])
|
if (best_tech < np->nat_level[NAT_TLEV])
|
||||||
|
@ -85,11 +79,11 @@ age_levels(int etu)
|
||||||
best_tech /= 5;
|
best_tech /= 5;
|
||||||
best_res /= 5;
|
best_res /= 5;
|
||||||
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
||||||
if ((np->nat_stat & STAT_INUSE) == 0)
|
if (np->nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (np->nat_stat & STAT_GOD)
|
if (np->nat_stat == STAT_GOD)
|
||||||
continue;
|
continue;
|
||||||
if (np->nat_stat == VIS)
|
if (np->nat_stat == STAT_VIS)
|
||||||
continue;
|
continue;
|
||||||
level = np->nat_level[NAT_TLEV];
|
level = np->nat_level[NAT_TLEV];
|
||||||
if (level < best_tech && chance(0.2))
|
if (level < best_tech && chance(0.2))
|
||||||
|
|
|
@ -120,7 +120,7 @@ update_main(void *unused)
|
||||||
mil_dbl_pay = 0;
|
mil_dbl_pay = 0;
|
||||||
if ((np = getnatp(x)) == (struct natstr *)0)
|
if ((np = getnatp(x)) == (struct natstr *)0)
|
||||||
continue;
|
continue;
|
||||||
if (np->nat_stat & STAT_SANCT) {
|
if (np->nat_stat == STAT_SANCT) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
logerror("Country %i is in sanctuary and did not update", x);
|
logerror("Country %i is in sanctuary and did not update", x);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -140,7 +140,7 @@ prod_nat(int etu)
|
||||||
struct natstr *cnp;
|
struct natstr *cnp;
|
||||||
|
|
||||||
for (n = 0; NULL != (np = getnatp(n)); n++) {
|
for (n = 0; NULL != (np = getnatp(n)); n++) {
|
||||||
if ((np->nat_stat & STAT_NORM) == 0)
|
if (np->nat_stat < STAT_ACTIVE)
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
* hap_edu: the more education people have, the
|
* hap_edu: the more education people have, the
|
||||||
|
@ -190,7 +190,7 @@ prod_nat(int etu)
|
||||||
memset(tech, 0, sizeof(tech));
|
memset(tech, 0, sizeof(tech));
|
||||||
}
|
}
|
||||||
for (n = 0; NULL != (np = getnatp(n)); n++) {
|
for (n = 0; NULL != (np = getnatp(n)); n++) {
|
||||||
if ((np->nat_stat & STAT_NORM) == 0)
|
if (np->nat_stat < STAT_ACTIVE)
|
||||||
continue;
|
continue;
|
||||||
tlev = levels[n][NAT_TLEV];
|
tlev = levels[n][NAT_TLEV];
|
||||||
rlev = levels[n][NAT_RLEV];
|
rlev = levels[n][NAT_RLEV];
|
||||||
|
@ -241,21 +241,21 @@ share_incr(double *res, double *tech)
|
||||||
|
|
||||||
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
for (i = 0; NULL != (np = getnatp(i)); i++) {
|
||||||
res[i] = tech[i] = 0.0;
|
res[i] = tech[i] = 0.0;
|
||||||
if ((np->nat_stat & STAT_INUSE) == 0)
|
if (np->nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (np->nat_stat & STAT_GOD)
|
if (np->nat_stat == STAT_GOD)
|
||||||
continue;
|
continue;
|
||||||
if (np->nat_stat == VIS)
|
if (np->nat_stat == STAT_VIS)
|
||||||
continue;
|
continue;
|
||||||
rnc = tnc = 0;
|
rnc = tnc = 0;
|
||||||
for (j = 0; NULL != (other = getnatp(j)); j++) {
|
for (j = 0; NULL != (other = getnatp(j)); j++) {
|
||||||
if (j == i)
|
if (j == i)
|
||||||
continue;
|
continue;
|
||||||
if (other->nat_stat & STAT_GOD)
|
if (other->nat_stat == STAT_GOD)
|
||||||
continue;
|
continue;
|
||||||
if (other->nat_stat == VIS)
|
if (other->nat_stat == STAT_VIS)
|
||||||
continue;
|
continue;
|
||||||
if ((other->nat_stat & STAT_INUSE) == 0)
|
if (other->nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!getcontact(np, j))
|
if (!getcontact(np, j))
|
||||||
|
|
|
@ -89,11 +89,11 @@ prepare_sects(int etu, int *bp)
|
||||||
np = getnatp(sp->sct_own);
|
np = getnatp(sp->sct_own);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (np->nat_stat & STAT_SANCT)
|
if (np->nat_stat == STAT_SANCT)
|
||||||
logerror("Prepare.c: country in sanctuary skipped production");
|
logerror("Prepare.c: country in sanctuary skipped production");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
if (!(np->nat_stat & STAT_SANCT)) {
|
if (np->nat_stat != STAT_SANCT) {
|
||||||
guerrilla(sp);
|
guerrilla(sp);
|
||||||
do_plague(sp, np, etu);
|
do_plague(sp, np, etu);
|
||||||
tax(sp, np, etu, &pops[sp->sct_own], &civ_tax, &uw_tax,
|
tax(sp, np, etu, &pops[sp->sct_own], &civ_tax, &uw_tax,
|
||||||
|
|
|
@ -45,7 +45,7 @@ update_removewants(void)
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
|
|
||||||
for (cn = 0; NULL != (natp = getnatp(cn)); cn++) {
|
for (cn = 0; NULL != (natp = getnatp(cn)); cn++) {
|
||||||
if ((natp->nat_stat & STAT_INUSE) &&
|
if ((natp->nat_stat != STAT_UNUSED) &&
|
||||||
(natp->nat_update & WUPD_WANT) == 0) {
|
(natp->nat_update & WUPD_WANT) == 0) {
|
||||||
natp->nat_missed++;
|
natp->nat_missed++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ guerrilla(struct sctstr *sp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tnat = getnatp(target);
|
tnat = getnatp(target);
|
||||||
if ((tnat->nat_stat & STAT_INUSE) == 0) {
|
if (tnat->nat_stat == STAT_UNUSED) {
|
||||||
/* target nation has dissolved: che's retire. */
|
/* target nation has dissolved: che's retire. */
|
||||||
logerror("%d Che targeted at country %d retiring", che, target);
|
logerror("%d Che targeted at country %d retiring", che, target);
|
||||||
sp->sct_che = 0;
|
sp->sct_che = 0;
|
||||||
|
|
|
@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
||||||
nat.ef_type = EF_NATION;
|
nat.ef_type = EF_NATION;
|
||||||
strcpy(nat.nat_cnam, "POGO");
|
strcpy(nat.nat_cnam, "POGO");
|
||||||
strcpy(nat.nat_pnam, "peter");
|
strcpy(nat.nat_pnam, "peter");
|
||||||
nat.nat_stat = STAT_INUSE | STAT_NORM | STAT_GOD;
|
nat.nat_stat = STAT_GOD;
|
||||||
nat.nat_btu = 255;
|
nat.nat_btu = 255;
|
||||||
nat.nat_money = 123456789;
|
nat.nat_money = 123456789;
|
||||||
nat.nat_cnum = 0;
|
nat.nat_cnum = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue