actofgod: New divine_unit_change(), similar to divine_sct_change()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
2f475a54dc
commit
5e4af4a6f0
2 changed files with 34 additions and 0 deletions
|
@ -42,6 +42,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_unit_change(struct empobj *, char *, int, int, char *, ...)
|
||||
ATTRIBUTE((format (printf, 5, 6)));
|
||||
#define divine_unit_change_quiet(unit, name, change, ...) \
|
||||
divine_unit_change((unit), (name), -(change), 0, __VA_ARGS__)
|
||||
extern void report_divine_gift(natid, struct ichrstr *, int, char *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "player.h"
|
||||
#include "prototypes.h"
|
||||
#include "sect.h"
|
||||
#include "unit.h"
|
||||
|
||||
static void
|
||||
nreport_divine_aid(natid whom, int goodness)
|
||||
|
@ -108,6 +109,35 @@ divine_sct_change(struct sctstr *sp, char *name,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Report deity meddling with UNIT.
|
||||
* Just like divine_sct_change(), only for ships, planes, land units,
|
||||
* nukes.
|
||||
*/
|
||||
void
|
||||
divine_unit_change(struct empobj *unit, 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, unit_nameof(unit));
|
||||
return;
|
||||
}
|
||||
|
||||
pr("%s of %s changed %s\n", name, unit_nameof(unit), buf);
|
||||
if (change > 0 && unit->own && unit->own != player->cnum) {
|
||||
wu(0, unit->own, "%s of %s changed %s by an act of %s\n",
|
||||
name, unit_nameof(unit), buf, cname(player->cnum));
|
||||
nreport_divine_aid(unit->own, goodness);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Report deity giving/taking commodities to/from WHOM.
|
||||
* Give AMT of IP in PLACE.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue