summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/newgame.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-31 09:46:45 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-31 09:46:45 +0000
commit02e7394788cbf2791604f7f9ef4e1b7c2869824f (patch)
tree3f2a7b782087757a2c469552aefda65ce1cca261 /crawl-ref/source/newgame.cc
parentfccafaa9559184dd0b757ed8bc476f14d673ee17 (diff)
downloadcrawl-ref-02e7394788cbf2791604f7f9ef4e1b7c2869824f.tar.gz
crawl-ref-02e7394788cbf2791604f7f9ef4e1b7c2869824f.zip
Merge r9855 from trunk: Stricter sanity checking of player ghosts.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@9857 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r--crawl-ref/source/newgame.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 715da38fef..c92c7c7d41 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