]> git.pond.sub.org Git - empserver/commitdiff
(nati, player_coms): Add ability for deities to request a nation report for any country.
authorRon Koenderink <rkoenderink@yahoo.ca>
Tue, 20 Dec 2005 17:06:47 +0000 (17:06 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Tue, 20 Dec 2005 17:06:47 +0000 (17:06 +0000)
Closes #1083167.

info/Commands/nation.t
src/lib/commands/nati.c
src/lib/player/empmod.c

index cf2a198e5f948833e900ac24bff3f3f740734191..337bd44a515c9db4b34a2bf8530792038e0bd232 100644 (file)
@@ -1,8 +1,10 @@
 .TH Command NATION
 .NA nation "The state of your nation"
 .LV Basic
-.SY "nation"
-The nation report command displays various data about your country.
+.SY "nation [as-COUNTRY]"
+The nation report command displays various data about a country.
+The as-COUNTRY defaults to yourself.
+Only a deity can request a nation report for another country.
 .s1
 The data displayed by the nation command is formatted as a single page
 report and should be self explanatory.
index 6e46e9e1973545e22032046cb9525e8402b186d9..4a43ae1c489b8fbbeeb3870f42dc98f5ee71ce95 100644 (file)
@@ -48,14 +48,27 @@ nati(void)
     float hap;
     int mil;
     int civ;
+    int cnum;
     int poplimit, safepop, uwpop;
     double pfac;
 
-    if ((natp = getnatp(player->cnum)) == 0) {
-       pr("Bad country number %d\n", player->cnum);
+    if (player->argp[1])
+       cnum = natarg(player->argp[1], "for which country? ");
+    else
+       cnum = player->cnum;
+
+    if ((natp = getnatp(cnum)) == 0) {
+       pr("Bad country number %d\n", cnum);
+       return RET_SYN;
+    }
+
+    if (!player->god && cnum != player->cnum) {
+       pr("Only deities can request a nation "
+          "report for a different country than yourself.\n");
        return RET_SYN;
     }
-    pr("\n(#%i) %s Nation Report\t", player->cnum, cname(player->cnum));
+
+    pr("\n(#%i) %s Nation Report\t", cnum, cname(cnum));
     prdate();
     pr("Nation status is %s", natstate(natp));
     pr("     Bureaucratic Time Units: %d\n", natp->nat_btu);
@@ -63,7 +76,7 @@ nati(void)
        getsect(natp->nat_xcap, natp->nat_ycap, &sect);
        if (influx(natp))
            pr("No capital (was at %s).\n",
-              xyas(sect.sct_x, sect.sct_y, player->cnum));
+              xyas(sect.sct_x, sect.sct_y, cnum));
        else {
            civ = sect.sct_item[I_CIVIL];
            mil = sect.sct_item[I_MILIT];
@@ -71,7 +84,7 @@ nati(void)
               sect.sct_effic,
               (sect.sct_type ==
                SCT_CAPIT ? "capital" : "mountain capital"),
-              xyas(sect.sct_x, sect.sct_y, player->cnum), civ, splur(civ),
+              xyas(sect.sct_x, sect.sct_y, cnum), civ, splur(civ),
               mil);
        }
     }
@@ -83,7 +96,7 @@ nati(void)
     pr("Technology.........%6.2f       Research........%6.2f\n",
        (double)natp->nat_level[NAT_TLEV],
        (double)natp->nat_level[NAT_RLEV]);
-    pr("Technology factor :%6.2f%%", tfact(player->cnum, 100.));
+    pr("Technology factor :%6.2f%%", tfact(cnum, 100.));
 
     if (opt_NO_PLAGUE)
        pfac = 0.0;
index 2bf755e34801d19c93db6846e5fdfce25e5e0c2e..702d699ad4455b8d52f1058d87984be105e20190 100644 (file)
@@ -161,7 +161,7 @@ struct cmndstr player_coms[] = {
      move, C_MOD, NORM + CAP},
     {"mquota <SHIPS> <value>", 2, mobq, C_MOD, NORM + CAP},
     {"name <SHIPS> <NAME>", 0, name, C_MOD, NORM},
-    {"nation", 0, nati, 0, VIS},
+    {"nation [as-COUNTRY]", 0, nati, 0, VIS},
     {"navigate <SHIPS> <PATH|DESTINATION>", 1, navi, C_MOD, NORM + CAP},
     {"ndump <SECTS>", 0, ndump, 0, NORM},
     {"newcap <NAT> [<SECTOR>]", 0, new, C_MOD, GOD},