]> git.pond.sub.org Git - empserver/commitdiff
Fix tend not to leak which commodities are loaded on friendlies
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 11 Jun 2012 17:48:36 +0000 (19:48 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 24 Jun 2012 06:47:08 +0000 (08:47 +0200)
Tending a negative number of commodities takes from the target ships.
The target ships must be owned.  Tend complains when the target
doesn't have the commodity loaded.  It does that even for friendly
foreign ships.  Don't.

Broken when Chainsaw 2 added tending to allies.

src/lib/commands/tend.c

index 46eaeda39adc39db28389f0ab16e523b09d074ad..639a19d03411f06702844b390ae3c2679169e372 100644 (file)
@@ -141,16 +141,16 @@ tend(void)
                tender.shp_y != target.shp_y)
                continue;
            ontarget = target.shp_item[ip->i_uid];
-           if (ontarget == 0 && amt < 0) {
-               pr("No %s on %s\n", ip->i_name, prship(&target));
-               continue;
-           }
            vbase = &mchr[(int)target.shp_type];
            maxtarget = vbase->m_item[ip->i_uid];
            if (amt < 0) {
                /* take from target and give to tender */
                if (!player->owner)
                    continue;
+               if (ontarget == 0) {
+                   pr("No %s on %s\n", ip->i_name, prship(&target));
+                   continue;
+               }
                transfer = MIN(ontarget, -amt);
                transfer = MIN(maxtender - ontender, transfer);
                if (transfer == 0)