]> git.pond.sub.org Git - empserver/commitdiff
Fix seqno mismatch in fly()
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 12 Jul 2008 14:56:30 +0000 (10:56 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 12 Jul 2008 18:51:18 +0000 (14:51 -0400)
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().

src/lib/commands/fly.c

index ed55fbca0d53851b79c673deba41c796df3f330d..1fdfef90e13d340355e53573d68b7c9ded25c363 100644 (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);