bridgefall: Fix loss of bridge support with EASY_BRIDGES off

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>
This commit is contained in:
Markus Armbruster 2014-01-17 20:54:27 +01:00
parent 292bfac797
commit 4824648978
Notes: Markus Armbruster 2015-03-02 08:06:20 +01:00
Closes BUG#36.
4 changed files with 14 additions and 13 deletions

View file

@ -94,11 +94,6 @@ bridgefall(struct sctstr *sp)
nnx = nx + diroff[j][0]; nnx = nx + diroff[j][0];
nny = ny + diroff[j][1]; nny = ny + diroff[j][1];
getsect(nnx, nny, &bh_sect); 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 /* With EASY_BRIDGES, it just has to be next to any
land */ land */
if (opt_EASY_BRIDGES) { if (opt_EASY_BRIDGES) {
@ -106,6 +101,13 @@ bridgefall(struct sctstr *sp)
bh_sect.sct_type != SCT_BSPAN) bh_sect.sct_type != SCT_BSPAN)
break; 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) { if (j > 6) {
knockdown(&sect); knockdown(&sect);

View file

@ -13,14 +13,12 @@ desi 1,1 #
fire se 2,0 -1,3 fire se 2,0 -1,3
| tower falls | tower falls
| span -2,2 falls, because its other head is damaged | 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 fire se 2,0 -3,1
| trigger a bulletin as a separator | trigger a bulletin as a separator
fire se 2,0 8,2 fire se 2,0 8,2
| head damaged | head damaged
| span -1,-1 falls, because its only support is gone | span -1,-1 falls, because its only support is gone
| span 0,2 falls, because its other head is damaged | span 0,2 falls, because its other head is damaged
| BUG: doesn't fall
fire se 2,0 1,1 fire se 2,0 1,1
| trigger a bulletin as a separator | trigger a bulletin as a separator
fire se 2,0 8,2 fire se 2,0 8,2

View 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 -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 -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 0 -1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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 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 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
config lost config lost
timestamp owner type id x y timestamp owner type id x y
0 2 0 0 -2 2 0 2 0 0 -1 1
0 1 0 0 3 1 0 1 0 0 3 1
/config /config
config realm config realm

View file

@ -199,7 +199,7 @@
Play#0 output Play#0 1 -1 . . . . . # = . . . -1 Play#0 output Play#0 1 -1 . . . . . # = . . . -1
Play#0 output Play#0 1 0 . . . . . c f . @ = 0 Play#0 output Play#0 1 0 . . . . . c f . @ = 0
Play#0 output Play#0 1 1 . . . . . # . . . . 1 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 3 . . . . # . # . . . 3
Play#0 output Play#0 1 4 . . . . . . . . . . 4 Play#0 output Play#0 1 4 . . . . . . . . . . 4
Play#0 output Play#0 1 1---------0000000000 Play#0 output Play#0 1 1---------0000000000
@ -224,8 +224,8 @@
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 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 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 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 0 -2,2 . 0% 0 .. .. 0 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 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 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 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 0 1,3 . 0% 0 .. .. 0 0 0 0 0% 0 0 1
@ -258,10 +258,11 @@
Play#0 output Play#0 1 Crumble... SCREEEECH! Splash! Bridge falls at 1,3! 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 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 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 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 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 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 output Play#0 6 0 640
Play#0 input ctld Play#0 input ctld
Play#0 output Play#0 1 Bye-bye Play#0 output Play#0 1 Bye-bye