]> git.pond.sub.org Git - empserver/commitdiff
Don't let fly and drop give away civilians
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jun 2012 19:29:15 +0000 (21:29 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 13 Jul 2012 18:15:33 +0000 (20:15 +0200)
Flying them to a foreign destination magically changes their
allegiance.  Prohibit that.

Equivalent change was already in commit 35887222 (v4.2.17) but got
reverted immediately (commit 20199b22), because fly and drop should
stay consistent with load, which let you give away civilians then.  No
more since commit 92a366ce (v4.3.20).  This change makes fly and drop
consistent with load again.

src/lib/commands/drop.c
src/lib/commands/fly.c

index 9441fdfa66093bc1ee7f11fa1a80cbd7d3fbc844..330f9cd47f665ceee8d1ea9a2a2da67072f1fc8c 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Dave Pare, 1986
- *     Markus Armbruster, 2004-2011
+ *     Markus Armbruster, 2004-2012
  */
 
 #include <config.h>
@@ -74,9 +74,15 @@ drop(void)
 
     if (relations_with(target.sct_own, player->cnum) == ALLIED) {
        /* own or allied sector: cargo drop */
-       if (ip->i_uid == I_CIVIL && target.sct_own != target.sct_oldown) {
-           pr("Can't drop civilians into occupied sectors.\n");
-           return RET_FAIL;
+       if (ip->i_uid == I_CIVIL) {
+           if (target.sct_own != player->cnum) {
+               pr("Your civilians refuse to board a flight abroad!\n");
+               return RET_FAIL;
+           }
+           if (target.sct_own != target.sct_oldown) {
+               pr("Can't drop civilians into occupied sectors.\n");
+               return RET_FAIL;
+           }
        }
        wantflags = P_C;
     } else {
index f3d723b059fb9c0d4176ecaca67931fc2da638c9..f861b331b2e523c69b4092f4c1f57e3d6bd327a2 100644 (file)
@@ -80,11 +80,16 @@ fly(void)
        return RET_SYN;
     cno = target.gen.ef_type == EF_SHIP ? target.gen.uid : -1;
 
-    if (ip && ip->i_uid == I_CIVIL
-       && target.gen.ef_type == EF_SECTOR
-       && target.sect.sct_own != target.sect.sct_oldown) {
-       pr("Can't fly civilians into occupied sectors.\n");
-       return RET_FAIL;
+    if (ip && ip->i_uid == I_CIVIL) {
+       if (target.gen.own != player->cnum) {
+           pr("Your civilians refuse to board a flight abroad!\n");
+           return RET_FAIL;
+       }
+       if (target.gen.ef_type == EF_SECTOR
+           && target.sect.sct_own != target.sect.sct_oldown) {
+           pr("Can't fly civilians into occupied sectors.\n");
+           return RET_FAIL;
+       }
     }
 
     ap_to_target = strlen(flightpath);