]> git.pond.sub.org Git - empserver/commitdiff
setsector: Don't disclose number of landmines to occupier
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 21 Jan 2013 20:44:51 +0000 (21:44 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 6 Jun 2013 17:55:00 +0000 (19:55 +0200)
When the deity sets the number of mines with setsector, the sector
owner (if any) is told the resulting number of mines.  Even for
occupied sectors, where mines belong to the old owner, and thus
shouldn't be disclosed.  Oops.

Fix setsector not to tell the sector owner anything then.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/setsect.c
tests/actofgod/actofgod.xdump
tests/actofgod/geninput.pl
tests/actofgod/journal.log

index d78e8c40348e24f3b0058f5f10b09d34858f863b..129d2230cbe76b184703479dd6cc33629383b2e0 100644 (file)
@@ -145,8 +145,14 @@ setsector(void)
                current = sect.sct_mines;
                current += amt;
                current = LIMIT_TO(current, 0, MINES_MAX);
-               if (sect.sct_own != 0)
-                   resnoise(&sect, "Mines", sect.sct_mines, current);
+               if (sect.sct_own != 0) {
+                   if (sect.sct_own == sect.sct_oldown)
+                       resnoise(&sect, "Mines", sect.sct_mines, current);
+                   else
+                       pr("Mines of %s changed from %d to %d\n",
+                          xyas(sect.sct_x, sect.sct_y, player->cnum),
+                          sect.sct_mines, current);
+               }
                sect.sct_mines = current;
                break;
            case 'o':
index 6b77dc8f911b9ee63721a1a086513bcd2b32afeb..bb47fc258c091512c540ff343e6bb13278ef11be 100644 (file)
@@ -156,8 +156,8 @@ owner xloc yloc des effic mobil off loyal terr0 terr1 terr2 terr3 dterr xdist yd
 0 -6 -4 4 0 0 0 0 0 0 0 0 0 -6 -4 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
 0 -4 -4 4 0 0 0 0 0 0 0 0 0 -4 -4 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
 3 7 -3 4 0 0 0 0 0 0 0 0 0 7 -3 0 0 100 0 4 0 0 0 0 0 3 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
 3 9 -3 4 0 0 0 0 0 0 0 0 0 9 -3 0 0 100 0 4 0 0 0 0 0 3 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
index 7433b804b6ccbc127cd52e34bff932008eabb34a..893505f3dfd4826dc064cbb30cad1469de40606b 100755 (executable)
@@ -190,6 +190,11 @@ sect_int(
     ['d', 0, 100],
 );
 
+# special case: mines in occupied sector
+setsect('1:3,-3', 'ol', 1);
+setsect('1,-3', 'mi', 1);
+edit('sect', '3,-3', 'M', 1);
+
 # dist
 edit('sect', '2,4', 'D', '4,4');
 edit('sect', '4,4', 'D', '4,4');
index af7b1ca344e7e756dba6f64ff837dda0031d59d1..eed4ad3545871cf8fb8b14a033e916f8208065ec 100644 (file)
     Play#0 command edit
     Play#0 output Play#0 1 Defense percentage of 7,1 changed from 0 to 100
     Play#0 output Play#0 6 0 640
+    Play#0 input setsect ol 1:3,-3 1
+    Play#0 command setsector
+    Play#0 output Play#0 1 Old owner of 1,-3 changed from 3 (#3) to 1 (#1).
+    Play#0 output Play#0 1 Old owner of 3,-3 changed from 3 (#3) to 1 (#1).
+    Play#0 output Play#0 6 0 640
+    Play#0 input setsect mi 1,-3 1
+    Play#0 command setsector
+    Play#0 output Play#0 1 Mines of 1,-3 changed from 0 to 1
+    Play#0 output Play#0 6 0 640
+    Play#0 input edit l 3,-3 M 1
+    Play#0 command edit
+    Play#0 output Play#0 1 Mines changed to 1
+    Play#0 output Play#0 6 0 640
     Play#0 input edit l 2,4 D 4,4
     Play#0 command edit
     Play#0 output Play#0 1 Distribution location for sector 2,4 changed from 2,4 to 4,4