]> git.pond.sub.org Git - empserver/commitdiff
tend: Report "cannot hold any" when tending to target, too
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 15 Sep 2017 14:51:46 +0000 (16:51 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 5 Jan 2021 06:25:17 +0000 (07:25 +0100)
We report

    frg  frigate (#170) cannot hold any uncompensated workers

only when tending from target to tender, not for the other direction.
Report it there, too.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/tend.c
tests/load-tend/03-tend-1
tests/load-tend/journal.log

index 1679ca94ec6ca2eb4d1c964589b980e660b88d47..516e4861acf72bcccbd7c51fde27443d5d50b01b 100644 (file)
@@ -227,6 +227,10 @@ tend_comm_to(struct shpstr *from, struct ichrstr *ip, int amt,
     int can_take = to_max - to->shp_item[ip->i_uid];
     int transfer;
 
+    if (!to_max) {
+       pr("%s cannot hold any %s\n", prship(to), ip->i_name);
+       return 0;
+    }
     if (ip->i_uid == I_CIVIL && from->shp_own != to->shp_own) {
        pr("%s civilians refuse to board %s!\n",
           from->shp_own == player->cnum ? "Your" : "Foreign",
index 86bc2fb9b9ce4377ba5e339acedb9b75ee3bc410..9a61b5dbb5e4046c5f4bf2b934bc1a291a008d8f 100644 (file)
@@ -85,7 +85,6 @@ tend h 151 -1 150/152
 || tend something the target can't hold
 tend u 150 1 170/171
 tend u 170/171 -1 150
-| odd: only the second command reports "cannot hold"
 |
 || tend more than the tender has
 | #150 gives 7s, #152 gives 9s
index fd61cec5dc29d63adcff97881f85747b98f2b38e..994002fb36f53f943ca7754fbdecc10c4b29ed67 100644 (file)
     Play#1 output Play#1 6 0 403
     Play#1 input tend u 150 1 170/171
     Play#1 command tend
+    Play#1 output Play#1 1 frg  frigate (#170) cannot hold any uncompensated workers
+    Play#1 output Play#1 1 sb   submarine (#171) cannot hold any uncompensated workers
     Play#1 output Play#1 1 0 total uncompensated workers transferred off of cs   cargo ship (#150)
     Play#1 output Play#1 6 0 402
     Play#1 input tend u 170/171 -1 150