From a18227ede66e02d668551662e35476ed00ef7e13 Mon Sep 17 00:00:00 2001 From: gammafunk Date: Mon, 17 Mar 2014 20:10:33 -0500 Subject: 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. --- crawl-ref/source/wiz-you.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/wiz-you.cc') 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() -- cgit v1.2.3-54-g00ecf