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
#include "player.h"
#include "prototypes.h"
#include "sect.h"
+#include "unit.h"
static void
nreport_divine_aid(natid whom, int goodness)
}
}
+/*
+ * 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.