From cdfb94dc1f5d4e146ab509fc4cc26306b6ef1c08 Mon Sep 17 00:00:00 2001 From: Ron Koenderink Date: Tue, 20 Dec 2005 17:06:47 +0000 Subject: [PATCH] (nati, player_coms): Add ability for deities to request a nation report for any country. Closes #1083167. --- info/Commands/nation.t | 6 ++++-- src/lib/commands/nati.c | 25 +++++++++++++++++++------ src/lib/player/empmod.c | 2 +- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/info/Commands/nation.t b/info/Commands/nation.t index cf2a198e..337bd44a 100644 --- a/info/Commands/nation.t +++ b/info/Commands/nation.t @@ -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. diff --git a/src/lib/commands/nati.c b/src/lib/commands/nati.c index 6e46e9e1..4a43ae1c 100644 --- a/src/lib/commands/nati.c +++ b/src/lib/commands/nati.c @@ -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; } - 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(); 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, §); 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; diff --git a/src/lib/player/empmod.c b/src/lib/player/empmod.c index 2bf755e3..702d699a 100644 --- a/src/lib/player/empmod.c +++ b/src/lib/player/empmod.c @@ -161,7 +161,7 @@ struct cmndstr player_coms[] = { move, C_MOD, NORM + CAP}, {"mquota ", 2, mobq, C_MOD, NORM + CAP}, {"name ", 0, name, C_MOD, NORM}, - {"nation", 0, nati, 0, VIS}, + {"nation [as-COUNTRY]", 0, nati, 0, VIS}, {"navigate ", 1, navi, C_MOD, NORM + CAP}, {"ndump ", 0, ndump, 0, NORM}, {"newcap []", 0, new, C_MOD, GOD},