From 48246489788e8ad22c289031ff68f8027c347a6a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 17 Jan 2014 20:54:27 +0100 Subject: [PATCH] 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 --- src/lib/subs/bridgefall.c | 12 +++++++----- tests/bridgefall/easy-off/02-1 | 2 -- tests/bridgefall/final.xdump | 4 ++-- tests/bridgefall/journal.log | 9 +++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lib/subs/bridgefall.c b/src/lib/subs/bridgefall.c index b1174a147..ffc79f98d 100644 --- a/src/lib/subs/bridgefall.c +++ b/src/lib/subs/bridgefall.c @@ -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(§); diff --git a/tests/bridgefall/easy-off/02-1 b/tests/bridgefall/easy-off/02-1 index 579f8833a..4e6485dc5 100644 --- a/tests/bridgefall/easy-off/02-1 +++ b/tests/bridgefall/easy-off/02-1 @@ -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 diff --git a/tests/bridgefall/final.xdump b/tests/bridgefall/final.xdump index b6e3f09d9..784c0de8b 100644 --- a/tests/bridgefall/final.xdump +++ b/tests/bridgefall/final.xdump @@ -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 diff --git a/tests/bridgefall/journal.log b/tests/bridgefall/journal.log index 3c2023ef0..a1f9fe69f 100644 --- a/tests/bridgefall/journal.log +++ b/tests/bridgefall/journal.log @@ -199,7 +199,7 @@ 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 @@ -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 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 @@ -258,10 +258,11 @@ 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 -- 2.43.0