From eb60b38a261d994b281cebc276e6357ef41d18a2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 26 Jan 2013 23:18:01 +0100 Subject: [PATCH] swapsector: Notify affected sector owners Send bulletins, like edit does. Signed-off-by: Markus Armbruster --- src/lib/commands/swap.c | 13 ++++++++++++- tests/actofgod/journal.log | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/commands/swap.c b/src/lib/commands/swap.c index 614c72f25..9966cd4e2 100644 --- a/src/lib/commands/swap.c +++ b/src/lib/commands/swap.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Ken Stevens, 1995 - * Markus Armbruster, 2006-2010 + * Markus Armbruster, 2006-2013 */ #include @@ -46,6 +46,8 @@ swaps(void) struct sctstr secta, sectb, tmp; char buf[1024]; char *p; + int i; + natid to; if (!(p = getstarg(player->argp[1], "First sector : ", buf)) || !sarg_xy(p, §a.sct_x, §a.sct_y) || @@ -61,6 +63,15 @@ swaps(void) return RET_FAIL; if (!check_sect_ok(§a) || !check_sect_ok(§b)) return RET_FAIL; + for (i = 0; i <= (secta.sct_own != sectb.sct_own); i++) { + to = i == 0 ? secta.sct_own : sectb.sct_own; + if (to && to != player->cnum) + wu(0, to, + "Sector %s swapped with %s by an act of %s!\n", + xyas(secta.sct_x, secta.sct_y, to), + xyas(sectb.sct_x, sectb.sct_y, to), + cname(player->cnum)); + } tmp = secta; /* change the location of secta to that of sectb */ secta.sct_x = sectb.sct_x; diff --git a/tests/actofgod/journal.log b/tests/actofgod/journal.log index a768be075..df9dc3d30 100644 --- a/tests/actofgod/journal.log +++ b/tests/actofgod/journal.log @@ -1617,6 +1617,7 @@ 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 5,7 given to you by an act of POGO! Play#0 output Play#0 1 Sector 11,7 given to you by an act of POGO! + Play#0 output Play#0 1 Sector -2,2 swapped with 2,-2 by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#2) given to you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #2 given to you by an act of POGO! Play#0 output Play#0 1 sup supply #2 given to you by an act of POGO! @@ -1630,6 +1631,7 @@ Play#0 output Play#0 1 Sector 3,-7 given to you by an act of POGO! Play#0 output Play#0 1 Old owner of 1,-3 changed from 3 (#3) to 1 (#1) by an act of POGO Play#0 output Play#0 1 Old owner of 3,-3 changed from 3 (#3) to 1 (#1) by an act of POGO + Play#0 output Play#0 1 Sector -2,2 swapped with 2,-2 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! -- 2.43.0