mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-08-03 04:37:39 -04:00
break quit messages after at most 42 chars
if they do not contain explicit line breaks themselves Fixes #2263
This commit is contained in:
parent
7530deae79
commit
751cecb4e2
@ -2255,6 +2255,36 @@ void M_ResetAutoSave(void)
|
||||
// M_Init
|
||||
//
|
||||
|
||||
#define MAX_STRLEN 42
|
||||
|
||||
static void AddLineBreaks(char *string)
|
||||
{
|
||||
char *start = string;
|
||||
char *p = start;
|
||||
|
||||
while (strlen(p) > MAX_STRLEN)
|
||||
{
|
||||
start = p;
|
||||
p += MAX_STRLEN;
|
||||
|
||||
do
|
||||
{
|
||||
if (*p == ' ')
|
||||
{
|
||||
*p++ = '\n';
|
||||
break;
|
||||
}
|
||||
} while (--p > start);
|
||||
|
||||
if (p == start)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef MAX_STRLEN
|
||||
|
||||
void M_Init(void)
|
||||
{
|
||||
MN_InitDefaults(); // killough 11/98
|
||||
@ -2360,6 +2390,16 @@ void M_Init(void)
|
||||
free(replace);
|
||||
*endmsg[9] = string;
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_QUITMESSAGES; i++)
|
||||
{
|
||||
char *const msg = *endmsg[i];
|
||||
|
||||
if (strchr(msg, '\n') == NULL)
|
||||
{
|
||||
AddLineBreaks(*endmsg[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user