]> git.pond.sub.org Git - empserver/commitdiff
setsector setresource: Print effect for unowned sectors, too
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 23 Jan 2013 06:52:45 +0000 (07:52 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 6 Jun 2013 17:55:00 +0000 (19:55 +0200)
The "changed from" message has always been suppressed for unowned
sectors.  Makes no sense.

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

index 6e66143afc3e96d333195a0772ab503ac57e74f4..7d479003aba31eb1de2a991bfb2dcfe7b9a3c750 100644 (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:
index 129d2230cbe76b184703479dd6cc33629383b2e0..c1490ab307059c5b20dd7e64baca6064de6298c0 100644 (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:
index bb47fc258c091512c540ff343e6bb13278ef11be..343b92ebdd4a5c403db290458ee46981df83b502 100644 (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
index 893505f3dfd4826dc064cbb30cad1469de40606b..1abc1bd1b0ab7a8c2fbf69b980bea9824b2477a4 100755 (executable)
@@ -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);
index eed4ad3545871cf8fb8b14a033e916f8208065ec..5fe1e1ddc9dd34778b76b0f378dc534020671885 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 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).