actofgod: New divine_nat_change(), similar to divine_sct_change()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
a03d804ffc
commit
e6c1476c2f
2 changed files with 32 additions and 0 deletions
|
@ -45,6 +45,10 @@ extern void divine_sct_change(struct sctstr *, char *, int, int, char *, ...)
|
|||
ATTRIBUTE((format (printf, 5, 6)));
|
||||
#define divine_sct_change_quiet(sp, name, change, ...) \
|
||||
divine_sct_change((sp), (name), -(change), 0, __VA_ARGS__)
|
||||
extern void divine_nat_change(struct natstr *, char *, int, int, char *, ...)
|
||||
ATTRIBUTE((format (printf, 5, 6)));
|
||||
#define divine_nat_change_quiet(np, name, change, ...) \
|
||||
divine_nat_change((np), (name), -(change), 0, __VA_ARGS__)
|
||||
extern void divine_unit_change(struct empobj *, char *, int, int, char *, ...)
|
||||
ATTRIBUTE((format (printf, 5, 6)));
|
||||
#define divine_unit_change_quiet(unit, name, change, ...) \
|
||||
|
|
|
@ -109,6 +109,34 @@ divine_sct_change(struct sctstr *sp, char *name,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Report deity meddling with NP.
|
||||
* Just like divine_sct_change(), only for nations.
|
||||
*/
|
||||
void
|
||||
divine_nat_change(struct natstr *np, char *name,
|
||||
int change, int goodness, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buf[4096];
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (!change) {
|
||||
pr("%s of %s unchanged\n", name, prnat(np));
|
||||
return;
|
||||
}
|
||||
|
||||
pr("%s of %s changed %s\n", name, prnat(np), buf);
|
||||
if (change > 0 && np->nat_cnum != player->cnum) {
|
||||
wu(0, np->nat_cnum, "%s changed %s by an act of %s!\n",
|
||||
name, buf, cname(player->cnum));
|
||||
nreport_divine_aid(np->nat_cnum, goodness);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Report deity meddling with UNIT.
|
||||
* Just like divine_sct_change(), only for ships, planes, land units,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue