extern void report_god_takes(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 *, ...)
ATTRIBUTE((format (printf, 5, 6)));
#define divine_sct_change_quiet(sp, name, change, ...) \
case 'S':
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
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;
+ }
+ divine_load((struct empobj *)land, EF_SHIP, arg);
land->lnd_ship = arg;
break;
case 'Y':
if (arg < -1 || arg >= ef_nelem(EF_LAND))
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;
+ }
+ divine_load((struct empobj *)land, EF_LAND, arg);
land->lnd_land = arg;
break;
case 'Z':
case 's':
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
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;
+ }
+ divine_load((struct empobj *)plane, EF_SHIP, arg);
plane->pln_ship = arg;
break;
case 'y':
if (arg < -1 || arg >= ef_nelem(EF_LAND))
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;
+ }
+ divine_load((struct empobj *)plane, EF_LAND, arg);
plane->pln_land = arg;
break;
case 'f':
}
}
+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.
Play#0 output Play#0 6 0 640
Play#0 input edit p 2 s -1 s 9999
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 6 0 640
Play#0 input edit p 3 s 3
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 input edit p 4 s 4 y 4
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 input edit u 2 S -1 S 9999
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 6 0 640
Play#0 input edit u 3 S 3
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 input edit u 4 S 4 Y 4
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 input edit s 0
Play#0 command edit
Play#0 input m 2
Play#0 output Play#0 4 %c xxxxx -- thing value :
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 input
Play#0 output Play#0 1 POGO (#0) f1 Sopwith Camel #0
Play#0 input M 2
Play#0 output Play#0 4 %c xxxxx -- thing value :
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 input
Play#0 output Play#0 1 POGO (#0) sup supply #0
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 #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 Money changed from 0 to 2147483647 by an act of POGO
Play#0 output Play#0 6 0 640