]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/move.c
(buy, move, prod, dodistribute, produce): Obey ITEM_MAX. Previous
[empserver] / src / lib / commands / move.c
index f68e1fc2612c9459163c8aae1b939d1b0807c6bd..fb4372a4ef88c8ebf93ea6fe45b84a09a8bc66ef 100644 (file)
@@ -228,7 +228,7 @@ move(void)
        left = mob;
     } else if (!istest) {
        /*
-          * decrement mobility appropriately.
+        * decrement mobility appropriately.
         */
        getsect(x, y, &start);
        mob = start.sct_mobil;
@@ -258,9 +258,10 @@ move(void)
     }
 
     amt_dst = sect.sct_item[vtype];
-    if (32767 - amt_dst < amount) {
+    if (amount > ITEM_MAX - amt_dst) {
        pr("Only enough room for %d in %s.  The goods will be returned.\n",
-          32767 - amt_dst, xyas(sect.sct_x, sect.sct_y, player->cnum));
+          ITEM_MAX - amt_dst, xyas(sect.sct_x, sect.sct_y, player->cnum));
+       /* FIXME Not nice.  Move what we can and return the rest.  */
        getsect(x, y, &sect);
     }
 
@@ -281,7 +282,7 @@ move(void)
            if (tsct.sct_own != player->cnum)
                continue;
            amt_dst = tsct.sct_item[vtype];
-           if (32767 - amt_dst < amount)
+           if (amount > ITEM_MAX - amt_dst)
                continue;
            n = -1;
            break;