]> git.pond.sub.org Git - empserver/commitdiff
Fix pln_equip()'s check for foreign civilians
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 27 Sep 2009 00:43:01 +0000 (20:43 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 8 Dec 2009 07:15:50 +0000 (08:15 +0100)
Check the true load instead of the ip parameter.  Makes a difference
only when callers pass a bogus ip that isn't actually used.  Happens
for escorts, but then the call can only be reached for deities,
because for mortals the transports fail before the escorts.

src/lib/subs/plnsub.c

index 9bae8323b376722197797fb25dd094877118cd17..661529abbbc2c790abd5c8016a2d40dac1f3b0da 100644 (file)
@@ -637,14 +637,6 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
        item = sect.sct_item;
        own = sect.sct_oldown;
     }
-    if (ip) {
-       if (ip->i_uid == I_CIVIL) {
-           if (pp->pln_own != own) {
-               pr("You don't control those civilians!\n");
-               return -1;
-           }
-       }
-    }
     if (pcp->pl_fuel > item[I_PETROL]) {
        pr("%s not enough petrol there!\n", prplane(pp));
        return -1;
@@ -690,6 +682,10 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
            pr("%s can't contribute to mission\n", prplane(pp));
            return -1;
        }
+       if (itype == I_CIVIL && pp->pln_own != own) {
+           pr("You don't control those civilians!\n");
+           return -1;
+       }
        if (itype != I_NONE) {
 #if 0
            /* Supply is broken somewhere, so don't use it for now */