setsector setresource: Print effect for unowned sectors, too

The "changed from" message has always been suppressed for unowned
sectors.  Makes no sense.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-23 07:52:45 +01:00
parent c900ef8f1e
commit 985ac03fbe
5 changed files with 34 additions and 29 deletions

View file

@ -70,28 +70,23 @@ setres(void)
return RET_FAIL;
switch (char0) {
case 'i':
if (sect.sct_own != 0)
resnoise(&sect, "Iron ore content", sect.sct_min, amt);
resnoise(&sect, "Iron ore content", sect.sct_min, amt);
sect.sct_min = (unsigned char)amt;
break;
case 'g':
if (sect.sct_own != 0)
resnoise(&sect, "Gold content", sect.sct_gmin, amt);
resnoise(&sect, "Gold content", sect.sct_gmin, amt);
sect.sct_gmin = (unsigned char)amt;
break;
case 'o':
if (sect.sct_own != 0)
resnoise(&sect, "Oil content", sect.sct_oil, amt);
resnoise(&sect, "Oil content", sect.sct_oil, amt);
sect.sct_oil = (unsigned char)amt;
break;
case 'f':
if (sect.sct_own != 0)
resnoise(&sect, "Fertility content", sect.sct_fertil, amt);
resnoise(&sect, "Fertility content", sect.sct_fertil, amt);
sect.sct_fertil = (unsigned char)amt;
break;
case 'u':
if (sect.sct_own != 0)
resnoise(&sect, "Uranium content", sect.sct_uran, amt);
resnoise(&sect, "Uranium content", sect.sct_uran, amt);
sect.sct_uran = (unsigned char)amt;
break;
default:

View file

@ -75,16 +75,14 @@ setsector(void)
current = sect.sct_min;
current += amt;
current = LIMIT_TO(current, 0, 100);
if (sect.sct_own != 0)
resnoise(&sect, "Iron ore content", sect.sct_min, current);
resnoise(&sect, "Iron ore content", sect.sct_min, current);
sect.sct_min = (unsigned char)current;
break;
case 'g':
current = sect.sct_gmin;
current += amt;
current = LIMIT_TO(current, 0, 100);
if (sect.sct_own != 0)
resnoise(&sect, "Gold content", sect.sct_gmin, current);
resnoise(&sect, "Gold content", sect.sct_gmin, current);
sect.sct_gmin = (unsigned char)current;
break;
case 'o':
@ -93,8 +91,7 @@ setsector(void)
current = sect.sct_oil;
current += amt;
current = LIMIT_TO(current, 0, 100);
if (sect.sct_own != 0)
resnoise(&sect, "Oil content", sect.sct_oil, current);
resnoise(&sect, "Oil content", sect.sct_oil, current);
sect.sct_oil = (unsigned char)current;
break;
case 'w':
@ -145,14 +142,12 @@ setsector(void)
current = sect.sct_mines;
current += amt;
current = LIMIT_TO(current, 0, MINES_MAX);
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);
}
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':
@ -188,16 +183,14 @@ setsector(void)
current = sect.sct_fertil;
current += amt;
current = LIMIT_TO(current, 0, 100);
if (sect.sct_own != 0)
resnoise(&sect, "Fertility content", sect.sct_fertil, current);
resnoise(&sect, "Fertility content", sect.sct_fertil, current);
sect.sct_fertil = (unsigned char)current;
break;
case 'u':
current = sect.sct_uran;
current += amt;
current = LIMIT_TO(current, 0, 100);
if (sect.sct_own != 0)
resnoise(&sect, "Uranium content", sect.sct_uran, current);
resnoise(&sect, "Uranium content", sect.sct_uran, current);
sect.sct_uran = (unsigned char)current;
break;
default:

View file

@ -191,7 +191,7 @@ owner xloc yloc des effic mobil off loyal terr0 terr1 terr2 terr3 dterr xdist yd
0 -7 -1 4 0 0 0 0 0 0 0 0 0 -7 -1 0 0 0 1 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 -5 -1 4 0 0 0 0 0 0 0 0 0 -5 -1 0 0 0 1 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 -3 -1 4 0 0 0 0 0 0 0 0 0 -3 -1 0 0 0 1 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 -1 -1 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 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 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
0 -1 -1 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 1 0 50 50 50 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
/config
config ship
uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet xstart xend ystart yend cargostart(0) cargostart(1) cargostart(2) cargostart(3) cargostart(4) cargostart(5) cargoend(0) cargoend(1) cargoend(2) cargoend(3) cargoend(4) cargoend(5) amtstart(0) amtstart(1) amtstart(2) amtstart(3) amtstart(4) amtstart(5) amtend(0) amtend(1) amtend(2) amtend(3) amtend(4) amtend(5) autonav civil milit shell gun petrol iron dust bar food oil lcm hcm uw rad pstage ptime access mquota path follow name xbuilt ybuilt builder rflags rpath

View file

@ -190,6 +190,11 @@ sect_int(
['d', 0, 100],
);
# special case: unowned sector
edit('sect', '-1,-1', 'i', 50);
setres('-1,-1', 'g', 50);
setsect('-1,-1', 'f', 50);
# special case: mines in occupied sector
setsect('1:3,-3', 'ol', 1);
setsect('1,-3', 'mi', 1);

View file

@ -680,6 +680,18 @@
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 edit l -1,-1 i 50
Play#0 command edit
Play#0 output Play#0 1 Iron ore content of -1,-1 changed from 0 to 50
Play#0 output Play#0 6 0 640
Play#0 input setres g -1,-1 50
Play#0 command setresource
Play#0 output Play#0 1 Gold content of -1,-1 changed from 0 to 50
Play#0 output Play#0 6 0 640
Play#0 input setsect f -1,-1 50
Play#0 command setsector
Play#0 output Play#0 1 Fertility content of -1,-1 changed from 0 to 50
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).