From fb6570cadee8884cfc805e070b82c59f828c3996 Mon Sep 17 00:00:00 2001 From: ThatAwesomeGuy173 Date: Sat, 26 Jan 2019 02:41:05 -0700 Subject: [PATCH] I accidentally the numpad also reduced the range of usable characters --- src/m_menu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 9d230a13..1e7f07b2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7959,16 +7959,25 @@ static void M_HandleConnectIP(INT32 choice) break; default: - if (choice < 32 || choice > 127) // also allows letters to be typed in so hostnames can be used instead of an IP + l = strlen(setupm_ip); + if (l >= 28-1) break; - l = strlen(setupm_ip); - if (l < 28-1) + // Rudimentary number and period enforcing - also allows letters so hostnames can be used instead + if ((choice >= 45 && choice <= 58) || (choice >= 65 && choice <= 90) || (choice >= 97 && choice <= 122)) { S_StartSound(NULL,sfx_menu1); // Tails setupm_ip[l] = (char)choice; setupm_ip[l+1] = 0; } + else if (choice >= 199 && choice <= 211 && choice != 202 && choice != 206) //numpad too! + { + char keypad_translation[] = {'7','8','9','-','4','5','6','+','1','2','3','0','.'}; + choice = keypad_translation[choice - 199]; + S_StartSound(NULL,sfx_menu1); // Tails + setupm_ip[l] = (char)choice; + setupm_ip[l+1] = 0; + } break; }