edit: Report unit loss and gain properly for unit key 'O'

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>
This commit is contained in:
Markus Armbruster 2013-01-27 15:37:51 +01:00
parent 6e260f7f5e
commit ccd4368679
3 changed files with 18 additions and 10 deletions

View file

@ -754,14 +754,13 @@ edit_unit(struct empobj *unit, char *key, char *p,
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':

View 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 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

View file

@ -835,6 +835,7 @@
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
@ -842,6 +843,7 @@
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
@ -849,6 +851,7 @@
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
@ -870,6 +873,7 @@
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
@ -877,6 +881,7 @@
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
@ -884,6 +889,7 @@
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
@ -905,6 +911,7 @@
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
@ -912,6 +919,7 @@
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
@ -919,6 +927,7 @@
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