summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-01 00:10:47 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-01 00:10:47 +0000
commit06fba355d8d03c7df958e47e8e2ef191b52ad84d (patch)
tree418a9e5e85b04d61536506ed7719704dc8495b99 /crawl-ref/source/player.cc
parent0f446f8a4740da0bb8fca0ba05e3ed139608e609 (diff)
downloadcrawl-ref-06fba355d8d03c7df958e47e8e2ef191b52ad84d.tar.gz
crawl-ref-06fba355d8d03c7df958e47e8e2ef191b52ad84d.zip
Fix [2728128]: Properly scale current HP to maximum HP when changing
levels. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9712 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index a6bb401b64..4f5f0a1346 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2982,6 +2982,9 @@ void level_change(bool skip_attribute_increase)
skip_more = true;
}
+ const int old_hp = you.hp;
+ const int old_maxhp = you.hp_max;
+
int hp_adjust = 0;
int mp_adjust = 0;
@@ -3521,6 +3524,7 @@ void level_change(bool skip_attribute_increase)
deflate_hp(you.hp_max, false);
+ you.hp = old_hp * you.hp_max / old_maxhp;
you.magic_points = std::max(0, you.magic_points);
// Get "real" values for note-taking, i.e. ignore Berserk,