mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
break quit messages after at most 42 chars (#2267)
if they do not contain explicit line breaks themselves Fixes #2263
This commit is contained in:
parent
d28289ca1f
commit
81bf1e70c7
@ -2255,6 +2255,36 @@ void M_ResetAutoSave(void)
|
|||||||
// M_Init
|
// 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)
|
void M_Init(void)
|
||||||
{
|
{
|
||||||
MN_InitDefaults(); // killough 11/98
|
MN_InitDefaults(); // killough 11/98
|
||||||
@ -2360,6 +2390,16 @@ void M_Init(void)
|
|||||||
free(replace);
|
free(replace);
|
||||||
*endmsg[9] = string;
|
*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