summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-clone.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-01-05 14:55:45 +0100
committerAdam Borowski <kilobyte@angband.pl>2012-01-05 15:08:09 +0100
commitb8daaf465ebac57c905efccb3ce5c0caa44aa94e (patch)
tree16e193ed4b0a4582fe2f87f2c18e30c10857013f /crawl-ref/source/mon-clone.cc
parent2db87d6d5c94edc73c41230093cc3d1cfe251bf1 (diff)
downloadcrawl-ref-b8daaf465ebac57c905efccb3ce5c0caa44aa94e.tar.gz
crawl-ref-b8daaf465ebac57c905efccb3ce5c0caa44aa94e.zip
Some more mindexicide.
Also, rename a variable "fmenv" in a few places, it referred to menv[f], and now only confuses grep.
Diffstat (limited to 'crawl-ref/source/mon-clone.cc')
-rw-r--r--crawl-ref/source/mon-clone.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/crawl-ref/source/mon-clone.cc b/crawl-ref/source/mon-clone.cc
index 91eff0cff6..95189c23f6 100644
--- a/crawl-ref/source/mon-clone.cc
+++ b/crawl-ref/source/mon-clone.cc
@@ -105,11 +105,9 @@ static void _mons_summon_monster_illusion(monster* caster,
unwind_var<mon_attitude_type> att(foe->attitude, clone_att);
bool cloning_visible = false;
- const int clone_idx = clone_mons(foe, true, &cloning_visible);
- if (clone_idx != NON_MONSTER)
+ if (monster *clone = clone_mons(foe, true, &cloning_visible))
{
const std::string clone_id = _monster_clone_id_for(foe);
- monster* clone = &menv[clone_idx];
clone->props[clone_slave_key] = clone_id;
foe->props[clone_master_key] = clone_id;
mons_add_blame(clone,
@@ -265,14 +263,14 @@ bool mons_clonable(const monster* mon, bool needs_adjacent)
return (true);
}
-int clone_mons(const monster* orig, bool quiet, bool* obvious,
- coord_def pos)
+monster* clone_mons(const monster* orig, bool quiet, bool* obvious,
+ coord_def pos)
{
// Is there an open slot in menv?
monster* mons = get_free_monster();
if (!mons)
- return (NON_MONSTER);
+ return 0;
if (!in_bounds(pos))
{
@@ -292,7 +290,7 @@ int clone_mons(const monster* orig, bool quiet, bool* obvious,
}
if (squares == 0)
- return (NON_MONSTER);
+ return 0;
}
ASSERT(!actor_at(pos));
@@ -348,5 +346,5 @@ int clone_mons(const monster* orig, bool quiet, bool* obvious,
if (crawl_state.game_is_arena())
arena_placed_monster(mons);
- return (mons->mindex());
+ return mons;
}