tend: Fail more nicely when target can't take more commodities
We silently ignore target ships that can't take any more of the tended commodity. This may leave the player guessing why the command did nothing. Report the reason like this: cs cargo ship (#150) can't hold more guns Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
be5b167ce6
commit
70008c1b9f
2 changed files with 8 additions and 2 deletions
|
@ -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) {
|
||||
|
|
|
@ -2250,7 +2250,9 @@
|
|||
Play#1 output Play#1 1 0 total guns transferred off of cs cargo ship (#150)
|
||||
Play#1 output Play#1 1 5 total guns transferred off of cs cargo ship (#151)
|
||||
Play#1 output Play#1 1 3 total guns transferred off of cs cargo ship (#152)
|
||||
Play#1 output Play#1 1 cs cargo ship (#150) can't hold more guns
|
||||
Play#1 output Play#1 1 0 total guns transferred off of cs cargo ship (#153)
|
||||
Play#1 output Play#1 1 cs cargo ship (#150) can't hold more guns
|
||||
Play#1 output Play#1 1 0 total guns transferred off of cs cargo ship (#154)
|
||||
Play#1 output Play#1 6 0 398
|
||||
Play#1 input tend g 153 -40 t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue