(nati, player_coms): Add ability for deities to request a nation report for any country.

Closes #1083167.
This commit is contained in:
Ron Koenderink 2005-12-20 17:06:47 +00:00
parent 16d0f5d133
commit cdfb94dc1f
3 changed files with 24 additions and 9 deletions

View file

@ -1,8 +1,10 @@
.TH Command NATION .TH Command NATION
.NA nation "The state of your nation" .NA nation "The state of your nation"
.LV Basic .LV Basic
.SY "nation" .SY "nation [as-COUNTRY]"
The nation report command displays various data about your 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 .s1
The data displayed by the nation command is formatted as a single page The data displayed by the nation command is formatted as a single page
report and should be self explanatory. report and should be self explanatory.

View file

@ -48,14 +48,27 @@ nati(void)
float hap; float hap;
int mil; int mil;
int civ; int civ;
int cnum;
int poplimit, safepop, uwpop; int poplimit, safepop, uwpop;
double pfac; double pfac;
if ((natp = getnatp(player->cnum)) == 0) { if (player->argp[1])
pr("Bad country number %d\n", player->cnum); 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; return RET_SYN;
} }
pr("\n(#%i) %s Nation Report\t", player->cnum, cname(player->cnum));
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", cnum, cname(cnum));
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);
@ -63,7 +76,7 @@ nati(void)
getsect(natp->nat_xcap, natp->nat_ycap, &sect); getsect(natp->nat_xcap, natp->nat_ycap, &sect);
if (influx(natp)) if (influx(natp))
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, cnum));
else { else {
civ = sect.sct_item[I_CIVIL]; civ = sect.sct_item[I_CIVIL];
mil = sect.sct_item[I_MILIT]; mil = sect.sct_item[I_MILIT];
@ -71,7 +84,7 @@ nati(void)
sect.sct_effic, sect.sct_effic,
(sect.sct_type == (sect.sct_type ==
SCT_CAPIT ? "capital" : "mountain capital"), 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); mil);
} }
} }
@ -83,7 +96,7 @@ nati(void)
pr("Technology.........%6.2f Research........%6.2f\n", pr("Technology.........%6.2f Research........%6.2f\n",
(double)natp->nat_level[NAT_TLEV], (double)natp->nat_level[NAT_TLEV],
(double)natp->nat_level[NAT_RLEV]); (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) if (opt_NO_PLAGUE)
pfac = 0.0; pfac = 0.0;

View file

@ -161,7 +161,7 @@ struct cmndstr player_coms[] = {
move, C_MOD, NORM + CAP}, move, C_MOD, NORM + CAP},
{"mquota <SHIPS> <value>", 2, mobq, C_MOD, NORM + CAP}, {"mquota <SHIPS> <value>", 2, mobq, C_MOD, NORM + CAP},
{"name <SHIPS> <NAME>", 0, name, C_MOD, NORM}, {"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}, {"navigate <SHIPS> <PATH|DESTINATION>", 1, navi, C_MOD, NORM + CAP},
{"ndump <SECTS>", 0, ndump, 0, NORM}, {"ndump <SECTS>", 0, ndump, 0, NORM},
{"newcap <NAT> [<SECTOR>]", 0, new, C_MOD, GOD}, {"newcap <NAT> [<SECTOR>]", 0, new, C_MOD, GOD},