Fix seqno mismatch in fly()

fly() reads the carrier, then passes it to pln_dropoff(), which writes
it back.  fly() also calls pln_oneway_to_carrier_ok(), which updates
the carrier when its plane summary information is incorrect.

The old code called it between reading the carrier and passing it to
pln_dropoff().  This made pln_dropoff() wipe out the plane summary
update, and triggered a seqno mismatch oops.  Broken by introduction
of pln_oneway_to_carrier_ok() in commit 1127762c, v4.2.17.

Fix by reading the carrier right before passing it to pln_dropoff().
(cherry picked from commit 42d9475d89)
This commit is contained in:
Markus Armbruster 2008-07-12 10:56:30 -04:00
parent 1713f2d303
commit 6aefeea2a1

View file

@ -87,14 +87,6 @@ fly(void)
cno = -1;
if (pln_onewaymission(&target, &cno, &wantflags) < 0)
return RET_SYN;
if (cno < 0) {
dst_ptr = &target;
dst_type = EF_SECTOR;
} else {
getship(cno, &ship);
dst_ptr = &ship;
dst_type = EF_SHIP;
}
if (ip && ip->i_uid == I_CIVIL && target.sct_own != target.sct_oldown) {
pr("Can't fly civilians into occupied sectors.\n");
@ -142,6 +134,14 @@ fly(void)
pr("No planes got through fighter defenses\n");
} else {
getsect(tx, ty, &target);
if (cno < 0) {
dst_ptr = &target;
dst_type = EF_SECTOR;
} else {
getship(cno, &ship);
dst_ptr = &ship;
dst_type = EF_SHIP;
}
pln_dropoff(&bomb_list, ip, tx, ty, dst_ptr, dst_type);
pln_newlanding(&bomb_list, tx, ty, cno);
pln_newlanding(&esc_list, tx, ty, cno);