m_menu: add textinput special case for playername string

itself it already checks to not write out of bounds, this is mostly just to fix visual issues
kind hacky, but works for now
This commit is contained in:
Alug committed 2025-10-21 14:45:10 +02:00
1 parent 71e9c4f5af
commit 51b8dc9101
1 file changed
+7 -1
+7 -1
View File
@@ -702,7 +702,13 @@ static void M_CheckStringItem(void)
// Just in case
memset(menu_text_input_buf, 0, sizeof menu_text_input_buf);
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
// special case: name input, cap it to prevent writing outside the textbox
// kinda ugly but itll work
if (cv == &cv_playername)
M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1);
else
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
M_TextInputSetString(&menuinput, cv->string);
}