]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/fly.c
(fly): Prohibit flying of civilians into occupied or allied sectors.
[empserver] / src / lib / commands / fly.c
index 724a65773c58d576b163f18cf9df02f3749a3fcc..706a31bd04a9d997efdd2070fc9d322211ccc2cd 100644 (file)
@@ -98,11 +98,10 @@ fly(void)
     ty = ay;
     (void)pathtoxy(flightpath, &tx, &ty, fcost);
     pr("Ending sector is %s\n", xyas(tx, ty, player->cnum));
-    getsect(tx, ty, &target);
-    cno = -1;
     ip = whatitem(player->argp[5], "transport what? ");
     getsect(tx, ty, &target);
-    mission_flags = 0;
+
+    cno = -1;
     if (pln_onewaymission(&target, &cno, &wantflags) < 0)
        return RET_SYN;
     if (cno < 0) {
@@ -113,6 +112,17 @@ fly(void)
        dst_ptr = (s_char *)&ship;
        dst_type = EF_SHIP;
     }
+
+    if (ip && ip->i_vtype == V_CIVIL) {
+       if (target.sct_own != player->cnum) {
+           pr("Your civilians refuse to emigrate!\n");
+           return RET_FAIL;
+       } else if (target.sct_own != target.sct_oldown) {
+           pr("Can't drop civilians into occupied sectors.\n");
+           return RET_FAIL;
+       }
+    }
+
     ap_to_target = strlen(flightpath);
     if (*(flightpath + strlen(flightpath) - 1) == 'h')
        ap_to_target--;
@@ -120,6 +130,7 @@ fly(void)
     /*
      * select planes within range
      */
+    mission_flags = 0;
     pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
            1, wantflags, P_M | P_O);
     if (QEMPTY(&bomb_list)) {