retreat: Don't consume a retreat direction that wasn't followed
When a retreating ship or land unit runs into a sector it can't enter, it stops. The direction character that led it there is consumed, even though it could not be followed. The next retreat will then attempt to follow the rest of the path. Don't do that. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
40ec33b099
commit
ff826d2582
3 changed files with 22 additions and 14 deletions
|
@ -201,9 +201,11 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dir = chkdir(sp->shp_rpath[0], DIR_STOP, DIR_LAST);
|
dir = chkdir(sp->shp_rpath[0], DIR_STOP, DIR_LAST);
|
||||||
memmove(sp->shp_rpath, sp->shp_rpath+1, sizeof(sp->shp_rpath) - 1);
|
if (dir == DIR_STOP || CANT_HAPPEN(dir < 0)) {
|
||||||
if (dir == DIR_STOP || CANT_HAPPEN(dir < 0))
|
memmove(sp->shp_rpath, sp->shp_rpath + 1,
|
||||||
|
sizeof(sp->shp_rpath) - 1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
dx = diroff[dir][0];
|
dx = diroff[dir][0];
|
||||||
dy = diroff[dir][1];
|
dy = diroff[dir][1];
|
||||||
|
|
||||||
|
@ -227,6 +229,8 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
|
||||||
sp->shp_y = newy;
|
sp->shp_y = newy;
|
||||||
sp->shp_mobil -= mobcost;
|
sp->shp_mobil -= mobcost;
|
||||||
sp->shp_mission = 0;
|
sp->shp_mission = 0;
|
||||||
|
memmove(sp->shp_rpath, sp->shp_rpath + 1,
|
||||||
|
sizeof(sp->shp_rpath) - 1);
|
||||||
|
|
||||||
mines = sect.sct_mines;
|
mines = sect.sct_mines;
|
||||||
changed = 0;
|
changed = 0;
|
||||||
|
@ -383,9 +387,11 @@ retreat_land1(struct lndstr *lp, char code, int orig)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dir = chkdir(lp->lnd_rpath[0], DIR_STOP, DIR_LAST);
|
dir = chkdir(lp->lnd_rpath[0], DIR_STOP, DIR_LAST);
|
||||||
memmove(lp->lnd_rpath, lp->lnd_rpath+1, sizeof(lp->lnd_rpath) - 1);
|
if (dir == DIR_STOP || CANT_HAPPEN(dir < 0)) {
|
||||||
if (dir == DIR_STOP || CANT_HAPPEN(dir < 0))
|
memmove(lp->lnd_rpath, lp->lnd_rpath + 1,
|
||||||
|
sizeof(lp->lnd_rpath) - 1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
dx = diroff[dir][0];
|
dx = diroff[dir][0];
|
||||||
dy = diroff[dir][1];
|
dy = diroff[dir][1];
|
||||||
|
|
||||||
|
@ -410,6 +416,8 @@ retreat_land1(struct lndstr *lp, char code, int orig)
|
||||||
lp->lnd_y = newy;
|
lp->lnd_y = newy;
|
||||||
lp->lnd_mobil -= mobcost;
|
lp->lnd_mobil -= mobcost;
|
||||||
lp->lnd_mission = 0;
|
lp->lnd_mission = 0;
|
||||||
|
memmove(lp->lnd_rpath, lp->lnd_rpath + 1,
|
||||||
|
sizeof(lp->lnd_rpath) - 1);
|
||||||
|
|
||||||
mines = SCT_LANDMINES(§);
|
mines = SCT_LANDMINES(§);
|
||||||
if (mines <= 0 || sect.sct_oldown == lp->lnd_own)
|
if (mines <= 0 || sect.sct_oldown == lp->lnd_own)
|
||||||
|
|
|
@ -188,8 +188,8 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet xstar
|
||||||
38 0 0 0 0 0 127 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 0 "" 0 0 0 () ""
|
38 0 0 0 0 0 127 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 0 "" 0 0 0 () ""
|
||||||
39 0 0 0 0 0 127 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 0 "" 0 0 0 () ""
|
39 0 0 0 0 0 127 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 0 "" 0 0 0 () ""
|
||||||
40 2 1 3 10 91 -7 0 45 0 2 none 1 "" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 40 "" -3 1 1 (injured) "nnnh"
|
40 2 1 3 10 91 -7 0 45 0 2 none 1 "" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 40 "" -3 1 1 (injured) "nnnh"
|
||||||
41 2 1 3 10 96 108 0 45 0 2 none 1 "" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 41 "" -3 1 1 (injured) "h"
|
41 2 1 3 10 96 108 0 45 0 2 none 1 "" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 41 "" -3 1 1 (injured) "uh"
|
||||||
42 2 -4 2 10 95 120 0 45 -4 2 interdiction 1 "" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 42 "" -3 1 1 (injured) "gggh"
|
42 2 -4 2 10 95 120 0 45 -4 2 interdiction 1 "" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 42 "" -3 1 1 (injured) "ugggh"
|
||||||
43 2 -6 4 16 76 86 0 40 0 0 none 0 "m" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 43 "" -3 1 1 (group injured) "g"
|
43 2 -6 4 16 76 86 0 40 0 0 none 0 "m" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 43 "" -3 1 1 (group injured) "g"
|
||||||
44 2 -6 4 16 63 70 0 40 0 0 none 0 "m" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 2 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 44 "" -3 1 1 (group injured) "g"
|
44 2 -6 4 16 63 70 0 40 0 0 none 0 "m" 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 2 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 44 "" -3 1 1 (group injured) "g"
|
||||||
45 0 0 0 0 0 127 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 0 "" 0 0 0 () ""
|
45 0 0 0 0 0 127 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 "" 0 "" 0 0 0 () ""
|
||||||
|
@ -363,7 +363,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
|
||||||
7 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
7 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
8 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
8 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
9 2 1 1 7 93 119 0 50 0 0 none 0 "" -1 127 42 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
9 2 1 1 7 93 119 0 50 0 0 none 0 "" -1 127 42 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
10 2 4 0 0 61 61 0 50 0 0 none 0 "" -1 127 42 () "" 0 6 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
10 2 4 0 0 61 61 0 50 0 0 none 0 "" -1 127 42 (bombed) "y" 0 6 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
11 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
11 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
12 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
12 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
13 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
13 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
|
@ -394,8 +394,8 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
|
||||||
38 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
38 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
39 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
39 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
40 2 2 2 0 89 -15 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
|
40 2 2 2 0 89 -15 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 86 99 0 50 1 1 none 3 "" -1 127 42 () "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
41 2 3 1 0 86 99 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
|
||||||
42 2 1 1 0 83 105 0 50 1 1 reserve 3 "" -1 127 42 () "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
42 2 1 1 0 83 105 0 50 1 1 reserve 3 "" -1 127 42 (bombed) "g" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
43 2 0 0 15 96 110 0 130 0 0 none 0 "m" -1 127 42 (group bombed) "u" 0 10 2 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
43 2 0 0 15 96 110 0 130 0 0 none 0 "m" -1 127 42 (group bombed) "u" 0 10 2 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
44 2 0 0 15 90 103 0 130 0 0 none 0 "m" -1 127 42 (group bombed) "u" 0 10 3 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
44 2 0 0 15 90 103 0 130 0 0 none 0 "m" -1 127 42 (group bombed) "u" 0 10 3 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
45 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
45 0 0 0 0 0 127 0 0 0 0 none 0 "" -1 127 0 () "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
|
|
|
@ -1550,8 +1550,8 @@
|
||||||
Play#0 output Play#0 1 2 34 cs cargo ship 3,1 n i
|
Play#0 output Play#0 1 2 34 cs cargo ship 3,1 n i
|
||||||
Play#0 output Play#0 1 2 35 cs cargo ship 0,2 n i
|
Play#0 output Play#0 1 2 35 cs cargo ship 0,2 n i
|
||||||
Play#0 output Play#0 1 2 40 lc light cruis 1,3 nnnh 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 h 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 gggh i
|
Play#0 output Play#0 1 2 42 lc light cruis -4,2 ugggh i
|
||||||
Play#0 output Play#0 1 2 43 ms minesweeper -6,4 m g Yes 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 44 ms minesweeper -6,4 m g Yes i
|
||||||
Play#0 output Play#0 1 2 50 sb submarine -9,1
|
Play#0 output Play#0 1 2 50 sb submarine -9,1
|
||||||
|
@ -1615,15 +1615,15 @@
|
||||||
Play#0 output Play#0 1 own lnd# unit type x,y ar path as army? flags
|
Play#0 output Play#0 1 own lnd# unit type x,y ar path as army? flags
|
||||||
Play#0 output Play#0 1 1 2 inf infantry -3,1 yujnbgyuj ihb
|
Play#0 output Play#0 1 1 2 inf infantry -3,1 yujnbgyuj ihb
|
||||||
Play#0 output Play#0 1 2 9 tra train 1,1
|
Play#0 output Play#0 1 2 9 tra train 1,1
|
||||||
Play#0 output Play#0 1 2 10 cav cavalry 4,0
|
Play#0 output Play#0 1 2 10 cav cavalry 4,0 y b
|
||||||
Play#0 output Play#0 1 2 31 cav cavalry 0,2 j b
|
Play#0 output Play#0 1 2 31 cav cavalry 0,2 j b
|
||||||
Play#0 output Play#0 1 2 32 cav cavalry 3,1
|
Play#0 output Play#0 1 2 32 cav cavalry 3,1
|
||||||
Play#0 output Play#0 1 2 33 cav cavalry 1,1
|
Play#0 output Play#0 1 2 33 cav cavalry 1,1
|
||||||
Play#0 output Play#0 1 2 34 cav cavalry 1,1 j b
|
Play#0 output Play#0 1 2 34 cav cavalry 1,1 j b
|
||||||
Play#0 output Play#0 1 2 35 cav cavalry 1,1 j b
|
Play#0 output Play#0 1 2 35 cav cavalry 1,1 j b
|
||||||
Play#0 output Play#0 1 2 40 cav cavalry 2,2 u 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
|
Play#0 output Play#0 1 2 41 cav cavalry 3,1 y b
|
||||||
Play#0 output Play#0 1 2 42 cav cavalry 1,1
|
Play#0 output Play#0 1 2 42 cav cavalry 1,1 g b
|
||||||
Play#0 output Play#0 1 2 43 eng engineer 0,0 m u Yes b
|
Play#0 output Play#0 1 2 43 eng engineer 0,0 m u Yes b
|
||||||
Play#0 output Play#0 1 2 44 eng engineer 0,0 m u Yes b
|
Play#0 output Play#0 1 2 44 eng engineer 0,0 m u Yes b
|
||||||
Play#0 output Play#0 1 2 60 cav cavalry 3,1
|
Play#0 output Play#0 1 2 60 cav cavalry 3,1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue