diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-05-28 11:28:11 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-05-28 11:28:11 +0000 |
commit | d4065da159cb407f1680de9f03596cd397ded525 (patch) | |
tree | fc32656471babe9ddeb97e6cd8937adcd6b760a0 /crawl-ref/source/libutil.cc | |
parent | 20a6609453ee2b51c388c296516c1abc1beab1d2 (diff) | |
download | crawl-ref-d4065da159cb407f1680de9f03596cd397ded525.tar.gz crawl-ref-d4065da159cb407f1680de9f03596cd397ded525.zip |
Added new orc entries and vaults (Lemuel).
Added support to the map designer for specifying the monster-type for zombies,
skeletons, simulacra and spectral things. Also allow specifying the number of
heads for hydras ("12-headed hydra").
Fixed lexer rule bug (IDENTIFIER).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1490 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libutil.cc')
-rw-r--r-- | crawl-ref/source/libutil.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index a2fa623530..6bf33921ba 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -193,6 +193,25 @@ void lowercase(std::string &s) s[i] = tolower(s[i]); } +bool ends_with(const std::string &s, const std::string &suffix) +{ + if (s.length() < suffix.length()) + return false; + return (s.substr(s.length() - suffix.length()) == suffix); +} + +int ends_with(const std::string &s, const char *suffixes[]) +{ + if (!suffixes) + return (0); + for (int i = 0; suffixes[i]; ++i) + { + if (ends_with(s, suffixes[i])) + return (1 + i); + } + return (0); +} + std::string replace_all(std::string s, const std::string &find, const std::string &repl) |