From 4de4da259aec7a181e5c5ebd2f7969d9a9d245b4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 10 Jan 2015 10:03:33 +0100 Subject: [PATCH] retreat lretreat: Strip trailing 'h' from retreat path Has no effect now. Before the recent rewrite of automatic retreat, it could be used to trigger group retreat while staying put. Signed-off-by: Markus Armbruster --- src/lib/commands/retr.c | 5 +++-- tests/retreat/final.xdump | 12 ++++++------ tests/retreat/journal.log | 14 +++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/lib/commands/retr.c b/src/lib/commands/retr.c index 326419db3..0b08a7454 100644 --- a/src/lib/commands/retr.c +++ b/src/lib/commands/retr.c @@ -71,8 +71,7 @@ retreat(int type) int nunits; struct nstr_item ni; union empobj_storage unit; - int rflags, ch, j; - unsigned i; + int i, rflags, ch, j; char *rflagsc, *p, *name, *rpath, *what; int *rflagsp; char buf1[1024]; @@ -96,6 +95,8 @@ retreat(int type) return RET_SYN; } } + for (i--; i >= 0 && pq[i] == dirch[DIR_STOP]; i--) + pq[i] = 0; } else pq = NULL; diff --git a/tests/retreat/final.xdump b/tests/retreat/final.xdump index ff8e693c9..1f1750e0d 100644 --- a/tests/retreat/final.xdump +++ b/tests/retreat/final.xdump @@ -50,9 +50,9 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet civil 34 2 3 1 10 94 120 0 45 3 1 interdiction 1 "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "n" 35 2 0 2 10 100 0 0 45 0 2 interdiction 1 "c" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group injured) "n" 36 2 0 2 10 100 127 0 45 0 2 interdiction 1 "c" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group injured) "n" -40 2 1 3 10 91 -7 0 45 0 2 none 1 "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "nnnh" -41 2 1 3 10 96 109 0 45 0 2 none 1 "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "uh" -42 2 -4 2 10 95 121 0 45 -4 2 interdiction 1 "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "ugggh" +40 2 1 3 10 91 -7 0 45 0 2 none 1 "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "nnn" +41 2 1 3 10 96 109 0 45 0 2 none 1 "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "u" +42 2 -4 2 10 95 121 0 45 -4 2 interdiction 1 "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured) "uggg" 43 2 -6 4 16 87 98 0 45 0 0 none 0 "m" 0 8 1 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group injured) "g" 44 2 -6 4 16 68 73 0 45 0 0 none 0 "m" 0 6 2 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group injured) "g" 46 2 5 1 10 93 118 0 45 5 1 interdiction 1 "n" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group injured) "y" @@ -118,8 +118,8 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h 10 2 3 -1 0 42 29 0 50 1 1 none 3 "" -1 0 42 () "" 0 4 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 24 1 3 1 0 98 125 0 50 0 0 none 0 "g" -1 0 42 (group bombed) "bhg" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 25 2 2 2 0 91 96 0 50 3 1 none 3 "g" -1 0 42 (group bombed) "g" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 -26 2 3 1 0 100 127 0 50 3 1 reserve 3 "g" -1 127 42 (bombed) "uh" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 -27 2 3 1 0 100 127 0 50 3 1 reserve 3 "g" -1 127 42 (group bombed) "uh" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 +26 2 3 1 0 100 127 0 50 3 1 reserve 3 "g" -1 127 42 (bombed) "u" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 +27 2 3 1 0 100 127 0 50 3 1 reserve 3 "g" -1 127 42 (group bombed) "u" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 28 2 2 2 0 100 107 0 50 3 1 none 3 "g" -1 0 42 (group injured) "g" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 29 2 4 0 0 100 127 0 50 4 0 reserve 3 "g" -1 127 42 (group bombed) "bhg" 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 2 reserve 3 "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 @@ -137,7 +137,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h 44 2 1 -1 15 90 76 0 130 1 1 none 1 "m" -1 0 42 () "" 0 9 3 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 45 2 1 -1 7 84 65 0 50 0 0 none 0 "t" -1 0 42 (group bombed) "b" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 46 2 0 -2 0 100 127 0 50 0 -2 reserve 3 "t" -1 127 42 (group bombed) "nb" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 -47 2 1 -1 0 91 115 0 50 1 -1 reserve 3 "s" -1 127 42 (group bombed) "gh" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 +47 2 1 -1 0 91 115 0 50 1 -1 reserve 3 "s" -1 127 42 (group bombed) "g" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 48 2 -1 -1 8 100 116 0 50 1 -1 none 3 "s" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 60 2 3 1 0 73 72 0 50 0 0 none 3 "" -1 0 42 () "" 0 7 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 61 2 0 0 0 100 127 0 50 0 0 reserve 3 "" -1 127 42 (injured helpless bombed) "nj" 0 10 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 918643a20..f5b9e0763 100644 --- a/tests/retreat/journal.log +++ b/tests/retreat/journal.log @@ -1483,7 +1483,7 @@ Play#0 output Play#0 1 1 planes spotted over 1,-1 Play#0 output Play#0 1 1 pinpoint bombing raid did 24 damage to cav cavalry #47 Play#0 output Play#0 1 cav cavalry #47 takes 9 - Play#0 output Play#0 1 cav cavalry #47 retreats along path gh + Play#0 output Play#0 1 cav cavalry #47 retreats along path g Play#0 output Play#0 1 spy infiltrator #48 retreats with them Play#0 output Play#0 1 cav cavalry #47 can't go to -1,-1 & stays in 1,-1 Play#0 output Play#0 1 spy infiltrator #48 stopped at -1,-1 @@ -1613,9 +1613,9 @@ Play#0 output Play#0 1 2 34 lc light cruis 3,1 n i Play#0 output Play#0 1 2 35 lc light cruis 0,2 c n Yes i Play#0 output Play#0 1 2 36 lc light cruis 0,2 c n Yes i - Play#0 output Play#0 1 2 40 lc light cruis 1,3 nnnh i - Play#0 output Play#0 1 2 41 lc light cruis 1,3 uh i - Play#0 output Play#0 1 2 42 lc light cruis -4,2 ugggh i + Play#0 output Play#0 1 2 40 lc light cruis 1,3 nnn i + Play#0 output Play#0 1 2 41 lc light cruis 1,3 u i + Play#0 output Play#0 1 2 42 lc light cruis -4,2 uggg i Play#0 output Play#0 1 2 43 ms minesweeper -6,4 m g Yes i Play#0 output Play#0 1 2 44 ms minesweeper -6,4 m g Yes i Play#0 output Play#0 1 2 46 lc light cruis 5,1 n y Yes i @@ -1703,8 +1703,8 @@ Play#0 output Play#0 1 1 7 inf infantry -4,0 a b Yes h Play#0 output Play#0 1 1 24 cav cavalry 3,1 g bhg Yes b Play#0 output Play#0 1 2 25 cav cavalry 2,2 g g Yes b - Play#0 output Play#0 1 2 26 cav cavalry 3,1 g uh b - Play#0 output Play#0 1 2 27 cav cavalry 3,1 g uh Yes b + Play#0 output Play#0 1 2 26 cav cavalry 3,1 g u b + Play#0 output Play#0 1 2 27 cav cavalry 3,1 g u 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 4,0 g bhg Yes b Play#0 output Play#0 1 2 31 cav cavalry 0,2 c j Yes b @@ -1718,7 +1718,7 @@ Play#0 output Play#0 1 2 42 cav cavalry 1,1 g b Play#0 output Play#0 1 2 45 tra train 1,-1 t b Yes b Play#0 output Play#0 1 2 46 cav cavalry 0,-2 t nb Yes b - Play#0 output Play#0 1 2 47 cav cavalry 1,-1 s gh Yes b + Play#0 output Play#0 1 2 47 cav cavalry 1,-1 s g Yes b Play#0 output Play#0 1 2 61 cav cavalry 0,0 nj ihb 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 -- 2.43.0