From f4173adc88783f897d5858f0e8ebc6902b43553d Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 30 Mar 2026 16:40:37 +0300 Subject: [PATCH] Use define for player name length in botl This defines the cut-off how many characters of the player's name is shown in the bottom status line. Also increase the limit from 10 characters to 16. --- include/botl.h | 3 +++ src/botl.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/botl.h b/include/botl.h index 87c82d25c..1a1507010 100644 --- a/include/botl.h +++ b/include/botl.h @@ -27,6 +27,9 @@ Astral Plane \GXXXXNNNN:123456 HP:1234(1234) Pw:1234(1234) AC:-127 #define MAXCO (COLNO + 40) #endif +/* limit of the player's name in the status window */ +#define BOTL_NSIZ 16 + struct condmap { const char *id; unsigned long bitmask; diff --git a/src/botl.c b/src/botl.c index 7071e6638..934d9e7ee 100644 --- a/src/botl.c +++ b/src/botl.c @@ -57,7 +57,7 @@ do_statusline1(void) Strcpy(newbot1, svp.plname); if ('a' <= newbot1[0] && newbot1[0] <= 'z') newbot1[0] += 'A' - 'a'; - newbot1[10] = 0; + newbot1[BOTL_NSIZ] = 0; Sprintf(nb = eos(newbot1), " the "); if (Upolyd) { @@ -769,12 +769,12 @@ bot_via_windowport(void) nb[0] = highc(nb[0]); titl = !Upolyd ? rank() : pmname(&mons[u.umonnum], Ugender); i = (int) (strlen(buf) + sizeof " the " + strlen(titl) - sizeof ""); - /* if "Name the Rank/monster" is too long, we truncate the name - but always keep at least 10 characters of it; when hitpointbar is + /* if "Name the Rank/monster" is too long, we truncate the name but + always keep at least BOTL_NSIZ characters of it; when hitpointbar is enabled, anything beyond 30 (long monster name) will be truncated */ if (i > 30) { i = 30 - (int) (sizeof " the " + strlen(titl) - sizeof ""); - nb[max(i, 10)] = '\0'; + nb[max(i, BOTL_NSIZ)] = '\0'; } Strcpy(nb = eos(nb), " the "); Strcpy(nb = eos(nb), titl);