diff options
author | Adam Borowski <kilobyte@angband.pl> | 2010-12-04 13:18:26 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2010-12-04 13:18:26 +0100 |
commit | 2cb71e7823912f4717d07a1d0440a787e4355cce (patch) | |
tree | b9a3ae6899b23e54825a4bcea0407f74365a1020 /crawl-ref/source/ng-input.cc | |
parent | b74532d2ae3adfd35c91a13ffcd7f443656b3f9a (diff) | |
download | crawl-ref-2cb71e7823912f4717d07a1d0440a787e4355cce.tar.gz crawl-ref-2cb71e7823912f4717d07a1d0440a787e4355cce.zip |
Restrict the player's name length properly in all(?) cases.
Diffstat (limited to 'crawl-ref/source/ng-input.cc')
-rw-r--r-- | crawl-ref/source/ng-input.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crawl-ref/source/ng-input.cc b/crawl-ref/source/ng-input.cc index 316dd8b165..81d73a0629 100644 --- a/crawl-ref/source/ng-input.cc +++ b/crawl-ref/source/ng-input.cc @@ -140,6 +140,13 @@ bool validate_player_name(const std::string &name, bool verbose) } #endif + if (strwidth(name) > kNameLen) + { + if (verbose) + cprintf("\nThat name is too long.\n"); + return (false); + } + for (unsigned int i = 0; i < name.length(); i++) { char c = name[i]; |