mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-17 23:21:05 +00:00
Allow letters to be used in the "Specify IPv4 Address:" field
This commit is contained in:
parent
5b9e6502f9
commit
bcddbdbfbf
1 changed files with 6 additions and 15 deletions
21
src/m_menu.c
21
src/m_menu.c
|
@ -7708,7 +7708,7 @@ static void M_StartServerMenu(INT32 choice)
|
|||
// CONNECT VIA IP
|
||||
// ==============
|
||||
|
||||
static char setupm_ip[16];
|
||||
static char setupm_ip[28];
|
||||
#endif
|
||||
static UINT8 setupm_pselect = 1;
|
||||
|
||||
|
@ -7741,12 +7741,12 @@ Update the maxplayers label...
|
|||
V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 239);
|
||||
|
||||
// draw name string
|
||||
V_DrawString(x+8,y+12, V_MONOSPACE, setupm_ip);
|
||||
V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, setupm_ip);
|
||||
|
||||
// draw text cursor for name
|
||||
if (itemOn == 8
|
||||
&& skullAnimCounter < 4) //blink cursor
|
||||
V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_MONOSPACE),y+12,'_',false);
|
||||
V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_ALLOWLOWERCASE),y+12,'_',false);
|
||||
#endif
|
||||
|
||||
// character bar, ripped off the color bar :V
|
||||
|
@ -7959,25 +7959,16 @@ static void M_HandleConnectIP(INT32 choice)
|
|||
break;
|
||||
|
||||
default:
|
||||
l = strlen(setupm_ip);
|
||||
if (l >= 16-1)
|
||||
if (choice < 32 || choice > 127) // also allows letters to be typed in so hostnames can be used instead of an IP
|
||||
break;
|
||||
|
||||
if (choice == 46 || (choice >= 48 && choice <= 57)) // Rudimentary number and period enforcing
|
||||
l = strlen(setupm_ip);
|
||||
if (l < 28-1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue