]> git.pond.sub.org Git - empserver/commitdiff
bridgefall: Fix loss of bridge support with EASY_BRIDGES off
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 17 Jan 2014 19:54:27 +0000 (20:54 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 16 Feb 2014 11:00:18 +0000 (12:00 +0100)
With EASY_BRIDGES off, bridge spans need to be next to a bridge tower
or a bridge head that is at least 20% efficient to remain standing.

When a bridge tower or head gets damaged below 20%, adjacent spans may
lose support.  Bug: they don't fall when they're next to another
bridge head below 20%.

Has always been broken.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/bridgefall.c
tests/bridgefall/easy-off/02-1
tests/bridgefall/final.xdump
tests/bridgefall/journal.log

index b1174a147c035b7b96f96a52b8d9d32328ca8456..ffc79f98d1ed78e191834601cfa8fba2ecec3142 100644 (file)
@@ -94,11 +94,6 @@ bridgefall(struct sctstr *sp)
            nnx = nx + diroff[j][0];
            nny = ny + diroff[j][1];
            getsect(nnx, nny, &bh_sect);
-           if (bh_sect.sct_type == SCT_BHEAD &&
-               bh_sect.sct_newtype == SCT_BHEAD)
-               break;
-           if (bh_sect.sct_type == SCT_BTOWER)
-               break;
            /* With EASY_BRIDGES, it just has to be next to any
               land */
            if (opt_EASY_BRIDGES) {
@@ -106,6 +101,13 @@ bridgefall(struct sctstr *sp)
                    bh_sect.sct_type != SCT_BSPAN)
                    break;
            }
+           if (bh_sect.sct_effic < 20)
+               continue;
+           if (bh_sect.sct_type == SCT_BHEAD &&
+               bh_sect.sct_newtype == SCT_BHEAD)
+               break;
+           if (bh_sect.sct_type == SCT_BTOWER)
+               break;
        }
        if (j > 6) {
            knockdown(&sect);
index 579f8833a0a44febfd3d1b0002fe97455d734d2b..4e6485dc5859ba02fa6b93836bcec5e71c046a5b 100644 (file)
@@ -13,14 +13,12 @@ desi 1,1 #
 fire se 2,0 -1,3
 | tower falls
 | span -2,2 falls, because its other head is damaged
-| BUG: doesn't fall now, falls on its next write
 fire se 2,0 -3,1
 | trigger a bulletin as a separator
 fire se 2,0 8,2
 | head damaged
 | span -1,-1 falls, because its only support is gone
 | span 0,2 falls, because its other head is damaged
-| BUG: doesn't fall
 fire se 2,0 1,1
 | trigger a bulletin as a separator
 fire se 2,0 8,2
index b6e3f09d97cef15b44b80103bce944da2f6abecf..784c0de8bd7f60fc3b4f2dc7071c155ba0a90f47 100644 (file)
@@ -20,7 +20,7 @@ owner xloc yloc des effic mobil off loyal terr0 terr1 terr2 terr3 dterr xdist yd
 0 -5 1 0 0 0 0 0 0 0 0 0 0 -5 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 -3 1 0 0 0 0 0 0 0 0 0 0 -3 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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
-2 0 2 28 100 0 0 0 0 0 0 0 0 0 2 0 0 0 1 28 0 0 0 0 0 2 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 healthy 0 0 0 0 0 0 0 0
+0 0 2 0 0 0 0 0 0 0 0 0 0 0 2 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 2 2 0 0 0 0 0 0 0 0 0 0 2 2 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 4 2 0 0 0 0 0 0 0 0 0 0 4 2 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 6 2 0 0 0 0 0 0 0 0 0 0 6 2 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
@@ -233,7 +233,7 @@ uid owner type amount price maxbidder markettime xbuy ybuy xsell ysell
 /config
 config lost
 timestamp owner type id x y
-0 2 0 0 -2 2
+0 2 0 0 -1 1
 0 1 0 0 3 1
 /config
 config realm
index 3c2023ef01e68ba5020e20e34d01cbfa200b3671..a1f9fe69f11ade63c0522889109c0fc9a76586bf 100644 (file)
     Play#0 output Play#0 1   -1  . . . . . # = . . . -1
     Play#0 output Play#0 1    0 . . . . . c f . @ =  0
     Play#0 output Play#0 1    1  . . . . . # . . . . 1
-    Play#0 output Play#0 1    2 . . . . = = . . . -  2
+    Play#0 output Play#0 1    2 . . . . . . . . . -  2
     Play#0 output Play#0 1    3  . . . . # . # . . . 3
     Play#0 output Play#0 1    4 . . . . . . . . . .  4
     Play#0 output Play#0 1      1---------0000000000
     Play#0 output Play#0 1   0   -1,1    .    0%       0 .. ..        0    0    0    0   0%    0    0   1
     Play#0 output Play#0 1   1    1,1    #   17%       0 .. ..       82    0    0    0   0%    0    0   1
     Play#0 output Play#0 1   0    3,1    .    0%       0 .. ..        0    0    0    0   0%    0    0   1
-    Play#0 output Play#0 1   2   -2,2    =  100%       0 .. ..      100    0    0    0   0%    0    0   1
-    Play#0 output Play#0 1   2    0,2    =  100%       0 .. ..      100    0    0    0   0%    0    0   1
+    Play#0 output Play#0 1   0   -2,2    .    0%       0 .. ..        0    0    0    0   0%    0    0   1
+    Play#0 output Play#0 1   0    0,2    .    0%       0 .. ..        0    0    0    0   0%    0    0   1
     Play#0 output Play#0 1   0    2,2    .    0%       0 .. ..        0    0    0    0   0%    0    0   1
     Play#0 output Play#0 1   2   -1,3    #   16%       0 .. ..       82    0    0    0   0%    0    0   1
     Play#0 output Play#0 1   0    1,3    .    0%       0 .. ..        0    0    0    0   0%    0    0   1
     Play#0 output Play#0 1 Crumble... SCREEEECH!  Splash! Bridge falls at 1,3!
     Play#0 output Play#0 1 Country #1 shelled sector -3,1 for 30 damage.
     Play#0 output Play#0 1 Crumble... SCREEEECH!  Splash! Bridge tower falls at -3,1!
+    Play#0 output Play#0 1 Crumble... SCREEEECH!  Splash! Bridge falls at -2,2!
     Play#0 output Play#0 1 Country #1 shelled sector 8,2 for 35 damage.
+    Play#0 output Play#0 1 Crumble... SCREEEECH!  Splash! Bridge falls at 0,2!
     Play#0 output Play#0 1 Crumble... SCREEEECH!  Splash! Bridge falls at -1,1!
     Play#0 output Play#0 1 Country #1 shelled sector 8,2 for 48 damage.
-    Play#0 output Play#0 1 Crumble... SCREEEECH!  Splash! Bridge falls at -2,2!
     Play#0 output Play#0 6 0 640
     Play#0 input ctld
     Play#0 output Play#0 1 Bye-bye