]> git.pond.sub.org Git - empserver/commitdiff
ltend: Fail more nicely when land unit isn't on tender
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 12 Sep 2017 08:04:25 +0000 (10:04 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 5 Jan 2021 06:25:17 +0000 (07:25 +0100)
Land units not on the tender are silently ignored.  This may leave the
player guessing why the command did nothing.  Reporting them all would
be annoying; I just changed tend to report only explicitly named ones.
Make ltend behave the same.

This does add a related annoyance: ltend can complain "not on ship"
when tending explicitly selected land units from multiple ships.
Tolerable.

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

index 47804e825370b5baaac73ecfe9f6be20722afdf6..a770f4c4ccda5a7e77a976bcbef942eb1da7b4c1 100644 (file)
@@ -32,6 +32,7 @@
  *     Thomas Ruschak
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
+ *     Markus Armbruster, 2004-2017
  */
 
 #include <config.h>
@@ -99,9 +100,12 @@ ltend(void)
        while (nxtitem(&targets, &target)) {
            if (!player->owner)
                continue;
-
-           if (target.lnd_ship != tender.shp_uid)
+           if (target.lnd_ship != tender.shp_uid) {
+               if (targets.sel == NS_LIST)
+                   pr("%s is not on %s!\n",
+                      prland(&target), prship(&tender));
                continue;
+           }
            ontarget = target.lnd_item[ip->i_uid];
            if (ontarget == 0 && amt < 0) {
                pr("No %s on %s\n", ip->i_name, prland(&target));
index 498c5ac6ef3903ee3ca4a3cff95bfdea2022bd75..987a54c4497dd8bbf3fb3701c9c75bb8d1b6656b 100644 (file)
@@ -32,7 +32,6 @@ ltend f 200 1 n
 ltend f 200 1 26
 | not on ship
 ltend f 200 1 0
-| usability: does nothing silently
 |
 || from ship to land
 | something the ship can't hold
index ec0b183f57a825f378fe271ca1ac374a7656d31a..c1d558b32ce4ded526acd51155de9258c37ebc87 100644 (file)
     Play#1 output Play#1 6 0 372
     Play#1 input ltend f 200 1 0
     Play#1 command ltend
+    Play#1 output Play#1 1 linf light infantry #0 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 0 total food transferred off of cs   cargo ship (#200)
     Play#1 output Play#1 6 0 371
     Play#1 input ltend i 200/201 1 350/352
     Play#1 output Play#1 6 0 370
     Play#1 input ltend c 200/201 1 350/352
     Play#1 command ltend
+    Play#1 output Play#1 1 sup  supply #352 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 0 total civilians transferred off of cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 0 total civilians transferred off of cs   cargo ship (#201)
     Play#1 output Play#1 6 0 369
     Play#1 input ltend h 200/201 1 350/352
     Play#1 command ltend
     Play#1 output Play#1 1 cs   cargo ship (#200) out of shells
     Play#1 output Play#1 1 7 total shells transferred off of cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
+    Play#1 output Play#1 1 sup  supply #351 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 5 total shells transferred off of cs   cargo ship (#201)
     Play#1 output Play#1 6 0 366
     Play#1 input ltend g 200/201 21 350/352
     Play#1 command ltend
+    Play#1 output Play#1 1 sup  supply #352 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 10 total guns transferred off of cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 10 total guns transferred off of cs   cargo ship (#201)
     Play#1 output Play#1 6 0 365
     Play#1 input ltend i 200/201 -1 350/352
     Play#1 input ltend c 200/201 -1 350/352
     Play#1 command ltend
     Play#1 output Play#1 1 No civilians on sup  supply #350
+    Play#1 output Play#1 1 sup  supply #352 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 0 total civilians transferred to cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 No civilians on sup  supply #352
     Play#1 output Play#1 1 0 total civilians transferred to cs   cargo ship (#201)
     Play#1 output Play#1 6 0 363
     Play#1 input ltend l 200/201 -1 350/352
     Play#1 command ltend
     Play#1 output Play#1 1 No light products on sup  supply #350
+    Play#1 output Play#1 1 sup  supply #352 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 0 total light products transferred to cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 No light products on sup  supply #352
     Play#1 output Play#1 1 0 total light products transferred to cs   cargo ship (#201)
     Play#1 output Play#1 6 0 362
     Play#1 input ltend s 200/201 -20 351/352
     Play#1 command ltend
+    Play#1 output Play#1 1 sup  supply #352 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 2 total shells transferred to cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #351 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 5 total shells transferred to cs   cargo ship (#201)
     Play#1 output Play#1 6 0 361
     Play#1 input ltend m 200/201 -25 350/351/352
     Play#1 command ltend
+    Play#1 output Play#1 1 sup  supply #352 is not on cs   cargo ship (#200)!
     Play#1 output Play#1 1 30 total military transferred to cs   cargo ship (#200)
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
+    Play#1 output Play#1 1 sup  supply #351 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 25 total military transferred to cs   cargo ship (#201)
     Play#1 output Play#1 6 0 360
     Play#1 input ltend
     Play#1 input -1
     Play#1 output Play#1 4 Units to be tended?
     Play#1 input 350
+    Play#1 output Play#1 1 sup  supply #350 is not on cs   cargo ship (#201)!
     Play#1 output Play#1 1 0 total food transferred to cs   cargo ship (#201)
     Play#1 output Play#1 6 0 359
     Play#1 input ctld
     Play#0 output Play#0 6 0 640
     Play#0 input ltend m 160 1 310
     Play#0 command ltend
+    Play#0 output Play#0 1 cav  cavalry #310 is not on cs   cargo ship (#160)!
     Play#0 output Play#0 1 0 total military transferred off of cs   cargo ship (#160)
     Play#0 output Play#0 6 0 639
     Play#0 input ltend m 200 1 350