From 760579ccd2bbf5599dd615f57d04de17fdbf7735 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 30 Jun 2008 16:42:26 +0000 Subject: Properly redraw the player's skill level, experience level, etc. after losing a level due to draining. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6253 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/ouch.cc | 13 ++++++++----- crawl-ref/source/player.cc | 6 ++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index ca34b768e0..0ba00752e0 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -68,6 +68,7 @@ #include "mon-util.h" #include "monstuff.h" #include "notes.h" +#include "output.h" #include "player.h" #include "randart.h" #include "religion.h" @@ -726,8 +727,7 @@ void drain_exp(bool announce_full) you.experience -= exp_drained; you.exp_available -= exp_drained; - if (you.exp_available < 0) - you.exp_available = 0; + you.exp_available = std::max(0, you.exp_available); #if DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "You lose %ld experience points.",exp_drained); @@ -736,12 +736,15 @@ void drain_exp(bool announce_full) you.redraw_experience = true; if (you.experience < exp_needed(you.experience_level + 1)) + { lose_level(); + redraw_skill(you.your_name, player_title()); + } } } -static void xom_checks_damage(kill_method_type death_type, - int dam, int death_source) +static void _xom_checks_damage(kill_method_type death_type, + int dam, int death_source) { if (death_type == KILLED_BY_TARGETTING) { @@ -849,7 +852,7 @@ void ouch( int dam, int death_source, kill_method_type death_type, mpr( "* * * LOW HITPOINT WARNING * * *", MSGCH_DANGER ); } - xom_checks_damage(death_type, dam, death_source); + _xom_checks_damage(death_type, dam, death_source); // for note taking std::string damage_desc = ""; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 21904de8d6..eb8662b5bc 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -3497,8 +3497,7 @@ void level_change(bool skip_attribute_increase) deflate_hp( you.hp_max, false ); - if (you.magic_points < 0) - you.magic_points = 0; + you.magic_points = std::max(0, you.magic_points); { unwind_var hpmax(you.hp_max); @@ -3530,8 +3529,7 @@ void level_change(bool skip_attribute_increase) } redraw_skill( you.your_name, player_title() ); - -} // end level_change() +} // Here's a question for you: does the ordering of mods make a difference? // (yes) -- are these things in the right order of application to stealth? -- cgit v1.2.3-54-g00ecf