From 4c1866285b45496d03812a4195d0b31a1e7e706f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 20 Jan 2013 17:38:06 +0100 Subject: [PATCH] give: Report number given when less than requested amount Necessary to give the deity a chance to catch unexpected changes, e.g. a player moving away stuff right before a give command, leaving fewer items than the deity intends to take. Signed-off-by: Markus Armbruster --- src/lib/commands/give.c | 4 ++++ tests/actofgod/journal.log | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/lib/commands/give.c b/src/lib/commands/give.c index f4bf59f87..7883ca0eb 100644 --- a/src/lib/commands/give.c +++ b/src/lib/commands/give.c @@ -89,6 +89,10 @@ give(void) 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", + xyas(sect.sct_x, sect.sct_y, player->cnum)); pr("%d %s in %s\n", m, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum)); } diff --git a/tests/actofgod/journal.log b/tests/actofgod/journal.log index b73f80f90..85a507646 100644 --- a/tests/actofgod/journal.log +++ b/tests/actofgod/journal.log @@ -752,6 +752,7 @@ Play#0 output Play#0 6 0 640 Play#0 input give l 2,6 -2147483648 Play#0 command give + Play#0 output Play#0 1 Only 0 given in 2,6 Play#0 output Play#0 1 0 light products in 2,6 Play#0 output Play#0 6 0 640 Play#0 input give c 4:8,6 1 @@ -762,6 +763,7 @@ Play#0 output Play#0 6 0 640 Play#0 input give c 6,6 2147483647 Play#0 command give + Play#0 output Play#0 1 Only 9997 given in 6,6 Play#0 output Play#0 1 9999 civilians in 6,6 Play#0 output Play#0 6 0 640 Play#0 input give c 8,6 -1 -- 2.43.0