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/shout.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/shout.cc')
-rw-r--r-- | crawl-ref/source/shout.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/shout.cc b/crawl-ref/source/shout.cc index d151a819d6..5583dc8539 100644 --- a/crawl-ref/source/shout.cc +++ b/crawl-ref/source/shout.cc @@ -425,7 +425,7 @@ void item_noise(const item_def &item, string msg, int loudness) msg = replace_all(msg, "@a_player_genus@", article_a(species_name(you.species, true))); - mpr(msg.c_str(), channel); + mprf(channel, "%s", msg.c_str()); if (channel != MSGCH_TALK_VISUAL) noisy(loudness, you.pos()); @@ -532,7 +532,7 @@ bool noisy(int original_loudness, const coord_def& where, if (player_distance <= dist && player_can_hear(where)) { if (msg && !fake_noise) - mpr(msg, MSGCH_SOUND); + mprf(MSGCH_SOUND, "%s", msg); return true; } return false; |