diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-05-30 22:51:06 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-05-30 22:51:06 +0000 |
commit | ab9e5b3a883d8b42d96e76b1540c333f59400dd8 (patch) | |
tree | 091bd23e0d1d873cd2648a0684987311e7cbdf91 /crawl-ref/source/newgame.cc | |
parent | f4bb02dd66fdf77bfd0ec304e4ae160a27916f42 (diff) | |
download | crawl-ref-ab9e5b3a883d8b42d96e76b1540c333f59400dd8.tar.gz crawl-ref-ab9e5b3a883d8b42d96e76b1540c333f59400dd8.zip |
Stricter sanity checking of player ghosts.0.6.0-a0
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9855 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r-- | crawl-ref/source/newgame.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 343ce30af1..7cc59df69c 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -3294,12 +3294,17 @@ static void _enter_player_name(bool blankOK) static bool _validate_player_name(bool verbose) { + return validate_player_name(you.your_name, verbose); +} + +bool validate_player_name(const char* name, bool verbose) +{ #if defined(DOS) || defined(WIN32CONSOLE) || defined(WIN32TILES) // Quick check for CON -- blows up real good under DOS/Windows. - if (stricmp(you.your_name, "con") == 0 - || stricmp(you.your_name, "nul") == 0 - || stricmp(you.your_name, "prn") == 0 - || strnicmp(you.your_name, "LPT", 3) == 0) + if (stricmp(name, "con") == 0 + || stricmp(name, "nul") == 0 + || stricmp(name, "prn") == 0 + || strnicmp(name, "LPT", 3) == 0) { if (verbose) cprintf(EOL "Sorry, that name gives your OS a headache." EOL); @@ -3307,7 +3312,7 @@ static bool _validate_player_name(bool verbose) } #endif - for (const char *pn = you.your_name; *pn; ++pn) + for (const char *pn = name; *pn; ++pn) { char c = *pn; // Note that this includes systems which may be using the |