H2162 - topten handling of long names

<Someone> reported that being killed by a monster with a long name
can result in nethack going into an infinte loop printing spaces.  Handle
this by detecting attempts to wrap the topten output on a word that is too
long and just inserting breaks in the middle of the word in this case.
This commit is contained in:
cohrs
2010-12-28 19:43:01 +00:00
parent 3cdc140c72
commit 8047d6a5f8
2 changed files with 7 additions and 1 deletions

View File

@@ -681,10 +681,15 @@ boolean so;
!(*bp == ' ' && (bp-linebuf < hppos));
bp--)
;
/* special case: word is too long, wrap in the middle */
if (linebuf+15 >= bp) bp = linebuf + hppos - 1;
/* special case: if about to wrap in the middle of maximum
dungeon depth reached, wrap in front of it instead */
if (bp > linebuf + 5 && !strncmp(bp - 5, " [max", 5)) bp -= 5;
Strcpy(linebuf3, bp+1);
if (*bp != ' ')
Strcpy(linebuf3, bp);
else
Strcpy(linebuf3, bp+1);
*bp = 0;
if (so) {
while (bp < linebuf + (COLNO-1)) *bp++ = ' ';