navigate: Don't scatter ships on canal entry
When attempting to enter a sector with a ship that can't go there
while the navigating ships are all in the same sector, navigate stops
and prompts without removing the incapable ship from the group. If
another ship has already entered the sector, the group becomes
scattered.
This can happen only when navigating a mixed group of ships with and
without canal capability into a canal. Broken in commit 74e4e281
,
v4.3.0.
Remove the incapable ship from the group when another ship can enter
the sector. This avoids scattering ships.
Don't remove incapable ships when no ship can enter the sector.
Without this, navigate would remove everyone and end then.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
6e386d101a
commit
d89825116e
4 changed files with 33 additions and 21 deletions
|
@ -770,6 +770,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
|||
coord dy;
|
||||
coord newx;
|
||||
coord newy;
|
||||
int move;
|
||||
int stopping = 0;
|
||||
double mobcost;
|
||||
char dp[80];
|
||||
|
@ -781,6 +782,21 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
|||
}
|
||||
dx = diroff[dir][0];
|
||||
dy = diroff[dir][1];
|
||||
|
||||
move = 0;
|
||||
for (qp = list->q_back; qp != list; qp = next) {
|
||||
next = qp->q_back;
|
||||
mlp = (struct ulist *)qp;
|
||||
newx = xnorm(mlp->unit.ship.shp_x + dx);
|
||||
newy = ynorm(mlp->unit.ship.shp_y + dy);
|
||||
getsect(newx, newy, §);
|
||||
navigate = shp_check_nav(&mlp->unit.ship, §);
|
||||
if (navigate == NAVOK &&
|
||||
(!sect.sct_own
|
||||
|| relations_with(sect.sct_own, actor) >= FRIENDLY))
|
||||
move = 1;
|
||||
}
|
||||
|
||||
for (qp = list->q_back; qp != list; qp = next) {
|
||||
next = qp->q_back;
|
||||
mlp = (struct ulist *)qp;
|
||||
|
@ -797,7 +813,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
|||
xyas(newx, newy, actor));
|
||||
else
|
||||
sprintf(dp, "can't go to %s", xyas(newx, newy, actor));
|
||||
if (together) {
|
||||
if (together && !move) {
|
||||
mpr(actor, "%s\n", dp);
|
||||
return 1;
|
||||
} else {
|
||||
|
|
|
@ -44,7 +44,6 @@ navi 54/55 n
|
|||
iyyh
|
||||
navi 57/56 n
|
||||
iyyh
|
||||
| BUG: 54/55 moves pt n, pt/cs yy, 57/56 moves nothing n, cs/pt yy
|
||||
navi 58/59 nX
|
||||
h
|
||||
| enter canal 4,2 1%
|
||||
|
|
|
@ -157,9 +157,9 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet civil
|
|||
52 1 2 0 9 100 117 0 40 4 0 none 0 "" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
53 1 4 0 9 100 127 0 40 4 0 none 0 "" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
54 1 0 0 9 100 99 0 40 1 1 none 0 "" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
55 1 -1 -1 2 100 97 0 20 0 0 none 0 "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
56 1 -1 -1 9 100 108 0 40 1 1 none 0 "" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
57 1 -1 -1 2 100 97 0 20 0 0 none 0 "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
55 1 1 1 2 100 127 0 20 0 0 none 0 "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
56 1 0 0 9 100 99 0 40 1 1 none 0 "" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
57 1 1 1 2 100 127 0 20 0 0 none 0 "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
58 1 1 1 2 100 127 0 20 0 0 none 0 "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
59 1 1 1 2 100 127 0 20 0 0 none 0 "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
60 1 5 1 9 100 127 0 40 5 1 none 0 "" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 1 1 1 () ""
|
||||
|
|
|
@ -200,32 +200,29 @@
|
|||
Play#1 input navi 54/55 n
|
||||
Play#1 command navigate
|
||||
Play#1 output Play#1 1 Flagship is pt patrol boat (#54)
|
||||
Play#1 output Play#1 1 is too large to fit into the canal system at 2,2
|
||||
Play#1 output Play#1 1 cs cargo ship (#55) is too large to fit into the canal system at 2,2 & stays in 1,1
|
||||
Play#1 output Play#1 1 h h
|
||||
Play#1 output Play#1 1 c c c
|
||||
Play#1 output Play#1 1 + +
|
||||
Play#1 output Play#1 4 <127.0:117.8: 2,2>
|
||||
Play#1 output Play#1 4 <117.8:117.8: 2,2>
|
||||
Play#1 input iyyh
|
||||
Play#1 output Play#1 1 shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech
|
||||
Play#1 output Play#1 1 54 pt patrol boat 2,2 100% 2 0 0 0 0 0 0 117 40
|
||||
Play#1 output Play#1 1 55 cs cargo ship 1,1 100% 5 0 0 0 0 0 0 127 20
|
||||
Play#1 output Play#1 1 pt patrol boat (#54) stopped at 0,0
|
||||
Play#1 output Play#1 1 cs cargo ship (#55) stopped at -1,-1
|
||||
Play#1 output Play#1 6 0 623
|
||||
Play#1 input navi 57/56 n
|
||||
Play#1 command navigate
|
||||
Play#1 output Play#1 1 Flagship is cs cargo ship (#57)
|
||||
Play#1 output Play#1 1 is too large to fit into the canal system at 2,2
|
||||
Play#1 output Play#1 1 . =
|
||||
Play#1 output Play#1 1 h h h
|
||||
Play#1 output Play#1 1 c c
|
||||
Play#1 output Play#1 4 <127.0:127.0: 1,1>
|
||||
Play#1 output Play#1 1 cs cargo ship (#57) is too large to fit into the canal system at 2,2 & stays in 1,1
|
||||
Play#1 output Play#1 1 Changing flagship to pt patrol boat (#56)
|
||||
Play#1 output Play#1 1 h h
|
||||
Play#1 output Play#1 1 c c c
|
||||
Play#1 output Play#1 1 + +
|
||||
Play#1 output Play#1 4 <117.8:117.8: 2,2>
|
||||
Play#1 input iyyh
|
||||
Play#1 output Play#1 1 shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech
|
||||
Play#1 output Play#1 1 57 cs cargo ship 1,1 100% 5 0 0 0 0 0 0 127 20
|
||||
Play#1 output Play#1 1 56 pt patrol boat 1,1 100% 2 0 0 0 0 0 0 127 40
|
||||
Play#1 output Play#1 1 cs cargo ship (#57) stopped at -1,-1
|
||||
Play#1 output Play#1 1 pt patrol boat (#56) stopped at -1,-1
|
||||
Play#1 output Play#1 1 56 pt patrol boat 2,2 100% 2 0 0 0 0 0 0 117 40
|
||||
Play#1 output Play#1 1 pt patrol boat (#56) stopped at 0,0
|
||||
Play#1 output Play#1 6 0 622
|
||||
Play#1 input navi 58/59 nX
|
||||
Play#1 command navigate
|
||||
|
@ -1409,9 +1406,9 @@
|
|||
Play#0 output Play#0 1 1 52 pt patrol boat 2,0 100% 0 2 0 0 0 0 0 0 117 40
|
||||
Play#0 output Play#0 1 1 53 pt patrol boat 4,0 100% 0 2 0 0 0 0 0 0 127 40
|
||||
Play#0 output Play#0 1 1 54 pt patrol boat 0,0 100% 0 2 0 0 0 0 0 0 99 40
|
||||
Play#0 output Play#0 1 1 55 cs cargo ship -1,-1 100% 0 5 0 0 0 0 0 0 97 20
|
||||
Play#0 output Play#0 1 1 56 pt patrol boat -1,-1 100% 0 2 0 0 0 0 0 0 108 40
|
||||
Play#0 output Play#0 1 1 57 cs cargo ship -1,-1 100% 0 5 0 0 0 0 0 0 97 20
|
||||
Play#0 output Play#0 1 1 55 cs cargo ship 1,1 100% 0 5 0 0 0 0 0 0 127 20
|
||||
Play#0 output Play#0 1 1 56 pt patrol boat 0,0 100% 0 2 0 0 0 0 0 0 99 40
|
||||
Play#0 output Play#0 1 1 57 cs cargo ship 1,1 100% 0 5 0 0 0 0 0 0 127 20
|
||||
Play#0 output Play#0 1 1 58 cs cargo ship 1,1 100% 0 5 0 0 0 0 0 0 127 20
|
||||
Play#0 output Play#0 1 1 59 cs cargo ship 1,1 100% 0 5 0 0 0 0 0 0 127 20
|
||||
Play#0 output Play#0 1 1 60 pt patrol boat 5,1 100% 0 2 0 0 0 0 0 0 127 40
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue