From 60354872871ec7542eeb4a9c25dbba9b2dbc2d2e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 14 Sep 2017 12:18:56 +0200 Subject: [PATCH] tend ltend: Improve "cannot hold any" message Report the exact ship, like frg frigate (#170) cannot hold any uncompensated workers instead of reporting just the ship type, like A frg frigate cannot hold any uncompensated workers This is a bit more useful when tending to more than one ship. Signed-off-by: Markus Armbruster --- src/lib/commands/lten.c | 3 +-- src/lib/commands/tend.c | 3 +-- tests/load-tend/journal.log | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/commands/lten.c b/src/lib/commands/lten.c index 1dbe216c..0825ab73 100644 --- a/src/lib/commands/lten.c +++ b/src/lib/commands/lten.c @@ -90,8 +90,7 @@ ltend(void) vbase = &mchr[(int)tender.shp_type]; maxtender = vbase->m_item[ip->i_uid]; if (maxtender == 0) { - pr("A %s cannot hold any %s\n", - mchr[(int)tender.shp_type].m_name, ip->i_name); + pr("%s cannot hold any %s\n", prship(&tender), ip->i_name); continue; } if (!snxtitem(&targets, EF_LAND, diff --git a/src/lib/commands/tend.c b/src/lib/commands/tend.c index 66aca256..71d339f6 100644 --- a/src/lib/commands/tend.c +++ b/src/lib/commands/tend.c @@ -124,8 +124,7 @@ tend(void) vbase = &mchr[(int)tender.shp_type]; maxtender = vbase->m_item[ip->i_uid]; if (maxtender == 0) { - pr("A %s cannot hold any %s\n", - mchr[(int)tender.shp_type].m_name, ip->i_name); + pr("%s cannot hold any %s\n", prship(&tender), ip->i_name); continue; } if (!snxtitem(&targets, EF_SHIP, diff --git a/tests/load-tend/journal.log b/tests/load-tend/journal.log index d3f6a03e..53791499 100644 --- a/tests/load-tend/journal.log +++ b/tests/load-tend/journal.log @@ -2209,8 +2209,8 @@ Play#1 output Play#1 6 0 402 Play#1 input tend u 170/171 -1 150 Play#1 command tend - Play#1 output Play#1 1 A frg frigate cannot hold any uncompensated workers - Play#1 output Play#1 1 A sb submarine cannot hold any uncompensated workers + 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 6 0 401 Play#1 input tend s 150/152 5 t Play#1 command tend @@ -2567,8 +2567,8 @@ Play#1 output Play#1 6 0 365 Play#1 input ltend i 200/201 -1 350/352 Play#1 command ltend - Play#1 output Play#1 1 A cs cargo ship cannot hold any iron ore - Play#1 output Play#1 1 A cs cargo ship cannot hold any iron ore + Play#1 output Play#1 1 cs cargo ship (#200) cannot hold any iron ore + Play#1 output Play#1 1 cs cargo ship (#201) cannot hold any iron ore Play#1 output Play#1 6 0 364 Play#1 input ltend c 200/201 -1 350/352 Play#1 command ltend