tty_askname() fix [#if UNIX || VMS]
Typing a response at the "Who are you?" prompt didn't allow digits in the character's name under Unix and VMS; something like "arc15" came out as "arc__". This allows them to be used anywhere except for the first character. "arc15" now works; "15arc" ends up as "_5arc" so that there still won't be a leading digit abutting the uid value when they're joined to form the save file name.
This commit is contained in:
@@ -296,6 +296,7 @@ tty: when loading user's run-time configuration, explicitly negating one of
|
|||||||
to regular ASCII and left the earlier option inaccurately set to "on"
|
to regular ASCII and left the earlier option inaccurately set to "on"
|
||||||
unix: remove use of parentheses in nethack man page usage that confused a
|
unix: remove use of parentheses in nethack man page usage that confused a
|
||||||
man page conversion tool
|
man page conversion tool
|
||||||
|
unix,vms: allow digits after first character in name at "Who are you?" prompt
|
||||||
winCE: disable processing of double-click messages if the first click
|
winCE: disable processing of double-click messages if the first click
|
||||||
causes map to scroll
|
causes map to scroll
|
||||||
Windows, probably MSDOS and OS/2: attempting to use very first false rumor
|
Windows, probably MSDOS and OS/2: attempting to use very first false rumor
|
||||||
|
|||||||
+5
-1
@@ -754,7 +754,11 @@ tty_askname()
|
|||||||
}
|
}
|
||||||
#if defined(UNIX) || defined(VMS)
|
#if defined(UNIX) || defined(VMS)
|
||||||
if(c != '-' && c != '@')
|
if(c != '-' && c != '@')
|
||||||
if(c < 'A' || (c > 'Z' && c < 'a') || c > 'z') c = '_';
|
if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') &&
|
||||||
|
/* reject leading digit but allow digits elsewhere
|
||||||
|
(avoids ambiguity when character name gets
|
||||||
|
appended to uid to construct save file name) */
|
||||||
|
!(c >= '0' && c <= '9' && ct > 0)) c = '_';
|
||||||
#endif
|
#endif
|
||||||
if (ct < (int)(sizeof plname) - 1) {
|
if (ct < (int)(sizeof plname) - 1) {
|
||||||
#if defined(MICRO)
|
#if defined(MICRO)
|
||||||
|
|||||||
Reference in New Issue
Block a user