]> git.pond.sub.org Git - empserver/commitdiff
edit: Report unit loss and gain properly for unit key 'O'
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 27 Jan 2013 14:37:51 +0000 (15:37 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 6 Jun 2013 17:55:02 +0000 (19:55 +0200)
Print a message describing the actual change.  Necessary to give the
deity a chance to catch unexpected changes, e.g. a player boarding a
ship right before the deity edits it.  Watching out for such changes
is especially important with non-interactive edit.

Code already sends bulletins.  Also report news.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/edit.c
tests/actofgod/actofgod.xdump
tests/actofgod/journal.log

index 967c234fe37715e75cf38beb450dfab7b427a2f1..28877ad7e58e4703efda557c85a277cb2e6288dc 100644 (file)
@@ -754,14 +754,13 @@ edit_unit(struct empobj *unit, char *key, char *p,
     case 'O':
        if (arg < 0 || arg >= MAXNOC)
            return RET_SYN;
     case 'O':
        if (arg < 0 || arg >= MAXNOC)
            return RET_SYN;
-       if (arg == unit->own)
-           break;
-       if (unit->own && unit->own != player->cnum)
-           wu(0, unit->own, "%s taken from you by an act of %s!\n",
-              unit_nameof(unit), cname(player->cnum));
-       if (arg && arg != player->cnum)
-           wu(0, arg, "%s given to you by an act of %s!\n",
-              unit_nameof(unit), cname(player->cnum));
+       divine_unit_change_quiet(unit, "Owner", arg != unit->own,
+                                "from %s to %s",
+                                prnatid(unit->own), prnatid(arg));
+       if (arg != unit->own) {
+           report_god_takes("", unit_nameof(unit), unit->own);
+           report_god_gives("", unit_nameof(unit), arg);
+       }
        unit->own = arg;
        break;
     case 'L':
        unit->own = arg;
        break;
     case 'L':
index 76a3e5183429a029fd6657f0cb096c59d72e5d1c..ac73f70f23f410270410a20e67f79c96a583cbaa 100644 (file)
@@ -365,8 +365,8 @@ actor action victim times duration time
 0 42 1 39 0 0
 0 44 3 1 0 0
 0 44 1 32 0 0
 0 42 1 39 0 0
 0 44 3 1 0 0
 0 44 1 32 0 0
-0 43 2 2 0 0
-0 44 3 1 0 0
+0 43 2 5 0 0
+0 44 3 10 0 0
 0 43 1 67 0 0
 0 42 1 4 0 0
 1 45 0 1 0 0
 0 43 1 67 0 0
 0 42 1 4 0 0
 1 45 0 1 0 0
index 1a71d6692aa44f2dba153de3b426407f8a0fb4fa..e88857947a5bcfe5ec377ff553754cdb12dda0b7 100644 (file)
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 0 O 0
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 0 O 0
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of cs   cargo ship (#0) changed from 3 (#3) to POGO (#0)
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 0 O -1
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 0 O -1
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 1 O 98
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 1 O 98
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of cs   cargo ship (#1) changed from 3 (#3) to 98 (#98)
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 1 O 99
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 1 O 99
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 2 O 2
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 2 O 2
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of cs   cargo ship (#2) changed from 3 (#3) to 2 (#2)
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 3 U 5 U 3
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit s 3 U 5 U 3
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 0 O 0
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 0 O 0
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of f1   Sopwith Camel #0 changed from 3 (#3) to POGO (#0)
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 0 O -1
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 0 O -1
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 1 O 98
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 1 O 98
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of f1   Sopwith Camel #1 changed from 3 (#3) to 98 (#98)
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 1 O 99
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 1 O 99
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 2 O 2
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 2 O 2
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of f1   Sopwith Camel #2 changed from 3 (#3) to 2 (#2)
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 3 U 5 U 3
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit p 3 U 5 U 3
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 0 O 0
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 0 O 0
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of sup  supply #0 changed from 3 (#3) to POGO (#0)
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 0 O -1
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 0 O -1
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 1 O 98
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 1 O 98
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of sup  supply #1 changed from 3 (#3) to 98 (#98)
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 1 O 99
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 1 O 99
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 2 O 2
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 2 O 2
     Play#0 command edit
+    Play#0 output Play#0 1 Owner of sup  supply #2 changed from 3 (#3) to 2 (#2)
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 3 U 5 U 3
     Play#0 command edit
     Play#0 output Play#0 6 0 640
     Play#0 input edit u 3 U 5 U 3
     Play#0 command edit