summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-11-05 16:22:35 +0100
committerAdam Borowski <kilobyte@angband.pl>2009-11-05 16:22:35 +0100
commit259a353db2a544831c572146cf50bdafcdc4ed5d (patch)
tree7c215a193ad91f80c7e7b0733e7b6655ede7490b /crawl-ref/source
parent8a71b54ce2a022bdd79680e19f88d9c600a0fc4e (diff)
downloadcrawl-ref-259a353db2a544831c572146cf50bdafcdc4ed5d.tar.gz
crawl-ref-259a353db2a544831c572146cf50bdafcdc4ed5d.zip
Move rot_player() to player::rot() (Zaba)
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/food.cc4
-rw-r--r--crawl-ref/source/it_use2.cc2
-rw-r--r--crawl-ref/source/player.cc50
-rw-r--r--crawl-ref/source/player.h2
4 files changed, 23 insertions, 35 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 588fa57441..20d8ecc502 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -1788,7 +1788,7 @@ static void _eat_chunk(corpse_effect_type chunk_effect, bool cannibal,
break;
case CE_HCL:
- rot_player( 10 + random2(10) );
+ you.rot(&you, 10 + random2(10));
if (disease_player( 50 + random2(100) ))
xom_is_stimulated(random2(100));
break;
@@ -2310,7 +2310,7 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
break;
case CE_HCL:
- rot_player(5 + random2(5));
+ you.rot(&you, 5 + random2(5));
if (disease_player(50 + random2(100)))
xom_is_stimulated(random2(100));
stop_delay();
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index ff67f83c57..bc50fa4f89 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -362,7 +362,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
// Don't generate randomly - should be rare and interesting.
case POT_DECAY:
- if (rot_player((10 + random2(10)) / factor))
+ if (you.rot(&you, (10 + random2(10)) / factor))
xom_is_stimulated(64 / xom_factor);
break;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e1bcf50a2d..905843576b 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5433,34 +5433,6 @@ void dec_disease_player()
}
}
-bool rot_player(int amount)
-{
- ASSERT(!crawl_state.arena);
-
- if (amount <= 0)
- return (false);
-
- if (you.res_rotting())
- {
- mpr("You feel terrible.");
- return (false);
- }
-
- if (you.rotting < 40)
- {
- // Either this, or the actual rotting message should probably
- // be changed so that they're easier to tell apart. -- bwr
- mprf(MSGCH_WARN, "You feel your flesh %s away!",
- you.rotting > 0 ? "rotting" : "start to rot");
-
- you.rotting += amount;
-
- learned_something_new(TUT_YOU_ROTTING);
- }
-
- return (true);
-}
-
int count_worn_ego(int which_ego)
{
int result = 0;
@@ -6861,13 +6833,31 @@ void player::drain_stat(int stat, int amount, actor *attacker)
bool player::rot(actor *who, int amount, int immediate, bool quiet)
{
- if (this->res_rotting() || amount <= 0)
+ ASSERT(!crawl_state.arena);
+
+ if (amount <= 0)
+ return (false);
+
+ if (you.res_rotting())
+ {
+ mpr("You feel terrible.");
return (false);
+ }
if (immediate > 0)
rot_hp(immediate);
- rot_player(amount);
+ if (you.rotting < 40)
+ {
+ // Either this, or the actual rotting message should probably
+ // be changed so that they're easier to tell apart. -- bwr
+ mprf(MSGCH_WARN, "You feel your flesh %s away!",
+ you.rotting > 0 ? "rotting" : "start to rot");
+
+ you.rotting += amount;
+
+ learned_something_new(TUT_YOU_ROTTING);
+ }
if (one_chance_in(4))
disease_player(50 + random2(100));
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index ed6f44d491..56770a7212 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -729,8 +729,6 @@ void dec_haste_player();
bool disease_player(int amount);
void dec_disease_player();
-bool rot_player(int amount);
-
item_def *player_slot_item(equipment_type eq);
bool player_weapon_wielded();