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/spl-miscast.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/spl-miscast.cc')
-rw-r--r-- | crawl-ref/source/spl-miscast.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc index 6eea1ea015..c1815de1c4 100644 --- a/crawl-ref/source/spl-miscast.cc +++ b/crawl-ref/source/spl-miscast.cc @@ -493,7 +493,7 @@ void MiscastEffect::do_msg(bool suppress_nothing_happens) msg = replace_all(msg, "'s body", ""); } - mpr(msg.c_str(), msg_ch); + mprf(msg_ch, "%s", msg.c_str()); if (msg_ch == MSGCH_SOUND) { @@ -682,14 +682,14 @@ bool MiscastEffect::avoid_lethal(int dam) if (did_msg) { #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_MISCAST) - mpr("Couldn't avoid lethal miscast: already printed message for this " - "miscast.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Couldn't avoid lethal miscast: already printed " + "message for this miscast."); #endif return false; } #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_MISCAST) - mpr("Avoided lethal miscast.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Avoided lethal miscast."); #endif do_miscast(); @@ -1460,7 +1460,7 @@ void MiscastEffect::_divination_you(int severity) case 1: if (!silenced(you.pos())) { - mpr("You hear strange voices.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear strange voices."); noisy(2, you.pos()); } else @@ -1524,7 +1524,7 @@ void MiscastEffect::_divination_you(int severity) if (you.magic_points > 0 || you.species == SP_DJINNI) { drain_mp(3 + random2(10)); - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; } @@ -1540,7 +1540,7 @@ void MiscastEffect::_divination_you(int severity) if (you.magic_points > 0 || you.species == SP_DJINNI) { drain_mp(5 + random2(20)); - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; case 1: @@ -3055,7 +3055,7 @@ void MiscastEffect::_zot() if (you.magic_points > 0) { dec_mp(10 + random2(21)); - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; case 11: |