march: Don't scatter land units on crossing border
When attempting to enter a sector with a land unit that can't go there
while the marching land units are all in the same sector, march stops
and prompts without removing the incapable land unit from the group.
If another land unit has already entered the sector, the group becomes
scattered.
This can happen when marching a mixed group of spies and non-spies
into a non-allied sector. Same for marching a mixed group of trains
and non-trains into a sector without rail, except such groups have
been disallowed since commit 36e41e5
(v4.3.7). Both screwed up when
spies and trains were added in 4.0.0
Remove the incapable land unit from the group when another land unit
can enter the sector. This avoids scattering land units.
Don't remove incapable land units when no land unit can enter the
sector. Without this, march would remove everyone and end then.
It can also happen when sectors or land units change while we're
sitting at the "Do you really want to abandon X,Y" prompt. I'm going
to fix that differently.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
c70d9375ef
commit
c9fc05ae5b
4 changed files with 35 additions and 19 deletions
|
@ -977,6 +977,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
coord dy;
|
coord dy;
|
||||||
coord newx;
|
coord newx;
|
||||||
coord newy;
|
coord newy;
|
||||||
|
int move;
|
||||||
enum lnd_stuck stuck;
|
enum lnd_stuck stuck;
|
||||||
int stopping = 0;
|
int stopping = 0;
|
||||||
int visible;
|
int visible;
|
||||||
|
@ -991,6 +992,25 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
}
|
}
|
||||||
dx = diroff[dir][0];
|
dx = diroff[dir][0];
|
||||||
dy = diroff[dir][1];
|
dy = diroff[dir][1];
|
||||||
|
|
||||||
|
move = 0;
|
||||||
|
for (qp = list->q_back; qp != list; qp = next) {
|
||||||
|
next = qp->q_back;
|
||||||
|
llp = (struct ulist *)qp;
|
||||||
|
getsect(llp->unit.land.lnd_x, llp->unit.land.lnd_y, &osect);
|
||||||
|
oldown = osect.sct_own;
|
||||||
|
newx = xnorm(llp->unit.land.lnd_x + dx);
|
||||||
|
newy = ynorm(llp->unit.land.lnd_y + dy);
|
||||||
|
getsect(newx, newy, §);
|
||||||
|
stuck = lnd_check_mar(&llp->unit.land, §);
|
||||||
|
if (stuck == LND_STUCK_NOT
|
||||||
|
&& (relations_with(sect.sct_own, actor) == ALLIED
|
||||||
|
|| !sect.sct_own
|
||||||
|
|| (lchr[llp->unit.land.lnd_type].l_flags & L_SPY))) {
|
||||||
|
move = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (qp = list->q_back; qp != list; qp = next) {
|
for (qp = list->q_back; qp != list; qp = next) {
|
||||||
next = qp->q_back;
|
next = qp->q_back;
|
||||||
llp = (struct ulist *)qp;
|
llp = (struct ulist *)qp;
|
||||||
|
@ -1006,7 +1026,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
&& !(lchr[llp->unit.land.lnd_type].l_flags & L_SPY))) {
|
&& !(lchr[llp->unit.land.lnd_type].l_flags & L_SPY))) {
|
||||||
if (stuck == LND_STUCK_NO_RAIL
|
if (stuck == LND_STUCK_NO_RAIL
|
||||||
&& (!sect.sct_own || rel == ALLIED)) {
|
&& (!sect.sct_own || rel == ALLIED)) {
|
||||||
if (together) {
|
if (together && !move) {
|
||||||
mpr(actor, "no rail system in %s\n",
|
mpr(actor, "no rail system in %s\n",
|
||||||
xyas(newx, newy, actor));
|
xyas(newx, newy, actor));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1017,7 +1037,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (together) {
|
if (together && !move) {
|
||||||
mpr(actor, "can't go to %s\n", xyas(newx, newy, actor));
|
mpr(actor, "can't go to %s\n", xyas(newx, newy, actor));
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,7 +41,6 @@ ijjh
|
||||||
__cmd added -1 0 0
|
__cmd added -1 0 0
|
||||||
march 55/54 g
|
march 55/54 g
|
||||||
ijjh
|
ijjh
|
||||||
| BUG: 52/53 moves nothing g, cav/spy jj, 53/54 moves spy g, spy/cav jj
|
|
||||||
| enter hostile 10,4
|
| enter hostile 10,4
|
||||||
march 56/57/58/59 jh
|
march 56/57/58/59 jh
|
||||||
| enter sea
|
| enter sea
|
||||||
|
|
|
@ -231,9 +231,9 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
|
||||||
39 1 7 5 0 84 93 0 30 6 6 none 3 "" -1 0 42 () "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
39 1 7 5 0 84 93 0 30 6 6 none 3 "" -1 0 42 () "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
50 1 11 3 0 100 105 0 30 9 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
50 1 11 3 0 100 105 0 30 9 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
51 1 -1 3 0 100 105 0 30 1 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
51 1 -1 3 0 100 105 0 30 1 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
52 1 1 3 0 100 84 0 30 -3 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
52 1 -3 3 0 100 127 0 30 -3 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
53 1 1 3 8 100 85 0 40 -3 3 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
53 1 -1 3 8 100 64 0 40 -3 3 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
54 1 1 3 0 100 84 0 30 -3 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
54 1 -3 3 0 100 127 0 30 -3 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
55 1 -1 3 8 100 64 0 40 -3 3 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
55 1 -1 3 8 100 64 0 40 -3 3 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
56 1 10 4 8 60 116 0 40 8 4 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
56 1 10 4 8 60 116 0 40 8 4 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
57 1 10 4 8 60 116 0 40 8 4 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
57 1 10 4 8 60 116 0 40 8 4 none 3 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||||
|
|
|
@ -852,17 +852,16 @@
|
||||||
Play#1 input march 52/53 g
|
Play#1 input march 52/53 g
|
||||||
Play#1 command march
|
Play#1 command march
|
||||||
Play#1 output Play#1 1 Leader is cav cavalry #52
|
Play#1 output Play#1 1 Leader is cav cavalry #52
|
||||||
Play#1 output Play#1 1 can't go to -5,3
|
Play#1 output Play#1 1 cav cavalry #52 can't go to -5,3 & stays in -3,3
|
||||||
|
Play#1 output Play#1 1 Changing leader to spy infiltrator #53
|
||||||
Play#1 output Play#1 1 c c
|
Play#1 output Play#1 1 c c
|
||||||
Play#1 output Play#1 1 + + +
|
Play#1 output Play#1 1 + + +
|
||||||
Play#1 output Play#1 1 m m
|
Play#1 output Play#1 1 m m
|
||||||
Play#1 output Play#1 4 <127.0:127.0: -3,3>
|
Play#1 output Play#1 4 <106.3:106.3: -5,3>
|
||||||
Play#1 input ijjh
|
Play#1 input ijjh
|
||||||
Play#1 output Play#1 1 lnd# land type x,y a eff mil sh gun xl ln mu tech retr
|
Play#1 output Play#1 1 lnd# land type x,y a eff mil sh gun xl ln mu tech retr
|
||||||
Play#1 output Play#1 1 52 cav cavalry -3,3 100% 5 0 0 0 0 127 30 42%
|
Play#1 output Play#1 1 53 spy infiltrator -5,3 100% 0 0 0 0 0 106 40 42%
|
||||||
Play#1 output Play#1 1 53 spy infiltrator -3,3 100% 0 0 0 0 0 127 40 42%
|
Play#1 output Play#1 1 spy infiltrator #53 stopped at -1,3
|
||||||
Play#1 output Play#1 1 cav cavalry #52 stopped at 1,3
|
|
||||||
Play#1 output Play#1 1 spy infiltrator #53 stopped at 1,3
|
|
||||||
Play#1 output Play#1 6 0 578
|
Play#1 output Play#1 6 0 578
|
||||||
Play#1 input __cmd added -1 0 0
|
Play#1 input __cmd added -1 0 0
|
||||||
Play#1 command __cmd
|
Play#1 command __cmd
|
||||||
|
@ -870,17 +869,15 @@
|
||||||
Play#1 input march 55/54 g
|
Play#1 input march 55/54 g
|
||||||
Play#1 command march
|
Play#1 command march
|
||||||
Play#1 output Play#1 1 Leader is spy infiltrator #55
|
Play#1 output Play#1 1 Leader is spy infiltrator #55
|
||||||
Play#1 output Play#1 1 can't go to -5,3
|
Play#1 output Play#1 1 cav cavalry #54 can't go to -5,3 & stays in -3,3
|
||||||
Play#1 output Play#1 1 c c
|
Play#1 output Play#1 1 c c
|
||||||
Play#1 output Play#1 1 + + +
|
Play#1 output Play#1 1 + + +
|
||||||
Play#1 output Play#1 1 m m
|
Play#1 output Play#1 1 m m
|
||||||
Play#1 output Play#1 4 <127.0:106.3: -5,3>
|
Play#1 output Play#1 4 <106.3:106.3: -5,3>
|
||||||
Play#1 input ijjh
|
Play#1 input ijjh
|
||||||
Play#1 output Play#1 1 lnd# land type x,y a eff mil sh gun xl ln mu tech retr
|
Play#1 output Play#1 1 lnd# land type x,y a eff mil sh gun xl ln mu tech retr
|
||||||
Play#1 output Play#1 1 55 spy infiltrator -5,3 100% 0 0 0 0 0 106 40 42%
|
Play#1 output Play#1 1 55 spy infiltrator -5,3 100% 0 0 0 0 0 106 40 42%
|
||||||
Play#1 output Play#1 1 54 cav cavalry -3,3 100% 5 0 0 0 0 127 30 42%
|
|
||||||
Play#1 output Play#1 1 spy infiltrator #55 stopped at -1,3
|
Play#1 output Play#1 1 spy infiltrator #55 stopped at -1,3
|
||||||
Play#1 output Play#1 1 cav cavalry #54 stopped at 1,3
|
|
||||||
Play#1 output Play#1 6 0 577
|
Play#1 output Play#1 6 0 577
|
||||||
Play#1 input march 56/57/58/59 jh
|
Play#1 input march 56/57/58/59 jh
|
||||||
Play#1 command march
|
Play#1 command march
|
||||||
|
@ -1505,9 +1502,9 @@
|
||||||
Play#0 output Play#0 1 1 39 cav cavalry 7,5 84% 1 0 93 0 30 42% 0 0
|
Play#0 output Play#0 1 1 39 cav cavalry 7,5 84% 1 0 93 0 30 42% 0 0
|
||||||
Play#0 output Play#0 1 1 50 cav cavalry 11,3 100% 5 0 105 0 30 42% 0 0
|
Play#0 output Play#0 1 1 50 cav cavalry 11,3 100% 5 0 105 0 30 42% 0 0
|
||||||
Play#0 output Play#0 1 1 51 cav cavalry -1,3 100% 5 0 105 0 30 42% 0 0
|
Play#0 output Play#0 1 1 51 cav cavalry -1,3 100% 5 0 105 0 30 42% 0 0
|
||||||
Play#0 output Play#0 1 1 52 cav cavalry 1,3 100% 5 0 84 0 30 42% 0 0
|
Play#0 output Play#0 1 1 52 cav cavalry -3,3 100% 5 0 127 0 30 42% 0 0
|
||||||
Play#0 output Play#0 1 1 53 spy infiltrato 1,3 100% 0 0 85 0 40 42% 0 0
|
Play#0 output Play#0 1 1 53 spy infiltrato -1,3 100% 0 0 64 0 40 42% 0 0
|
||||||
Play#0 output Play#0 1 1 54 cav cavalry 1,3 100% 5 0 84 0 30 42% 0 0
|
Play#0 output Play#0 1 1 54 cav cavalry -3,3 100% 5 0 127 0 30 42% 0 0
|
||||||
Play#0 output Play#0 1 1 55 spy infiltrato -1,3 100% 0 0 64 0 40 42% 0 0
|
Play#0 output Play#0 1 1 55 spy infiltrato -1,3 100% 0 0 64 0 40 42% 0 0
|
||||||
Play#0 output Play#0 1 1 56 spy infiltrato 10,4 60% 0 0 116 0 40 42% 0 0
|
Play#0 output Play#0 1 1 56 spy infiltrato 10,4 60% 0 0 116 0 40 42% 0 0
|
||||||
Play#0 output Play#0 1 1 57 spy infiltrato 10,4 60% 0 0 116 0 40 42% 0 0
|
Play#0 output Play#0 1 1 57 spy infiltrato 10,4 60% 0 0 116 0 40 42% 0 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue