summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-13 15:43:15 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-13 15:43:15 +0000
commit429bfc5a5c0ad6f4b934c027c9e00f049d59b196 (patch)
tree2a5eb5a55084ea1f1943f09cdce289ceaaef5e93 /crawl-ref/source/mapdef.cc
parente9e8ee7be9b059239801fa6a3dc9c4e4b7cfc36f (diff)
downloadcrawl-ref-429bfc5a5c0ad6f4b934c027c9e00f049d59b196.tar.gz
crawl-ref-429bfc5a5c0ad6f4b934c027c9e00f049d59b196.zip
Fix being unable to create hydra undead with requested number of heads (Eino).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10535 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc28
1 files changed, 17 insertions, 11 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 1a6d864f4e..d116bd6d4c 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2407,27 +2407,33 @@ void mons_list::get_zombie_type(std::string s, mons_spec &spec) const
{ MONS_SPECTRAL_THING, MONS_SPECTRAL_THING },
};
- const int mod = ends_with(s, zombie_types);
+ int mod = ends_with(s, zombie_types);
if (!mod)
{
- const std::string &spectre = "spectral ";
+ const std::string spectre("spectral ");
if (s.find(spectre) == 0)
{
+ mod = ends_with(" spectre", zombie_types);
s = s.substr(spectre.length());
- spec.mid = MONS_SPECTRAL_THING;
- spec.monbase = get_monster_by_name(s, true);
- if (!mons_zombie_size(spec.monbase))
- spec.mid = MONS_PROGRAM_BUG;
+ }
+ else
+ {
+ spec.mid = MONS_PROGRAM_BUG;
return;
}
- spec.mid = MONS_PROGRAM_BUG;
- return;
+ }
+ else
+ {
+ s = s.substr(0, s.length() - strlen(zombie_types[mod - 1]));
}
- s = s.substr(0, s.length() - strlen(zombie_types[mod - 1]));
trim_string(s);
- spec.monbase = get_monster_by_name(s, true);
+ mons_spec base_monster = mons_by_name(s);
+ if (base_monster.mid < 0)
+ base_monster.mid = MONS_PROGRAM_BUG;
+ spec.monbase = static_cast<monster_type>(base_monster.mid);
+ spec.number = base_monster.number;
const int zombie_size = mons_zombie_size(spec.monbase);
if (!zombie_size)
@@ -2604,7 +2610,7 @@ mons_spec mons_list::mons_by_name(std::string name) const
if (name == "large abomination")
return (MONS_ABOMINATION_LARGE);
- if (ends_with(name, "-headed hydra"))
+ if (ends_with(name, "-headed hydra") && !starts_with(name, "spectral "))
return get_hydra_spec(name);
mons_spec spec;