ATTRIBUTE((format (printf, 5, 6)));
#define divine_sct_change_quiet(sp, name, change, ...) \
divine_sct_change((sp), (name), -(change), 0, __VA_ARGS__)
+extern void report_divine_gift(natid, struct ichrstr *, int, char *);
#endif
#include <config.h>
+#include "actofgod.h"
#include "commands.h"
#include "item.h"
#include "news.h"
m = n + amt;
sect.sct_item[ip->i_uid] = m;
putsect(§);
- if (sect.sct_own != 0 && sect.sct_own != player->cnum && m != n) {
- if (m > n) {
- if (opt_GODNEWS
- && getnatp(sect.sct_own)->nat_stat != STAT_GOD)
- nreport(player->cnum, N_GIFT, sect.sct_own, 1);
- wu(0, sect.sct_own, "%s gave you %d %s in %s\n",
- cname(player->cnum), m - n, ip->i_name,
- xyas(sect.sct_x, sect.sct_y, sect.sct_own));
- } else {
- if (opt_GODNEWS
- && getnatp(sect.sct_own)->nat_stat != STAT_GOD)
- nreport(sect.sct_own, N_TAKE, player->cnum, 1);
- wu(0, sect.sct_own, "%s stole %d %s from %s\n",
- cname(player->cnum), n - m, ip->i_name,
- xyas(sect.sct_x, sect.sct_y, sect.sct_own));
- }
- }
+ report_divine_gift(sect.sct_own, ip, m - n,
+ xyas(sect.sct_x, sect.sct_y, sect.sct_own));
if (m - n != amt)
pr("Only %d %s in %s\n", abs(m - n),
m - n >= 0 ? "given" : "taken",
nreport_divine_aid(sp->sct_own, goodness);
}
}
+
+/*
+ * Report deity giving/taking commodities to/from WHOM.
+ * Give AMT of IP in PLACE.
+ */
+void
+report_divine_gift(natid whom, struct ichrstr *ip, int amt, char *place)
+{
+ if (whom && whom != player->cnum && amt) {
+ if (amt > 0) {
+ if (opt_GODNEWS && getnatp(whom)->nat_stat != STAT_GOD)
+ nreport(player->cnum, N_GIFT, whom, 1);
+ wu(0, whom, "%s gave you %d %s in %s\n",
+ cname(player->cnum), amt, ip->i_name, place);
+ } else {
+ if (opt_GODNEWS && getnatp(whom)->nat_stat != STAT_GOD)
+ nreport(whom, N_TAKE, player->cnum, 1);
+ wu(0, whom, "%s stole %d %s from %s\n",
+ cname(player->cnum), -amt, ip->i_name, place);
+ }
+ }
+}