diff options
author | gammafunk <gammafunk@gmail.com> | 2014-03-17 20:10:33 -0500 |
---|---|---|
committer | gammafunk <gammafunk@gmail.com> | 2014-03-18 00:16:40 -0500 |
commit | a18227ede66e02d668551662e35476ed00ef7e13 (patch) | |
tree | 7f6fca6ea4bf53148232bacfc35698eef069b604 /crawl-ref/source/wiz-you.cc | |
parent | fbd6e7ded89bf1ad2ebe2393fe0c11dd2e298bd0 (diff) | |
download | crawl-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.cc | 8 |
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() |