summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/wiz-you.cc
diff options
context:
space:
mode:
authorgammafunk <gammafunk@gmail.com>2014-03-17 20:10:33 -0500
committergammafunk <gammafunk@gmail.com>2014-03-18 00:16:40 -0500
commita18227ede66e02d668551662e35476ed00ef7e13 (patch)
tree7f6fca6ea4bf53148232bacfc35698eef069b604 /crawl-ref/source/wiz-you.cc
parentfbd6e7ded89bf1ad2ebe2393fe0c11dd2e298bd0 (diff)
downloadcrawl-ref-a18227ede66e02d668551662e35476ed00ef7e13.tar.gz
crawl-ref-a18227ede66e02d668551662e35476ed00ef7e13.zip
Clean up the player hp change and calculation functions
Move calc_hp() to player.cc, and fix all but a couple instances where you.hp is changed directly to use set_hp() instead. We'll eventually just move these functions to inline methods for the player class, but this reorganization will do for now.
Diffstat (limited to 'crawl-ref/source/wiz-you.cc')
-rw-r--r--crawl-ref/source/wiz-you.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index 58e6e532ef..f563566f14 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -1006,9 +1006,13 @@ static void debug_uptick_xl(int newxl, bool train)
level_change(NON_MONSTER, NULL, true);
}
+/**
+ * Set the player's XL to a new value.
+ * @param newxl The new experience level.
+ */
static void debug_downtick_xl(int newxl)
{
- you.hp = you.hp_max;
+ set_hp(you.hp_max);
you.hp_max_perm += 1000; // boost maxhp so we don't die if heavily rotted
you.experience = exp_needed(newxl);
level_change();
@@ -1025,7 +1029,7 @@ static void debug_downtick_xl(int newxl)
calc_hp();
}
- you.hp = max(1, you.hp);
+ set_hp(max(1, you.hp));
}
void wizard_set_xl()