From: Markus Armbruster Date: Wed, 7 Jan 2015 13:12:40 +0000 (+0100) Subject: Revert "retreat: Don't report a destroyed ship/land unit couldn't retreat" X-Git-Tag: v4.3.33~98 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=cc8b92d55572ec8c113d42d50ca3903a74a918b5 Revert "retreat: Don't report a destroyed ship/land unit couldn't retreat" This reverts commit df8a1ffc1bf77567e4972810d5c729a73fcb42e6. Because it breaks group retreat. Trivial conflicts due to the removal of option SAIL. Signed-off-by: Markus Armbruster Conflicts: src/lib/subs/retreat.c tests/retreat/journal.log --- diff --git a/src/lib/subs/retreat.c b/src/lib/subs/retreat.c index 98b9a8e0f..e57a8d87f 100644 --- a/src/lib/subs/retreat.c +++ b/src/lib/subs/retreat.c @@ -84,7 +84,7 @@ retreat_ship(struct shpstr *sp, char code) struct nstr_item ni; struct shpstr ship; - if (sp->shp_effic < SHIP_MINEFF || CANT_HAPPEN(!sp->shp_own)) + if (CANT_HAPPEN(!sp->shp_own)) return; if (sp->shp_own == player->cnum) return; @@ -123,6 +123,15 @@ retreat_ship1(struct shpstr *sp, char code, int orig) struct mchrstr *mcp; int changed; + if (sp->shp_effic < SHIP_MINEFF) { + wu(0, sp->shp_own, + "%s %s,\nbut it died in the attack, and so couldn't retreat!\n", + prship(sp), conditions[findcondition(code)].desc[orig]); + if (!orig) + putship(sp->shp_uid, sp); + return 0; + } + /* check crew - uws don't count */ if (sp->shp_item[I_MILIT] == 0 && sp->shp_item[I_CIVIL] == 0) { wu(0, sp->shp_own, @@ -274,7 +283,7 @@ retreat_land(struct lndstr *lp, char code) struct nstr_item ni; struct lndstr land; - if (lp->lnd_effic < LAND_MINEFF || CANT_HAPPEN(!lp->lnd_own)) + if (CANT_HAPPEN(!lp->lnd_own)) return; if (lp->lnd_own == player->cnum) return; @@ -312,6 +321,15 @@ retreat_land1(struct lndstr *lp, char code, int orig) double mobcost; struct lchrstr *lcp; + if (lp->lnd_effic < LAND_MINEFF) { + wu(0, lp->lnd_own, + "%s %s,\nbut it died in the attack, and so couldn't retreat!\n", + prland(lp), conditions[findcondition(code)].desc[orig]); + if (!orig) + putland(lp->lnd_uid, lp); + return 0; + } + getsect(lp->lnd_x, lp->lnd_y, §); if (lp->lnd_mobil <= 0.0) { diff --git a/tests/retreat/01-retreat-1 b/tests/retreat/01-retreat-1 index 25cb73c6f..c542ad6d6 100644 --- a/tests/retreat/01-retreat-1 +++ b/tests/retreat/01-retreat-1 @@ -42,7 +42,6 @@ lret | sunk | as group (fleet c): 30 sinks, 32 crewless, 35 no mobility fire se -2,2 30 -| BUG: group does not retreat __cmd added -2 -2 0 | in construction zone 2,2 fire se -2,2 33 @@ -143,7 +142,9 @@ board 130 5 bomb 30 . p -2,2 jh l 30 -| BUG: group does not retreat +| BUG: 31 retreats anyway +| BUG: 32 retreats anyway +| BUG: 34 retreats anyway __cmd added -1 -2 0 | kidnapped in -1,1 bomb 30 . p -2,2 uh diff --git a/tests/retreat/final.xdump b/tests/retreat/final.xdump index e9ae7a9ab..6c8081f2a 100644 --- a/tests/retreat/final.xdump +++ b/tests/retreat/final.xdump @@ -119,10 +119,10 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h 28 2 2 2 0 100 107 0 50 0 0 none 0 "g" -1 127 42 (group injured) "g" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 29 2 3 1 0 100 117 0 50 0 0 none 0 "g" -1 127 42 (group bombed) "g" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 30 0 0 2 0 0 105 0 50 0 0 none 0 "c" -1 127 42 (group bombed) "j" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 -31 2 0 2 0 100 127 0 50 0 0 none 0 "c" 35 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 -32 2 0 2 0 100 127 0 50 0 0 none 0 "c" -1 127 42 (group bombed) "j" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 +31 2 2 2 0 100 107 0 50 0 0 none 0 "c" 35 127 42 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 +32 2 2 2 0 100 107 0 50 0 0 none 0 "c" -1 127 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 33 2 1 1 0 85 98 0 50 0 0 none 0 "" -1 127 42 () "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 -34 2 0 2 0 100 127 0 50 0 0 none 0 "c" -1 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 9 0 +34 2 2 2 0 100 107 0 50 0 0 none 0 "c" -1 127 42 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 9 0 35 2 0 2 0 100 0 0 50 0 0 none 0 "c" -1 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 40 2 2 2 0 91 -14 0 50 1 1 none 3 "" -1 127 42 (bombed) "u" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 41 2 3 1 0 89 103 0 50 1 1 none 3 "" -1 127 42 (bombed) "y" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 diff --git a/tests/retreat/journal.log b/tests/retreat/journal.log index dee210a2f..401ff7bce 100644 --- a/tests/retreat/journal.log +++ b/tests/retreat/journal.log @@ -1108,6 +1108,12 @@ Play#0 output Play#0 1 > BULLETIN from POGO, (#0) dated Thu Jan 1 00:00:00 1970 Play#0 output Play#0 1 Country #1 shelled cs cargo ship (#30) in 0,2 for 10 damage. Play#0 output Play#0 1 cs cargo ship (#30) takes 8 + Play#0 output Play#0 1 cs cargo ship (#30) was damaged, + Play#0 output Play#0 1 but it died in the attack, and so couldn't retreat! + Play#0 output Play#0 1 cs cargo ship (#32) retreated with a damaged friend, + Play#0 output Play#0 1 but had no crew, and couldn't retreat! + Play#0 output Play#0 1 cs cargo ship (#35) retreated with a damaged friend, + Play#0 output Play#0 1 but had no mobility, and couldn't retreat! Play#0 output Play#0 1 cs cargo ship (#30) sunk! Play#0 output Play#0 1 Country #1 shelled cs cargo ship (#33) in 2,2 for 8 damage. Play#0 output Play#0 1 cs cargo ship (#33) takes 6 @@ -1256,6 +1262,13 @@ Play#0 output Play#0 1 1 planes spotted over 0,2 Play#0 output Play#0 1 1 pinpoint bombing raid did 44 damage to cav cavalry #30 Play#0 output Play#0 1 cav cavalry #30 takes 17 + Play#0 output Play#0 1 cav cavalry #30 was bombed, + Play#0 output Play#0 1 but it died in the attack, and so couldn't retreat! + Play#0 output Play#0 1 cav cavalry #31 retreated with a bombed friend, and ended up at 2,2 + Play#0 output Play#0 1 cav cavalry #32 retreated with a bombed friend, and ended up at 2,2 + Play#0 output Play#0 1 cav cavalry #34 retreated with a bombed friend, and ended up at 2,2 + Play#0 output Play#0 1 cav cavalry #35 retreated with a bombed friend, + Play#0 output Play#0 1 but had no mobility, and couldn't retreat! Play#0 output Play#0 1 0,2 takes 4% collateral damage Play#0 output Play#0 1 tra train #9 takes 1 Play#0 output Play#0 1 1 planes spotted over -1,1 @@ -1432,10 +1445,10 @@ Play#0 output Play#0 1 2 27 cav cavalry 4,0 g 100% 10 127 117 0 50 42% 0 0 Play#0 output Play#0 1 2 28 cav cavalry 2,2 g 100% 10 127 107 0 50 42% 0 0 Play#0 output Play#0 1 2 29 cav cavalry 3,1 g 100% 10 127 117 0 50 42% 0 0 - Play#0 output Play#0 1 2 31 cav cavalry 0,2 c 100% 10 127 127 0 50 42% 0 0 35S - Play#0 output Play#0 1 2 32 cav cavalry 0,2 c 100% 0 127 127 0 50 42% 0 0 + Play#0 output Play#0 1 2 31 cav cavalry 2,2 c 100% 10 127 107 0 50 42% 0 0 35S + Play#0 output Play#0 1 2 32 cav cavalry 2,2 c 100% 0 127 107 0 50 42% 0 0 Play#0 output Play#0 1 2 33 cav cavalry 1,1 85% 9 127 98 0 50 42% 0 0 - Play#0 output Play#0 1 2 34 cav cavalry 0,2 c 100% 10 127 127 0 50 42% 0 0 9L + Play#0 output Play#0 1 2 34 cav cavalry 2,2 c 100% 10 127 107 0 50 42% 0 0 9L Play#0 output Play#0 1 2 35 cav cavalry 0,2 c 100% 10 127 0 0 50 42% 0 0 Play#0 output Play#0 1 2 40 cav cavalry 2,2 91% 9 127 -14 0 50 42% 0 0 Play#0 output Play#0 1 2 41 cav cavalry 3,1 89% 9 127 103 0 50 42% 0 0 @@ -1460,9 +1473,6 @@ Play#0 output Play#0 1 2 25 cav cavalry 2,2 g g Yes b Play#0 output Play#0 1 2 28 cav cavalry 2,2 g g Yes i Play#0 output Play#0 1 2 29 cav cavalry 3,1 g g Yes b - Play#0 output Play#0 1 2 31 cav cavalry 0,2 c j Yes b - Play#0 output Play#0 1 2 32 cav cavalry 0,2 c j Yes b - Play#0 output Play#0 1 2 34 cav cavalry 0,2 c j Yes b Play#0 output Play#0 1 2 35 cav cavalry 0,2 c j Yes b Play#0 output Play#0 1 2 40 cav cavalry 2,2 u b Play#0 output Play#0 1 2 41 cav cavalry 3,1 y b @@ -1472,7 +1482,7 @@ Play#0 output Play#0 1 2 62 cav cavalry 0,0 nj ihb Play#0 output Play#0 1 2 63 cav cavalry 0,0 nj ihb Play#0 output Play#0 1 2 64 cav cavalry 0,0 nj ihb - Play#0 output Play#0 1 20 units + Play#0 output Play#0 1 17 units Play#0 output Play#0 6 0 636 Play#0 input miss l * ?mission#0 q Play#0 command mission