diff --git a/include/actofgod.h b/include/actofgod.h
new file mode 100644
index 00000000..a28030a5
--- /dev/null
+++ b/include/actofgod.h
@@ -0,0 +1,42 @@
+/*
+ * Empire - A multi-player, client/server Internet based war game.
+ * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Ken Stevens, Steve McClure, Markus Armbruster
+ *
+ * Empire is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * ---
+ *
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
+ *
+ * ---
+ *
+ * actofgod.h: Deity meddling
+ *
+ * Known contributors to this file:
+ * Markus Armbruster, 2013
+ */
+
+#ifndef ACTOFGOD_H
+#define ACTOFGOD_H
+
+#include "item.h"
+#include "nat.h"
+
+extern void report_god_takes(char *, char *, natid);
+extern void report_god_gives(char *, char *, natid);
+
+#endif
diff --git a/include/prototypes.h b/include/prototypes.h
index 9548c146..517a142f 100644
--- a/include/prototypes.h
+++ b/include/prototypes.h
@@ -384,6 +384,8 @@ extern void stop_service(void);
/*
* src/lib/subs/ *.c
*/
+/* actofgod.c */
+/* in actofgod.h */
/* askyn.c */
extern int confirm(char *);
extern int askyn(char *);
diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c
index fd286a8a..519a271f 100644
--- a/src/lib/commands/edit.c
+++ b/src/lib/commands/edit.c
@@ -38,6 +38,7 @@
#include
#include
+#include "actofgod.h"
#include "commands.h"
#include "item.h"
#include "land.h"
@@ -421,6 +422,7 @@ edit_sect(struct sctstr *sect, char *key, int arg, char *p)
{
coord newx, newy;
int new;
+ struct sctstr newsect;
switch (*key) {
case 'o':
@@ -431,21 +433,13 @@ edit_sect(struct sctstr *sect, char *key, int arg, char *p)
prnatid(sect->sct_own), prnatid(arg));
if (arg == sect->sct_own)
break;
- if (sect->sct_own && sect->sct_own != player->cnum) {
- wu(0, sect->sct_own,
- "Sector %s taken from you by an act of %s!\n",
- xyas(sect->sct_x, sect->sct_y, sect->sct_own),
- cname(player->cnum));
- }
- benefit(sect->sct_own, -1);
+ report_god_takes("Sector ",
+ xyas(sect->sct_x, sect->sct_y, sect->sct_own),
+ sect->sct_own);
+ report_god_gives("Sector ",
+ xyas(sect->sct_x, sect->sct_y, arg),
+ arg);
sect->sct_own = arg;
- if (arg && arg != player->cnum) {
- wu(0, arg,
- "Sector %s given to you by an act of %s!\n",
- xyas(sect->sct_x, sect->sct_y, arg),
- cname(player->cnum));
- }
- benefit(arg, 1);
break;
case 'O':
if (arg < 0 || arg >= MAXNOC)
@@ -553,6 +547,14 @@ edit_sect(struct sctstr *sect, char *key, int arg, char *p)
case 'L':
if (!sarg_xy(p, &newx, &newy))
return RET_SYN;
+ getsect(newx, newy, &newsect);
+ pr("Sector %s duplicated to %s\n",
+ xyas(sect->sct_x, sect->sct_y, player->cnum),
+ xyas(newx, newy, player->cnum));
+ report_god_takes("Sector ", xyas(newx, newy, newsect.sct_own),
+ newsect.sct_own);
+ report_god_gives("Sector ", xyas(newx, newy, sect->sct_own),
+ sect->sct_own);
sect->sct_x = newx;
sect->sct_y = newy;
ef_set_uid(EF_SECTOR, §, XYOFFSET(newx, newy));
diff --git a/src/lib/subs/actofgod.c b/src/lib/subs/actofgod.c
new file mode 100644
index 00000000..1a189bb3
--- /dev/null
+++ b/src/lib/subs/actofgod.c
@@ -0,0 +1,67 @@
+/*
+ * Empire - A multi-player, client/server Internet based war game.
+ * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Ken Stevens, Steve McClure, Markus Armbruster
+ *
+ * Empire is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * ---
+ *
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
+ *
+ * ---
+ *
+ * actofgod.c: Deity meddling subroutines
+ *
+ * Known contributors to this file:
+ * Markus Armbruster, 2013
+ */
+
+#include
+
+#include "actofgod.h"
+#include "file.h"
+#include "news.h"
+#include "optlist.h"
+#include "player.h"
+#include "prototypes.h"
+
+static void
+nreport_divine_aid(natid whom, int goodness)
+{
+ if (opt_GODNEWS && getnatp(whom)->nat_stat != STAT_GOD && goodness)
+ nreport(player->cnum, goodness > 0 ? N_AIDS : N_HURTS, whom, 1);
+}
+
+void
+report_god_takes(char *prefix, char *what, natid from)
+{
+ if (from && from != player->cnum) {
+ wu(0, from, "%s%s taken from you by an act of %s!\n",
+ prefix, what, cname(player->cnum));
+ nreport_divine_aid(from, -1);
+ }
+}
+
+void
+report_god_gives(char *prefix, char *what, natid to)
+{
+ if (to && to != player->cnum) {
+ wu(0, to, "%s%s given to you by an act of %s!\n",
+ prefix, what, cname(player->cnum));
+ nreport_divine_aid(to, 1);
+ }
+}
diff --git a/tests/actofgod/actofgod.xdump b/tests/actofgod/actofgod.xdump
index c24b973e..4275ec7e 100644
--- a/tests/actofgod/actofgod.xdump
+++ b/tests/actofgod/actofgod.xdump
@@ -360,12 +360,15 @@ actor action victim times duration time
0 42 3 49 0 0
0 42 2 38 0 0
0 42 1 39 0 0
+0 44 3 1 0 0
+0 43 3 1 0 0
0 44 1 19 0 0
0 43 2 1 0 0
+0 44 3 2 0 0
+0 43 3 2 0 0
0 43 1 54 0 0
0 42 1 4 0 0
1 45 0 1 0 0
-0 43 3 1 0 0
/config
config treaty
uid cna cnb status acond bcond exp
diff --git a/tests/actofgod/journal.log b/tests/actofgod/journal.log
index 55b93449..58f99e10 100644
--- a/tests/actofgod/journal.log
+++ b/tests/actofgod/journal.log
@@ -127,9 +127,11 @@
Play#0 output Play#0 6 0 640
Play#0 input edit l 1,7 L 1,-7
Play#0 command edit
+ Play#0 output Play#0 1 Sector 1,7 duplicated to 1,-7
Play#0 output Play#0 6 0 640
Play#0 input edit l 3,-7 L 3,-7 L 1,0
Play#0 command edit
+ Play#0 output Play#0 1 Sector 3,-7 duplicated to 3,-7
Play#0 output Play#0 1 Usage: edit [ ]...
Play#0 output Play#0 6 0 640
Play#0 input edit l 1,1 e 0
@@ -1595,6 +1597,9 @@
Play#0 command read
Play#0 output Play#0 1
Play#0 output Play#0 1 > BULLETIN from POGO, (#0) dated Thu Jan 1 00:00:00 1970
+ Play#0 output Play#0 1 Sector 1,-7 taken from you by an act of POGO!
+ Play#0 output Play#0 1 Sector 3,-7 taken from you by an act of POGO!
+ Play#0 output Play#0 1 Sector 3,-7 given to you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#0) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#1) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#2) taken from you by an act of POGO!