]> git.pond.sub.org Git - empserver/commitdiff
(coun_list, repo_list, nati): Replace in-flux determination code with influx().
authorRon Koenderink <rkoenderink@yahoo.ca>
Sat, 17 Dec 2005 20:18:54 +0000 (20:18 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sat, 17 Dec 2005 20:18:54 +0000 (20:18 +0000)
(influx): New.

include/nat.h
src/lib/commands/coun.c
src/lib/commands/nati.c
src/lib/commands/repo.c
src/lib/common/nat.c

index c31647d2446e0b5a7f7372dbfbd8136444b415a1..c210ef987fb85fa980604e6b08b029260b6200a4 100644 (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 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 */
 
 /* nation flags */
 #define NF_INFORM      bit(0)  /* Inform me of telegrams right away */
index 9e0e57dbab2c71c81f96b2d15b1fd8af4a08d083..52c8f221639e2814f2d716ac74c173fc710070b4 100644 (file)
@@ -68,7 +68,6 @@ static void
 coun_list(struct natstr *natp)
 {
     char *status;
 coun_list(struct natstr *natp)
 {
     char *status;
-    struct sctstr sect;
     natid cn = natp->nat_cnum;
 
     pr("%3d  ", cn);
     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) {
     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";
                status = "In flux";
            else if (natp->nat_money < 0)
                status = "Broke";
index a9b12141c4dccedf0417b826ca4e689d8f9fdfc2..79ff79266e24367bf17b6f01a5286e0737eeed31 100644 (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);
     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 {
            pr("No capital. (was at %s)\n",
               xyas(sect.sct_x, sect.sct_y, player->cnum));
        else {
index 7b8039590163f1aac879a0f2137707459eb5dc8e..d98231733cf6650bf6bde933ddf1e725387ee60f 100644 (file)
@@ -121,8 +121,6 @@ repo_header(void)
 static void
 repo_list(struct stats *stat, natid cn, struct natstr *natp)
 {
 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",
     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);
        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 (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");
                pr("In flux\n");
            else if (natp->nat_money <= 0)
                pr("Broke\n");
index e8bd476281091432237ae92fd965ae1d17bca729..55940b32538a7b2255e61782e78431d5d0c0d2a7 100644 (file)
@@ -170,3 +170,18 @@ putcontact(struct natstr *np, natid them, int contact)
     if (np->nat_contact[them] < contact)
        np->nat_contact[them] = 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 &&\r
+        sect.sct_type != SCT_SANCT) ||
+       (np->nat_flags & NF_SACKED))
+       return 1;
+    else
+       return 0;
+}