diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-24 05:04:58 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-24 05:04:58 +0000 |
commit | ee8bfe95919cb737826f04629698df9258200020 (patch) | |
tree | b8b4f48ee90c6c6c3efade2c8793fdd0f249f230 /crawl-ref/source/spl-util.cc | |
parent | bcbd0cca53601270c2b128eb9c89a9185cb40336 (diff) | |
download | crawl-ref-ee8bfe95919cb737826f04629698df9258200020.tar.gz crawl-ref-ee8bfe95919cb737826f04629698df9258200020.zip |
?/ now asks if you want to describe a monster, spell, or feature, and
filters out matches if they aren't of the desired type.
If there's more than one match, after selecting a match to look at,
exiting from the description will return you to the menu, rather than
to the dungeon.
If you've asked for monsters, you can toggle sorting of the menu
between alphabetical and by aproximated monster toughness (this probably
still needs some work, since it seems to say that ordinary worms are
tougher than brain worms).
Only the monster symbol is coloured when showing a menu of monsters
to describe.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2185 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r-- | crawl-ref/source/spl-util.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index d1b606199b..eb0865091b 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -83,6 +83,30 @@ void init_spell_descs(void) return; } // end init_spell_descs() +spell_type spell_by_name(const char* name) +{ + if (name == NULL || strlen(name) == 0) + return (SPELL_NO_SPELL); + + char spname[80]; + + for (int i = 0; i < NUM_SPELLS; i++) + { + spell_type type = static_cast<spell_type>(i); + strncpy( spname, spell_title(type), sizeof( spname ) ); + + if (strcasecmp(spname, name) == 0) + return (type); + } + + return (SPELL_NO_SPELL); +} + +spell_type spell_by_name(std::string name) +{ + return spell_by_name(name.c_str()); +} + int get_spell_slot_by_letter( char letter ) { ASSERT( isalpha( letter ) ); |