M_StringHeight: Guarantee that there will be enough vertical space in a Menu Message for the relevant lines

This commit is contained in:
toaster 2023-06-17 00:51:04 +01:00
parent d0ce442850
commit 3cbbcfd253

View file

@ -14,11 +14,14 @@ struct menumessage_s menumessage;
// //
static inline size_t M_StringHeight(const char *string) static inline size_t M_StringHeight(const char *string)
{ {
size_t h = 8, i; size_t h = 8, i, len = strlen(string);
for (i = 0; i < strlen(string); i++) for (i = 0; i < len; i++)
if (string[i] == '\n') {
h += 8; if (string[i] != '\n' && i != len-1)
continue;
h += 8;
}
return h; return h;
} }