setsector: Don't disclose number of landmines to occupier

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>
This commit is contained in:
Markus Armbruster 2013-01-21 21:44:51 +01:00
parent 290a079b57
commit c900ef8f1e
4 changed files with 28 additions and 4 deletions

View file

@ -145,8 +145,14 @@ setsector(void)
current = sect.sct_mines; current = sect.sct_mines;
current += amt; current += amt;
current = LIMIT_TO(current, 0, MINES_MAX); current = LIMIT_TO(current, 0, MINES_MAX);
if (sect.sct_own != 0) if (sect.sct_own != 0) {
resnoise(&sect, "Mines", sect.sct_mines, current); 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; sect.sct_mines = current;
break; break;
case 'o': case 'o':

View 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 -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 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 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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 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

View file

@ -190,6 +190,11 @@ sect_int(
['d', 0, 100], ['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 # dist
edit('sect', '2,4', 'D', '4,4'); edit('sect', '2,4', 'D', '4,4');
edit('sect', '4,4', 'D', '4,4'); edit('sect', '4,4', 'D', '4,4');

View file

@ -680,6 +680,19 @@
Play#0 command edit 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 1 Defense percentage of 7,1 changed from 0 to 100
Play#0 output Play#0 6 0 640 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 input edit l 2,4 D 4,4
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 Distribution location for sector 2,4 changed from 2,4 to 4,4 Play#0 output Play#0 1 Distribution location for sector 2,4 changed from 2,4 to 4,4