prnat() prnatid(): New, common country name (#number) formatting
prnat() is more convenient when you already got the struct natstr *. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
383bbff603
commit
61a32b8b69
10 changed files with 65 additions and 58 deletions
|
@ -550,8 +550,8 @@ board_abort(struct combat *off, struct combat *def)
|
|||
pr("Victim ship moves faster than you do!\n");
|
||||
if (def->own)
|
||||
wu(0, def->own,
|
||||
"%s (#%d) %s failed to catch %s\n",
|
||||
cname(aship.shp_own), aship.shp_own,
|
||||
"%s %s failed to catch %s\n",
|
||||
prnatid(aship.shp_own),
|
||||
pr_com(0, off, def->own), pr_com(0, def, def->own));
|
||||
return abort_attack();
|
||||
}
|
||||
|
@ -1982,8 +1982,8 @@ att_fight(int combat_mode, struct combat *off, struct emp_qelem *olist,
|
|||
nreport(player->cnum, news_item, def->own, 1);
|
||||
if (def->own) {
|
||||
wu(0, def->own,
|
||||
"%s (#%d) lost %d troops %s %s\nWe lost %d troops defending\n",
|
||||
cname(player->cnum), player->cnum, a_cas,
|
||||
"%s lost %d troops %s %s\nWe lost %d troops defending\n",
|
||||
prnatid(player->cnum), a_cas,
|
||||
action, pr_com(0, def, def->own), d_cas);
|
||||
}
|
||||
|
||||
|
@ -2155,8 +2155,8 @@ att_empty_attack(int combat_mode, int ototal, struct combat *def)
|
|||
if (ototal <= 0) {
|
||||
if (def->own && player->cnum != def->own) {
|
||||
wu(0, def->own,
|
||||
"%s (#%d) considered %sing you @%s\n",
|
||||
cname(player->cnum), player->cnum,
|
||||
"%s considered %sing you @%s\n",
|
||||
prnatid(player->cnum),
|
||||
att_mode[combat_mode], xyas(def->x, def->y, def->own));
|
||||
}
|
||||
pr("No troops for %s...\n", att_mode[combat_mode]);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* nat.c: Nation subroutines
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* Markus Armbruster, 2009-2011
|
||||
* Markus Armbruster, 2009-2013
|
||||
* Ron Koenderink, 2008-2009
|
||||
*/
|
||||
|
||||
|
@ -72,3 +72,15 @@ check_nat_name(char *cname, natid cnum)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *
|
||||
prnat(struct natstr *np)
|
||||
{
|
||||
return prbuf("%s (#%d)", np->nat_cnam, np->nat_cnum);
|
||||
}
|
||||
|
||||
char *
|
||||
prnatid(natid cnum)
|
||||
{
|
||||
return prbuf("%s (#%d)", cname(cnum), cnum);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* Known contributors to this file:
|
||||
* Dave Pare, 1994
|
||||
* Markus Armbruster, 2005-2011
|
||||
* Markus Armbruster, 2005-2013
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -91,8 +91,8 @@ setrel(natid us, natid them, int rel)
|
|||
cname(them), whichway, relates[rel]);
|
||||
if (!(getrejects(us, themnp) & REJ_TELE))
|
||||
mpr(them,
|
||||
"Country %s (#%d) has %s their relations with you to \"%s\"!\n",
|
||||
cname(us), us, whichway, relates[rel]);
|
||||
"Country %s has %s their relations with you to \"%s\"!\n",
|
||||
prnat(mynp), whichway, relates[rel]);
|
||||
|
||||
putrel(mynp, them, rel);
|
||||
putnat(mynp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue