summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-grow.cc
diff options
context:
space:
mode:
authorSamuel Bronson <naesten@gmail.com>2011-12-02 18:26:24 -0500
committerSamuel Bronson <naesten@gmail.com>2011-12-02 18:26:24 -0500
commita1df1363570653bc89bc6d5362a414b734f89bea (patch)
tree3d2fdbd9d293b9eba9212703e5a52684d3653c5b /crawl-ref/source/mon-grow.cc
parent1727034c4f490bf4d3ac94a994339e129678153c (diff)
downloadcrawl-ref-a1df1363570653bc89bc6d5362a414b734f89bea.tar.gz
crawl-ref-a1df1363570653bc89bc6d5362a414b734f89bea.zip
Implement CMD_TARGET_WIZARD_GAIN_LEVEL.
This required adding a parameter to monster::gain_exp specifying the maximum number of levels to be gained.
Diffstat (limited to 'crawl-ref/source/mon-grow.cc')
-rw-r--r--crawl-ref/source/mon-grow.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/mon-grow.cc b/crawl-ref/source/mon-grow.cc
index 2a03e86237..4ed92722fe 100644
--- a/crawl-ref/source/mon-grow.cc
+++ b/crawl-ref/source/mon-grow.cc
@@ -199,7 +199,7 @@ void monster::init_experience()
experience = mexplevs[std::min(hit_dice, MAX_MONS_HD)];
}
-bool monster::gain_exp(int exp)
+bool monster::gain_exp(int exp, int max_levels_to_gain)
{
if (!alive())
return (false);
@@ -224,11 +224,11 @@ bool monster::gain_exp(int exp)
const monster mcopy(*this);
int levels_gained = 0;
- // Monsters can gain a maximum of two levels from one kill.
+ // Monsters can normally gain a maximum of two levels from one kill.
while (hit_dice < MAX_MONS_HD
&& experience >= mexplevs[hit_dice + 1]
&& level_up()
- && ++levels_gained < 2);
+ && ++levels_gained < max_levels_to_gain);
if (levels_gained)
{