]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/tend.c
commands: Rename the command functions
[empserver] / src / lib / commands / tend.c
index 516e4861acf72bcccbd7c51fde27443d5d50b01b..5bce717724129dbddd6a99bc12bc5c1f372948f6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2018, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -48,7 +48,7 @@ static void expose_ship(struct shpstr *s1, struct shpstr *s2);
 static int tend_land(struct shpstr *tenderp, int, char *units);
 
 int
-tend(void)
+c_tend(void)
 {
     struct nstr_item targets;
     struct nstr_item tenders;
@@ -159,6 +159,8 @@ tend(void)
                pr("%s out of %s\n", prship(&tender), ip->i_name);
                break;
            }
+           if (amt < 0 && tender.shp_item[ip->i_uid] == maxtender)
+               break;
        }
        pr("%d total %s transferred %s %s\n",
           total, ip->i_name, (amt > 0) ? "off of" : "to",
@@ -241,11 +243,13 @@ tend_comm_to(struct shpstr *from, struct ichrstr *ip, int amt,
        pr("No %s on %s\n", ip->i_name, prship(from));
        return 0;
     }
+    if (!can_take) {
+       pr("%s can't hold more %s\n", prship(to), ip->i_name);
+       return 0;
+    }
 
     transfer = MIN(can_give, amt);
     transfer = MIN(can_take, transfer);
-    if (transfer == 0)
-       return 0;
     from->shp_item[ip->i_uid] -= transfer;
     to->shp_item[ip->i_uid] += transfer;
     if (to->shp_own != player->cnum) {