edit: Report ship and land unit commodity change properly

Print a message describing the actual change.  Necessary to give the
deity a chance to catch unexpected changes, e.g. a player unloading
stuff right before the deity edits it, leaving fewer items than the
deity intends to take.  Watching out for such changes is especially
important with non-interactive edit.

Send bulletin to owner and report news exactly like the give command.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-02-03 13:16:48 +01:00
parent 5e4af4a6f0
commit b99a116dd6
3 changed files with 27 additions and 0 deletions

View file

@ -821,6 +821,12 @@ edit_ship(struct shpstr *ship, char *key, char *p)
case 'r':
ip = item_by_name(key);
arg = LIMIT_TO(arg, 0, mchr[ship->shp_type].m_item[ip->i_uid]);
divine_unit_change_quiet((struct empobj *)ship, ip->i_name,
arg != ship->shp_item[ip->i_uid],
"from %d to %d",
ship->shp_item[ip->i_uid], arg);
report_divine_gift(ship->shp_own, ip,
arg - ship->shp_item[ip->i_uid], prship(ship));
ship->shp_item[ip->i_uid] = arg;
break;
default:
@ -925,6 +931,12 @@ edit_land(struct lndstr *land, char *key, char *p)
case 'r':
ip = item_by_name(key);
arg = LIMIT_TO(arg, 0, lchr[land->lnd_type].l_item[ip->i_uid]);
divine_unit_change_quiet((struct empobj *)land, ip->i_name,
arg != land->lnd_item[ip->i_uid],
"from %d to %d",
land->lnd_item[ip->i_uid], arg);
report_divine_gift(land->lnd_own, ip,
arg - land->lnd_item[ip->i_uid], prland(land));
land->lnd_item[ip->i_uid] = arg;
break;
default: