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/player-equip.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/player-equip.cc')
-rw-r--r-- | crawl-ref/source/player-equip.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc index 367cd28a8a..83b175a377 100644 --- a/crawl-ref/source/player-equip.cc +++ b/crawl-ref/source/player-equip.cc @@ -596,8 +596,7 @@ static void _equip_weapon_effect(item_def& item, bool showMsgs, bool unmeld) case SPWPN_ELECTROCUTION: if (!silenced(you.pos())) { - mpr("You hear the crackle of electricity.", - MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear the crackle of electricity."); } else mpr("You see sparks fly."); @@ -1345,7 +1344,7 @@ static void _equip_jewellery_effect(item_def &item, bool unmeld) case AMU_FAITH: if (!you_worship(GOD_NO_GOD)) { - mpr("You feel a surge of divine interest.", MSGCH_GOD); + mprf(MSGCH_GOD, "You feel a surge of divine interest."); ident = ID_KNOWN_TYPE; } break; @@ -1416,16 +1415,16 @@ static void _equip_jewellery_effect(item_def &item, bool unmeld) if (you.duration[DUR_SLOW]) dir--; if (dir > 0) - mpr("You abruptly slow down.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You abruptly slow down."); else if (dir < 0) - mpr("Your slowness suddenly goes away.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your slowness suddenly goes away."); if (you.duration[DUR_TELEPORT]) - mpr("You feel strangely stable.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel strangely stable."); if (you.duration[DUR_BERSERK]) - mpr("You violently calm down.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You violently calm down."); // my thesaurus says this usage is correct if (you.duration[DUR_FINESSE]) - mpr("Your hands get arrested.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your hands get arrested."); you.duration[DUR_HASTE] = 0; you.duration[DUR_SLOW] = 0; you.duration[DUR_TELEPORT] = 0; |