edit: Report loading/unloading of planes & land units properly

Print a message, send bulletin to owner.  Affects plane keys 's', 'y',
and land unit keys 'S', 'Y'.  The message is necessary to give the
deity a chance to catch unexpected changes, e.g. a player loading a
plane right before the deity edits it.  Watching out for such changes
is especially important with non-interactive edit.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-02-03 13:28:26 +01:00
parent 97b3aacaca
commit cbe9897bfa
4 changed files with 86 additions and 4 deletions

View file

@ -138,6 +138,34 @@ divine_unit_change(struct empobj *unit, char *name,
}
}
static void
divine_load_unload(struct empobj *unit, int type, int uid, char *act)
{
if (uid < 0)
return;
pr("%s %s %s #%d\n",
unit_nameof(unit), act, ef_nameof(type), uid);
if (unit->own && unit->own != player->cnum)
wu(0, unit->own,
"%s %s %s #%d by an act of %s!\n",
unit_nameof(unit), act, ef_nameof(type), uid,
cname(player->cnum));
/* carrier owner could differ; can't be bothered to report to him */
}
void
divine_load(struct empobj *unit, int type, int uid)
{
divine_load_unload(unit, type, uid, "loaded onto");
}
void
divine_unload(struct empobj *unit, int type, int uid)
{
divine_load_unload(unit, type, uid, "unloaded from");
}
/*
* Report deity giving/taking commodities to/from WHOM.
* Give AMT of IP in PLACE.