(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 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, int contact);
extern void agecontact(struct natstr *np); extern void agecontact(struct natstr *np);
extern int influx(struct natstr *np);
/* nation flags */ /* nation flags */
#define NF_INFORM bit(0) /* Inform me of telegrams right away */ #define NF_INFORM bit(0) /* Inform me of telegrams right away */

View file

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

View file

@ -61,9 +61,7 @@ nati(void)
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_INUSE) {
getsect(natp->nat_xcap, natp->nat_ycap, &sect); getsect(natp->nat_xcap, natp->nat_ycap, &sect);
if (!player->owner || (sect.sct_type != SCT_CAPIT && if (influx(natp))
sect.sct_type != SCT_MOUNT &&
sect.sct_type != SCT_SANCT))
pr("No capital. (was at %s)\n", pr("No capital. (was at %s)\n",
xyas(sect.sct_x, sect.sct_y, player->cnum)); xyas(sect.sct_x, sect.sct_y, player->cnum));
else { else {

View file

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

View file

@ -170,3 +170,18 @@ putcontact(struct natstr *np, natid them, int contact)
if (np->nat_contact[them] < contact) if (np->nat_contact[them] < contact)
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;
}