summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/art-func.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-28 23:33:32 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-29 01:07:35 +0100
commit5f4ae1ef05d92d9da03cde00b07d187f2f53a06d (patch)
tree01dbc85606ad5ab882333b1695c915b63e97b96d /crawl-ref/source/art-func.h
parent2965f04181dcb6530b93acb194ba5f7561d8adc9 (diff)
downloadcrawl-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/art-func.h')
-rw-r--r--crawl-ref/source/art-func.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index b56b0bf54a..90a741f75c 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -50,7 +50,7 @@ static void _equip_mpr(bool* show_msgs, const char* msg,
show_msgs = &def_show;
if (*show_msgs)
- mpr(msg, chan);
+ mprf(chan, "%s", msg);
// Caller shouldn't give any more messages.
*show_msgs = false;
@@ -339,7 +339,7 @@ static void _SINGING_SWORD_equip(item_def *item, bool *show_msgs, bool unmeld)
item->props["ss_welcome"].get_bool() = true;
}
else
- mpr("The Singing Sword hums in delight!", MSGCH_TALK);
+ mprf(MSGCH_TALK, "The Singing Sword hums in delight!");
*show_msgs = false;
}
@@ -587,7 +587,7 @@ static void _GONG_melee_effects(item_def* item, actor* wearer,
string msg = getSpeakString("shield of the gong");
if (msg.empty())
msg = "You hear a strange loud sound.";
- mpr(msg.c_str(), MSGCH_SOUND);
+ mprf(MSGCH_SOUND, "%s", msg.c_str());
noisy(40, wearer->pos());
}