summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-04 08:12:50 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-04 08:12:50 +0000
commit0c5066560faff5d49fe240c76c650d00bea2129d (patch)
tree7bc9c300dd99c386de6d5f21f8dadd6b32eae1f7
parent360ab04717002167dea8848b04aeb12c7ea3f382 (diff)
downloadcrawl-ref-0c5066560faff5d49fe240c76c650d00bea2129d.tar.gz
crawl-ref-0c5066560faff5d49fe240c76c650d00bea2129d.zip
Allow monsters to be created by partial name with the &M wizard command.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7745 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/debug.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 986f602361..b5c1a9b113 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -480,8 +480,20 @@ void wizard_create_spec_monster_name()
if (!err.empty())
{
- mpr(err.c_str());
- return;
+ // Try for a partial match, but not if the user accidently entered
+ // only a few letters.
+ monster_type partial = get_monster_by_name(specs);
+ if (strlen(specs) >= 3 && partial != NON_MONSTER)
+ {
+ mlist.clear();
+ err = mlist.add_mons(mons_type_name(partial, DESC_PLAIN));
+ }
+
+ if (!err.empty())
+ {
+ mpr(err.c_str());
+ return;
+ }
}
mons_spec mspec = mlist.get_monster(0);