summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-book.cc
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/spl-book.cc
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/spl-book.cc')
-rw-r--r--crawl-ref/source/spl-book.cc28
1 files changed, 12 insertions, 16 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 7d90616aa9..ba50d6dd3a 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -685,7 +685,7 @@ static bool _get_mem_list(spell_list &mem_spells,
if (you.form == TRAN_WISP)
{
if (!just_check)
- mpr("You can't handle any books in this form.", MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "You can't handle any books in this form.");
return false;
}
@@ -746,18 +746,15 @@ static bool _get_mem_list(spell_list &mem_spells,
{
if (num_unknown > 1)
{
- mpr("You must pick up those books before reading them.",
- MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "You must pick up those books before reading them.");
}
else if (num_unknown == 1)
{
- mpr("You must pick up this book before reading it.",
- MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "You must pick up this book before reading it.");
}
else
{
- mpr("You aren't carrying or standing over any spellbooks.",
- MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "You aren't carrying or standing over any spellbooks.");
}
}
return false;
@@ -776,8 +773,7 @@ static bool _get_mem_list(spell_list &mem_spells,
{
if (!just_check)
{
- mpr("None of the spellbooks you are carrying contain any spells.",
- MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "None of the spellbooks you are carrying contain any spells.");
}
return false;
}
@@ -831,7 +827,7 @@ static bool _get_mem_list(spell_list &mem_spells,
unsigned int total = num_known + num_race + num_low_xl + num_low_levels;
if (num_known == total)
- mpr("You already know all available spells.", MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "You already know all available spells.");
else if (num_race == total || (num_known + num_race) == total)
{
const bool lichform = (you.form == TRAN_LICH);
@@ -849,8 +845,8 @@ static bool _get_mem_list(spell_list &mem_spells,
}
else
{
- mpr("You can't memorise any new spells for an unknown reason; "
- "please file a bug report.", MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "You can't memorise any new spells for an unknown "
+ "reason; please file a bug report.");
}
if (num_unreadable)
@@ -1225,9 +1221,9 @@ bool learn_spell(spell_type specspell)
double chance = get_miscast_chance(specspell);
if (chance >= 0.025)
- mpr("This spell is very dangerous to cast!", MSGCH_WARN);
+ mprf(MSGCH_WARN, "This spell is very dangerous to cast!");
else if (chance >= 0.005)
- mpr("This spell is quite dangerous to cast!", MSGCH_WARN);
+ mprf(MSGCH_WARN, "This spell is quite dangerous to cast!");
else if (chance >= 0.001)
mpr("This spell is slightly dangerous to cast.");
@@ -1855,8 +1851,8 @@ static bool _get_weighted_discs(bool completely_random, god_type god,
if (num_discs == 0)
{
#ifdef DEBUG
- mpr("No valid disciplines with which to make a themed randart "
- "spellbook.", MSGCH_ERROR);
+ mprf(MSGCH_ERROR, "No valid disciplines with which to make a themed "
+ "randart spellbook.");
#endif
// Only happens if !completely_random and the player already knows
// all available spells. We could simply re-allow all disciplines