]> git.pond.sub.org Git - empserver/commitdiff
update: Don't let stopped ships produce
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 21 Jun 2016 19:59:30 +0000 (21:59 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:08:30 +0000 (20:08 +0200)
Ships fish and drill for oil even when stopped.  Fix that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/update/ship.c
tests/update/99-POGO
tests/update/final.xdump
tests/update/journal.log

index 27548a88b422237d4c65eeac0272d77d75ffaf4a..8319e4fe29c92049bf3f849e06d82dedaa098557 100644 (file)
@@ -126,7 +126,7 @@ upd_ship(struct shpstr *sp, int etus, struct bp *bp, int build)
            sectp = getsectp(sp->shp_x, sp->shp_y);
 
            /* produce oil */
-           if (budget->money >= 0
+           if (!sp->shp_off && budget->money >= 0
                && (mp->m_flags & M_OIL) && sectp->sct_type == SCT_WATER) {
                product = &pchr[dchr[SCT_OIL].d_prd];
                oil_gained = roundavg(total_work(100, etus,
@@ -152,7 +152,7 @@ upd_ship(struct shpstr *sp, int etus, struct bp *bp, int build)
                sp->shp_item[I_OIL] += oil_gained;
            }
            /* produce fish */
-           if (budget->money >= 0
+           if (!sp->shp_off && budget->money >= 0
                && (mp->m_flags & M_FOOD) && sectp->sct_type == SCT_WATER) {
                sp->shp_item[I_FOOD]
                    += roundavg(total_work(100, etus,
index e9f9c80508fe13b5b70c5a3cbd6e22ddbad733a9..9757f1678579a76bb3e24005ac9a2e90d42c8791 100644 (file)
@@ -127,13 +127,11 @@ read 0
 | 100 +40.5f with 100% eff 10 fert
 | 101 +405f with 100% eff 100 fert
 | 102 stopped
-|     BUG: produces anyway
 | 103 +243f with 60% eff
 | 104 +81f with 20% eff
 | 110 +5.14o 100% eff 10 ocont
 | 111 +51.4o with 100% eff 100 ocont
 | 112 stopped
-|     BUG: produces anyway
 | 113 +29.0o-29.3o with 60% eff 94-95 ocont
 | 114 +9.2-9.6o with 20% eff 91-93 ocont, 90-93 ocont left
 read 1
index e17cdfd2ba519be18d031bfb8b8a5a33328423ca..a5415a7876a7d36cea5529591d4a2de1f22afe31 100644 (file)
@@ -74,7 +74,7 @@ owner xloc yloc des effic mobil off loyal terr0 terr1 terr2 terr3 dterr xdist yd
 1 14 4 4 39 120 0 0 0 0 0 0 0 14 4 39 0 100 1 4 0 0 0 0 0 1 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 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 16 4 0 0 0 0 0 0 0 0 0 0 16 4 0 0 100 1 0 0 0 10 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 18 4 0 0 0 0 0 0 0 0 0 0 18 4 0 0 100 1 0 0 0 100 91 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 20 4 0 0 0 0 0 0 0 0 0 0 20 4 0 0 100 1 0 0 0 100 95 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 20 4 0 0 0 0 0 0 0 0 0 0 20 4 0 0 100 1 0 0 0 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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
 1 -16 4 10 100 120 0 0 0 0 0 0 0 -16 4 9 0 100 1 10 10 0 0 0 0 1 130 1 0 0 0 7 0 0 96 0 0 0 0 0 0 0 0 0 0 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
 1 -14 4 10 100 120 0 0 0 0 0 0 0 -14 4 0 0 100 0 10 100 0 0 0 0 1 130 1 0 0 0 78 0 0 97 0 0 0 0 0 0 0 0 0 0 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
 1 -12 4 10 69 120 0 0 0 0 0 0 0 -12 4 1 0 100 0 10 100 0 0 0 0 1 130 1 0 0 0 26 0 0 97 0 0 0 0 0 0 0 0 0 0 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
@@ -319,14 +319,14 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet civil
 97 1 14 6 2 40 90 0 20 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 100 1 16 4 0 100 90 0 20 0 0 none 0 "" 100 0 0 0 0 0 0 0 38 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 101 1 18 4 0 100 90 0 20 0 0 none 0 "" 100 0 0 0 0 0 0 0 412 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
-102 1 20 4 0 100 90 0 20 0 0 none 0 "" 100 0 0 0 0 0 0 0 412 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
+102 1 20 4 0 100 90 0 20 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 103 1 18 4 0 73 90 0 20 0 0 none 0 "" 100 0 0 0 0 0 0 0 250 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 104 1 18 4 0 33 90 0 20 0 0 none 0 "" 100 0 0 0 0 0 0 0 88 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 110 1 16 4 8 100 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 5 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 111 1 18 4 8 100 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 51 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
-112 1 20 4 8 100 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 51 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
-113 1 18 4 8 65 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 29 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
-114 1 18 4 8 25 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 10 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
+112 1 20 4 8 100 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 0 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
+113 1 18 4 8 65 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 30 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
+114 1 18 4 8 25 90 0 50 0 0 none 0 "" 100 0 0 0 0 0 0 0 7 9 0 0 0 0 healthy 0 0 "" 14 6 1 () ""
 149 0 0 0 0 0 0 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 0 0 0 () ""
 /config
 config plane
index 5c37bf29f0a63256d322bb0b7b692ef9b587aa29..b382b8111d5ab9fbb218286d39517d4fb2d4fd90 100644 (file)
     Play#0 output Play#0 1   1   97 cs   cargo ship    14,6        40%   0   0   0   0  0  0  0  0  90   20
     Play#0 output Play#0 1   1  100 fb   fishing boa   16,4       100% 100   0   0  38  0  0  0  0  90   20
     Play#0 output Play#0 1   1  101 fb   fishing boa   18,4       100% 100   0   0 412  0  0  0  0  90   20
-    Play#0 output Play#0 1   1  102 fb   fishing boa   20,4       100% 100   0   0 412  0  0  0  0  90   20
+    Play#0 output Play#0 1   1  102 fb   fishing boa   20,4       100% 100   0   0   7  0  0  0  0  90   20
     Play#0 output Play#0 1   1  103 fb   fishing boa   18,4        73% 100   0   0 250  0  0  0  0  90   20
     Play#0 output Play#0 1   1  104 fb   fishing boa   18,4        33% 100   0   0  88  0  0  0  0  90   20
     Play#0 output Play#0 1   1  110 od   oil derrick   16,4       100% 100   0   0   7  0  0  0  0  90   50
     Play#0 output Play#0 1  104 fb     18,4       33% 100   0   0   0   0   0   0   0   0   0   0   0   0
     Play#0 output Play#0 1  110 od     16,4      100% 100   0   0   0   0   0   0   0   0   5   0   0   0
     Play#0 output Play#0 1  111 od     18,4      100% 100   0   0   0   0   0   0   0   0  51   0   0   0
-    Play#0 output Play#0 1  112 od     20,4      100% 100   0   0   0   0   0   0   0   0  51   0   0   0
-    Play#0 output Play#0 1  113 od     18,4       65% 100   0   0   0   0   0   0   0   0  29   0   0   0
-    Play#0 output Play#0 1  114 od     18,4       25% 100   0   0   0   0   0   0   0   0  10   0   0   0
+    Play#0 output Play#0 1  112 od     20,4      100% 100   0   0   0   0   0   0   0   0   0   0   0   0
+    Play#0 output Play#0 1  113 od     18,4       65% 100   0   0   0   0   0   0   0   0  30   0   0   0
+    Play#0 output Play#0 1  114 od     18,4       25% 100   0   0   0   0   0   0   0   0   9   0   0   0
     Play#0 output Play#0 1 30 ships
     Play#0 output Play#0 6 0 640
     Play#0 input plane 0:31,0:15
     Play#0 output Play#0 1   1    4,4    a  100%    0    0  100   0    0
     Play#0 output Play#0 1   0   16,4    .    0%    0    0   10   9    0
     Play#0 output Play#0 1   0   18,4    .    0%    0    0  100  91    0
-    Play#0 output Play#0 1   0   20,4    .    0%    0    0  100  95    0
+    Play#0 output Play#0 1   0   20,4    .    0%    0    0  100 100    0
     Play#0 output Play#0 1 8 sectors
     Play#0 output Play#0 6 0 640
     Play#0 input reso * ?ocont>0
     Play#0 output Play#0 1   1   10,4    o  100%    0    0    0  92    0
     Play#0 output Play#0 1   0   16,4    .    0%    0    0   10   9    0
     Play#0 output Play#0 1   0   18,4    .    0%    0    0  100  91    0
-    Play#0 output Play#0 1   0   20,4    .    0%    0    0  100  95    0
+    Play#0 output Play#0 1   0   20,4    .    0%    0    0  100 100    0
     Play#0 output Play#0 1 5 sectors
     Play#0 output Play#0 6 0 640
     Play#0 input reso * ?uran>0