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/command.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/command.cc')
-rw-r--r-- | crawl-ref/source/command.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index a5c8ae8b12..7f054a0a85 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -220,7 +220,7 @@ static void _print_version(void) void adjust(void) { - mpr("Adjust (i)tems, (s)pells, or (a)bilities? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Adjust (i)tems, (s)pells, or (a)bilities? "); const int keyin = toalower(get_ch()); @@ -321,7 +321,7 @@ static void _adjust_spell(void) } // Select starting slot - mpr("Adjust which spell? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Adjust which spell? "); int keyin = 0; if (Options.auto_list) @@ -356,7 +356,7 @@ static void _adjust_spell(void) keyin = 0; while (!isaalpha(keyin)) { - mpr("Adjust to which letter? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Adjust to which letter? "); keyin = get_ch(); if (key_is_escape(keyin)) { @@ -398,7 +398,7 @@ static void _adjust_ability(void) } int selected = -1; - mpr("Adjust which ability? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Adjust which ability? "); if (Options.auto_list) selected = choose_ability_menu(talents); @@ -440,7 +440,7 @@ static void _adjust_ability(void) const int index1 = letter_to_index(talents[selected].hotkey); - mpr("Adjust to which letter?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Adjust to which letter?"); const int keyin = get_ch(); @@ -526,7 +526,7 @@ void list_armour() if (colour == MSGCOL_BLACK) colour = menu_colour(estr.str(), "", "equip"); - mpr(estr.str().c_str(), MSGCH_EQUIPMENT, colour); + mprf(MSGCH_EQUIPMENT, colour, "%s", estr.str().c_str()); } } @@ -586,7 +586,7 @@ void list_jewellery(void) if (split && i > EQ_AMULET && (i - EQ_AMULET) % 2) jstr = item + " "; else - mpr(jstr + item, MSGCH_EQUIPMENT); + mprf(MSGCH_EQUIPMENT, "%s%s", jstr.c_str(), item.c_str()); } } @@ -1409,9 +1409,9 @@ static void _find_description(bool *again, string *error_inout) redraw_screen(); if (!error_inout->empty()) - mpr(error_inout->c_str(), MSGCH_PROMPT); - mpr("Describe a (M)onster, (S)pell, s(K)ill, (I)tem, (F)eature, (G)od, " - "(A)bility, (B)ranch, or (C)ard? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", error_inout->c_str()); + mprf(MSGCH_PROMPT, "Describe a (M)onster, (S)pell, s(K)ill, (I)tem, " + "(F)eature, (G)od, (A)bility, (B)ranch, or (C)ard? "); int ch; { cursor_control con(true); @@ -1505,7 +1505,7 @@ static void _find_description(bool *again, string *error_inout) "Describe a %s; partial names and regexps are fine.%s", type.c_str(), extra.c_str()); - mpr("Describe what? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Describe what? "); char buf[80]; if (cancellable_get_line(buf, sizeof(buf)) || buf[0] == '\0') { |