From eb5ed8802a9ffbcfc081d39655c690e6a4e3b172 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 12 Sep 2017 10:04:25 +0200 Subject: [PATCH] ltend: Fail more nicely when land unit isn't on tender 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 --- src/lib/commands/lten.c | 8 ++++++-- tests/load-tend/05-ltend-1 | 1 - tests/load-tend/journal.log | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/lib/commands/lten.c b/src/lib/commands/lten.c index 47804e82..a770f4c4 100644 --- a/src/lib/commands/lten.c +++ b/src/lib/commands/lten.c @@ -32,6 +32,7 @@ * Thomas Ruschak * Ken Stevens, 1995 * Steve McClure, 1998 + * Markus Armbruster, 2004-2017 */ #include @@ -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)); diff --git a/tests/load-tend/05-ltend-1 b/tests/load-tend/05-ltend-1 index 498c5ac6..987a54c4 100644 --- a/tests/load-tend/05-ltend-1 +++ b/tests/load-tend/05-ltend-1 @@ -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 diff --git a/tests/load-tend/journal.log b/tests/load-tend/journal.log index ec0b183f..c1d558b3 100644 --- a/tests/load-tend/journal.log +++ b/tests/load-tend/journal.log @@ -2512,6 +2512,7 @@ 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 @@ -2521,7 +2522,9 @@ 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 @@ -2536,11 +2539,15 @@ 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 @@ -2551,25 +2558,34 @@ 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 @@ -2602,6 +2618,7 @@ 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 @@ -2624,6 +2641,7 @@ 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