diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-11-28 23:33:32 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-11-29 01:07:35 +0100 |
commit | 5f4ae1ef05d92d9da03cde00b07d187f2f53a06d (patch) | |
tree | 01dbc85606ad5ab882333b1695c915b63e97b96d /crawl-ref/source/transform.cc | |
parent | 2965f04181dcb6530b93acb194ba5f7561d8adc9 (diff) | |
download | crawl-ref-5f4ae1ef05d92d9da03cde00b07d187f2f53a06d.tar.gz crawl-ref-5f4ae1ef05d92d9da03cde00b07d187f2f53a06d.zip |
Replace `mpr(s, ch)` with `mprf(ch, s)`
Also simplify quite a few cases.
It turns out in >90% cases of non-literals the argument had .c_str(),
which meant it was pointlessly malloc()ed and converted from and to
std::string. I believe a sprintf is faster, so even the argument of
miniscule speed-up doesn't apply.
Diffstat (limited to 'crawl-ref/source/transform.cc')
-rw-r--r-- | crawl-ref/source/transform.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/crawl-ref/source/transform.cc b/crawl-ref/source/transform.cc index 8f8d412d23..571a416db9 100644 --- a/crawl-ref/source/transform.cc +++ b/crawl-ref/source/transform.cc @@ -1051,7 +1051,7 @@ bool transform(int pow, transformation_type which_trans, bool involuntary, mpr("Your new body is particularly stony."); if (you.duration[DUR_ICY_ARMOUR]) { - mpr("Your new body cracks your icy armour.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your new body cracks your icy armour."); you.duration[DUR_ICY_ARMOUR] = 0; } break; @@ -1116,7 +1116,7 @@ bool transform(int pow, transformation_type which_trans, bool involuntary, // undead cannot regenerate -- bwr if (you.duration[DUR_REGENERATION]) { - mpr("You stop regenerating.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You stop regenerating."); you.duration[DUR_REGENERATION] = 0; } @@ -1230,7 +1230,7 @@ void untransform(bool skip_wielding, bool skip_move) switch (old_form) { case TRAN_SPIDER: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); notify_stat_change(STAT_DEX, -5, true, "losing the spider transformation"); if (!skip_move) @@ -1238,7 +1238,7 @@ void untransform(bool skip_wielding, bool skip_move) break; case TRAN_BAT: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); notify_stat_change(STAT_DEX, -5, true, "losing the bat transformation"); notify_stat_change(STAT_STR, 5, true, @@ -1256,10 +1256,10 @@ void untransform(bool skip_wielding, bool skip_move) if (you.species == SP_LAVA_ORC && temperature_effect(LORC_STONESKIN) || you.species == SP_GARGOYLE) { - mpr("You revert to a slightly less stony form.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You revert to a slightly less stony form."); } else if (you.species != SP_LAVA_ORC) - mpr("You revert to your normal fleshy form.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You revert to your normal fleshy form."); notify_stat_change(STAT_DEX, 2, true, "losing the statue transformation"); notify_stat_change(STAT_STR, -2, true, @@ -1273,9 +1273,9 @@ void untransform(bool skip_wielding, bool skip_move) case TRAN_ICE_BEAST: if (you.species == SP_LAVA_ORC && !temperature_effect(LORC_STONESKIN)) - mpr("Your icy form melts away into molten rock.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your icy form melts away into molten rock."); else - mpr("You warm up again.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You warm up again."); // Note: if the core goes down, the combined effect soon disappears, // but the reverse isn't true. -- bwr @@ -1284,7 +1284,7 @@ void untransform(bool skip_wielding, bool skip_move) break; case TRAN_DRAGON: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); notify_stat_change(STAT_STR, -10, true, "losing the dragon transformation"); break; @@ -1292,16 +1292,16 @@ void untransform(bool skip_wielding, bool skip_move) case TRAN_LICH: you.is_undead = get_undead_state(you.species); if (you.is_undead == US_ALIVE) - mpr("You feel yourself come back to life.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel yourself come back to life."); else - mpr("You feel your undeath return to normal.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel your undeath return to normal."); break; case TRAN_PIG: case TRAN_JELLY: case TRAN_PORCUPINE: case TRAN_WISP: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); break; case TRAN_APPENDAGE: @@ -1318,11 +1318,11 @@ void untransform(bool skip_wielding, bool skip_move) break; case TRAN_FUNGUS: - mpr("You stop sporulating.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You stop sporulating."); you.set_duration(DUR_CONFUSING_TOUCH, 0); break; case TRAN_TREE: - mpr("You feel less woody.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel less woody."); if (grd(you.pos()) == DNGN_DEEP_WATER) { if (beogh_water_walk() || species_likes_water(you.species)) |