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:
parent
97b3aacaca
commit
cbe9897bfa
4 changed files with 86 additions and 4 deletions
|
@ -38,6 +38,8 @@
|
||||||
|
|
||||||
extern void report_god_takes(char *, char *, natid);
|
extern void report_god_takes(char *, char *, natid);
|
||||||
extern void report_god_gives(char *, char *, natid);
|
extern void report_god_gives(char *, char *, natid);
|
||||||
|
extern void divine_load(struct empobj *, int, int);
|
||||||
|
extern void divine_unload(struct empobj *, int, int);
|
||||||
extern void divine_sct_change(struct sctstr *, char *, int, int, char *, ...)
|
extern void divine_sct_change(struct sctstr *, char *, int, int, char *, ...)
|
||||||
ATTRIBUTE((format (printf, 5, 6)));
|
ATTRIBUTE((format (printf, 5, 6)));
|
||||||
#define divine_sct_change_quiet(sp, name, change, ...) \
|
#define divine_sct_change_quiet(sp, name, change, ...) \
|
||||||
|
|
|
@ -898,15 +898,31 @@ edit_land(struct lndstr *land, char *key, char *p)
|
||||||
case 'S':
|
case 'S':
|
||||||
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
|
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (arg >= 0 && arg != land->lnd_ship)
|
if (arg == land->lnd_ship) {
|
||||||
|
pr("Ship of %s unchanged\n", prland(land));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
divine_unload((struct empobj *)land, EF_SHIP, land->lnd_ship);
|
||||||
|
if (arg >= 0) {
|
||||||
|
divine_unload((struct empobj *)land, EF_LAND, land->lnd_land);
|
||||||
land->lnd_land = -1;
|
land->lnd_land = -1;
|
||||||
|
}
|
||||||
|
divine_load((struct empobj *)land, EF_SHIP, arg);
|
||||||
land->lnd_ship = arg;
|
land->lnd_ship = arg;
|
||||||
break;
|
break;
|
||||||
case 'Y':
|
case 'Y':
|
||||||
if (arg < -1 || arg >= ef_nelem(EF_LAND))
|
if (arg < -1 || arg >= ef_nelem(EF_LAND))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (arg >= 0 && arg != land->lnd_land)
|
if (arg == land->lnd_land) {
|
||||||
|
pr("Land unit of %s unchanged\n", prland(land));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
divine_unload((struct empobj *)land, EF_LAND, land->lnd_land);
|
||||||
|
if (arg >= 0) {
|
||||||
|
divine_unload((struct empobj *)land, EF_SHIP, land->lnd_ship);
|
||||||
land->lnd_ship = -1;
|
land->lnd_ship = -1;
|
||||||
|
}
|
||||||
|
divine_load((struct empobj *)land, EF_LAND, arg);
|
||||||
land->lnd_land = arg;
|
land->lnd_land = arg;
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
|
@ -975,15 +991,31 @@ edit_plane(struct plnstr *plane, char *key, char *p)
|
||||||
case 's':
|
case 's':
|
||||||
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
|
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (arg >= 0 && arg != plane->pln_ship)
|
if (arg == plane->pln_ship) {
|
||||||
|
pr("Ship of %s unchanged\n", prplane(plane));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
divine_unload((struct empobj *)plane, EF_SHIP, plane->pln_ship);
|
||||||
|
if (arg >= 0) {
|
||||||
|
divine_unload((struct empobj *)plane, EF_LAND, plane->pln_land);
|
||||||
plane->pln_land = -1;
|
plane->pln_land = -1;
|
||||||
|
}
|
||||||
|
divine_load((struct empobj *)plane, EF_SHIP, arg);
|
||||||
plane->pln_ship = arg;
|
plane->pln_ship = arg;
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
if (arg < -1 || arg >= ef_nelem(EF_LAND))
|
if (arg < -1 || arg >= ef_nelem(EF_LAND))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (arg >= 0 && arg != plane->pln_land)
|
if (arg == plane->pln_land) {
|
||||||
|
pr("Land unit of %s unchanged\n", prplane(plane));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
divine_unload((struct empobj *)plane, EF_LAND, plane->pln_land);
|
||||||
|
if (arg >= 0) {
|
||||||
|
divine_unload((struct empobj *)plane, EF_SHIP, plane->pln_ship);
|
||||||
plane->pln_ship = -1;
|
plane->pln_ship = -1;
|
||||||
|
}
|
||||||
|
divine_load((struct empobj *)plane, EF_LAND, arg);
|
||||||
plane->pln_land = arg;
|
plane->pln_land = arg;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
|
|
|
@ -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.
|
* Report deity giving/taking commodities to/from WHOM.
|
||||||
* Give AMT of IP in PLACE.
|
* Give AMT of IP in PLACE.
|
||||||
|
|
|
@ -1201,23 +1201,33 @@
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit p 2 s -1 s 9999
|
Play#0 input edit p 2 s -1 s 9999
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
Play#0 output Play#0 1 Ship of f1 Sopwith Camel #2 unchanged
|
||||||
Play#0 output Play#0 1 Usage: edit <country|land|ship|plane|unit> <NAT|SECT|SHIP|PLANE|LAND> [<KEY> <VALUE>]...
|
Play#0 output Play#0 1 Usage: edit <country|land|ship|plane|unit> <NAT|SECT|SHIP|PLANE|LAND> [<KEY> <VALUE>]...
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit p 3 s 3
|
Play#0 input edit p 3 s 3
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #3 loaded onto ship #3
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit p 4 s 4 y 4
|
Play#0 input edit p 4 s 4 y 4
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #4 loaded onto ship #4
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #4 unloaded from ship #4
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #4 loaded onto land #4
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit u 2 S -1 S 9999
|
Play#0 input edit u 2 S -1 S 9999
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
Play#0 output Play#0 1 Ship of sup supply #2 unchanged
|
||||||
Play#0 output Play#0 1 Usage: edit <country|land|ship|plane|unit> <NAT|SECT|SHIP|PLANE|LAND> [<KEY> <VALUE>]...
|
Play#0 output Play#0 1 Usage: edit <country|land|ship|plane|unit> <NAT|SECT|SHIP|PLANE|LAND> [<KEY> <VALUE>]...
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit u 3 S 3
|
Play#0 input edit u 3 S 3
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
Play#0 output Play#0 1 sup supply #3 loaded onto ship #3
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit u 4 S 4 Y 4
|
Play#0 input edit u 4 S 4 Y 4
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
Play#0 output Play#0 1 sup supply #4 loaded onto ship #4
|
||||||
|
Play#0 output Play#0 1 sup supply #4 unloaded from ship #4
|
||||||
|
Play#0 output Play#0 1 sup supply #4 loaded onto land #4
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
Play#0 input edit s 0
|
Play#0 input edit s 0
|
||||||
Play#0 command edit
|
Play#0 command edit
|
||||||
|
@ -1293,6 +1303,7 @@
|
||||||
Play#0 input m 2
|
Play#0 input m 2
|
||||||
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
||||||
Play#0 input y -1
|
Play#0 input y -1
|
||||||
|
Play#0 output Play#0 1 Land unit of f1 Sopwith Camel #0 unchanged
|
||||||
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
||||||
Play#0 input
|
Play#0 input
|
||||||
Play#0 output Play#0 1 POGO (#0) f1 Sopwith Camel #0
|
Play#0 output Play#0 1 POGO (#0) f1 Sopwith Camel #0
|
||||||
|
@ -1320,6 +1331,7 @@
|
||||||
Play#0 input M 2
|
Play#0 input M 2
|
||||||
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
||||||
Play#0 input Y -1
|
Play#0 input Y -1
|
||||||
|
Play#0 output Play#0 1 Land unit of sup supply #0 unchanged
|
||||||
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
Play#0 output Play#0 4 %c xxxxx -- thing value :
|
||||||
Play#0 input
|
Play#0 input
|
||||||
Play#0 output Play#0 1 POGO (#0) sup supply #0
|
Play#0 output Play#0 1 POGO (#0) sup supply #0
|
||||||
|
@ -1683,6 +1695,14 @@
|
||||||
Play#0 output Play#0 1 POGO gave you 50 military in cs cargo ship (#5)
|
Play#0 output Play#0 1 POGO gave you 50 military in cs cargo ship (#5)
|
||||||
Play#0 output Play#0 1 POGO gave you 25 military in sup supply #4
|
Play#0 output Play#0 1 POGO gave you 25 military in sup supply #4
|
||||||
Play#0 output Play#0 1 POGO gave you 25 military in sup supply #5
|
Play#0 output Play#0 1 POGO gave you 25 military in sup supply #5
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #3 loaded onto ship #3 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #4 loaded onto ship #4 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #4 unloaded from ship #4 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 f1 Sopwith Camel #4 loaded onto land #4 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 sup supply #3 loaded onto ship #3 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 sup supply #4 loaded onto ship #4 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 sup supply #4 unloaded from ship #4 by an act of POGO!
|
||||||
|
Play#0 output Play#0 1 sup supply #4 loaded onto land #4 by an act of POGO!
|
||||||
Play#0 output Play#0 1 Military reserves changed from 0 to 2147483647 by an act of POGO
|
Play#0 output Play#0 1 Military reserves changed from 0 to 2147483647 by an act of POGO
|
||||||
Play#0 output Play#0 1 Money changed from 0 to 2147483647 by an act of POGO
|
Play#0 output Play#0 1 Money changed from 0 to 2147483647 by an act of POGO
|
||||||
Play#0 output Play#0 6 0 640
|
Play#0 output Play#0 6 0 640
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue