]> git.pond.sub.org Git - empserver/commitdiff
give: Report number given when less than requested amount
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 20 Jan 2013 16:38:06 +0000 (17:38 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 6 Jun 2013 17:52:26 +0000 (19:52 +0200)
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 <armbru@pond.sub.org>
src/lib/commands/give.c
tests/actofgod/journal.log

index f4bf59f878b523906c3061f91a0a08c5f2ca5c0c..7883ca0ebeb066146477ed1534a4a2cb9aeb0626 100644 (file)
@@ -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));
     }
index b73f80f90ce855b087cbdb56f0b71e3bfa0cb27b..85a5076460df56851a8a124e378a811413a7e2a5 100644 (file)
     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
     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