(coun_list, repo_list, nati): Replace in-flux determination code with influx().

(influx): New.
This commit is contained in:
Ron Koenderink 2005-12-17 20:18:54 +00:00
parent d1e2d91961
commit 5ffef496ea
5 changed files with 19 additions and 13 deletions

View file

@ -172,6 +172,7 @@ extern void putrel(struct natstr *np, natid them, int relate);
extern void putreject(struct natstr *np, natid them, int how, int what);
extern void putcontact(struct natstr *np, natid them, int contact);
extern void agecontact(struct natstr *np);
extern int influx(struct natstr *np);
/* nation flags */
#define NF_INFORM bit(0) /* Inform me of telegrams right away */

View file

@ -68,7 +68,6 @@ static void
coun_list(struct natstr *natp)
{
char *status;
struct sctstr sect;
natid cn = natp->nat_cnum;
pr("%3d ", cn);
@ -102,9 +101,7 @@ coun_list(struct natstr *natp)
else if (natp->nat_stat & STAT_NORM) {
status = "Active";
if (!opt_HIDDEN || player->god) {
getsect(natp->nat_xcap, natp->nat_ycap, &sect);
if (sect.sct_own != cn ||
(sect.sct_type != SCT_CAPIT && sect.sct_type != SCT_MOUNT))
if (influx(natp))
status = "In flux";
else if (natp->nat_money < 0)
status = "Broke";

View file

@ -61,9 +61,7 @@ nati(void)
pr(" Bureaucratic Time Units: %d\n", natp->nat_btu);
if (natp->nat_stat & STAT_INUSE) {
getsect(natp->nat_xcap, natp->nat_ycap, &sect);
if (!player->owner || (sect.sct_type != SCT_CAPIT &&
sect.sct_type != SCT_MOUNT &&
sect.sct_type != SCT_SANCT))
if (influx(natp))
pr("No capital. (was at %s)\n",
xyas(sect.sct_x, sect.sct_y, player->cnum));
else {

View file

@ -121,8 +121,6 @@ repo_header(void)
static void
repo_list(struct stats *stat, natid cn, struct natstr *natp)
{
struct sctstr cap;
if (player->god) {
pr(" %-3d %-14.14s ", cn, natp->nat_cnam);
pr(" %7.2f %7.2f %7.2f %7.2f",
@ -139,13 +137,10 @@ repo_list(struct stats *stat, natid cn, struct natstr *natp)
printdiff(stat->stat, stat->res, natp, NAT_RLEV);
printdiff(stat->stat, stat->edu, natp, NAT_ELEV);
printdiff(stat->stat, stat->hap, natp, NAT_HLEV);
getsect(natp->nat_xcap, natp->nat_ycap, &cap);
if (opt_HIDDEN) {
pr("\n");
} else {
if ((cap.sct_own != cn) ||
(cap.sct_type != SCT_CAPIT && cap.sct_type != SCT_MOUNT) ||
(natp->nat_flags & NF_SACKED))
if (influx(natp))
pr("In flux\n");
else if (natp->nat_money <= 0)
pr("Broke\n");

View file

@ -170,3 +170,18 @@ putcontact(struct natstr *np, natid them, int contact)
if (np->nat_contact[them] < contact)
np->nat_contact[them] = contact;
}
int
influx(struct natstr *np)
{
struct sctstr sect;
getsect(np->nat_xcap, np->nat_ycap, &sect);
if (sect.sct_own != np->nat_cnum ||
(sect.sct_type != SCT_CAPIT && sect.sct_type != SCT_MOUNT &&
sect.sct_type != SCT_SANCT) ||
(np->nat_flags & NF_SACKED))
return 1;
else
return 0;
}