diff options
88 files changed, 634 insertions, 723 deletions
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile index 5f7efc388f..aa385f2e06 100644 --- a/crawl-ref/source/Makefile +++ b/crawl-ref/source/Makefile @@ -700,6 +700,7 @@ endif # TILES # On clang, unknown -Wfoo is merely a warning, thus -Werror. CFWARN_L += $(shell w=-Wno-array-bounds;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w) +CFWARN_L += $(shell w=-Wno-format-zero-length;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w) CFWARN += $(shell w=-Wmissing-declarations;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w) CFWARN_L += -Wno-parentheses -Wno-unused-parameter -Wwrite-strings -Wshadow diff --git a/crawl-ref/source/acquire.cc b/crawl-ref/source/acquire.cc index 18cff3c158..151846f78b 100644 --- a/crawl-ref/source/acquire.cc +++ b/crawl-ref/source/acquire.cc @@ -1565,7 +1565,7 @@ bool acquirement(object_class_type class_wanted, int agent, line.clear(); } } - mpr("What kind of item would you like to acquire? (\\ to view known items)", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "What kind of item would you like to acquire? (\\ to view known items)"); const int keyin = toalower(get_ch()); if (keyin >= 'a' && keyin < 'a' + (int)ARRAYSZ(acq_classes)) diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc index c779bdbb0c..e9774d1ecd 100644 --- a/crawl-ref/source/areas.cc +++ b/crawl-ref/source/areas.cc @@ -344,7 +344,7 @@ void decrease_sanctuary_radius() if (you.running && is_sanctuary(you.pos())) { - mpr("The sanctuary starts shrinking.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "The sanctuary starts shrinking."); stop_running(); } @@ -362,7 +362,7 @@ void decrease_sanctuary_radius() { _remove_sanctuary_property(env.sanctuary_pos); if (you.see_cell(env.sanctuary_pos)) - mpr("The sanctuary disappears.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "The sanctuary disappears."); } } @@ -466,27 +466,21 @@ void create_sanctuary(const coord_def& center, int time) // Messaging. if (trap_count > 0) - { - mpr("By Zin's power, hidden traps are revealed to you.", - MSGCH_GOD); - } + mprf(MSGCH_GOD, "By Zin's power, hidden traps are revealed to you."); if (cloud_count == 1) { - mpr("By Zin's power, the foul cloud within the sanctuary is " - "swept away.", MSGCH_GOD); + mprf(MSGCH_GOD, "By Zin's power, the foul cloud within the sanctuary " + "is swept away."); } else if (cloud_count > 1) { - mpr("By Zin's power, all foul fumes within the sanctuary are " - "swept away.", MSGCH_GOD); + mprf(MSGCH_GOD, "By Zin's power, all foul fumes within the sanctuary " + "are swept away."); } if (blood_count > 0) - { - mpr("By Zin's power, all blood is cleared from the sanctuary.", - MSGCH_GOD); - } + mprf(MSGCH_GOD, "By Zin's power, all blood is cleared from the sanctuary."); if (scare_count == 1 && seen_mon != NULL) simple_monster_message(seen_mon, " turns to flee the light!"); diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index 24a5b1fa0a..8f4d50fe3c 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -524,14 +524,12 @@ namespace arena if (orig_a < 0) { - mpr("Book-keeping says faction_a has negative active members.", - MSGCH_ERROR); + mprf(MSGCH_ERROR, "Book-keeping says faction_a has negative active members."); } if (orig_b < 0) { - mpr("Book-keeping says faction_b has negative active members.", - MSGCH_ERROR); + mprf(MSGCH_ERROR, "Book-keeping says faction_b has negative active members."); } faction_a.active_members = 0; @@ -577,8 +575,7 @@ namespace arena { if (faction_a.won || faction_b.won) { - mpr("Both factions alive but one declared the winner.", - MSGCH_ERROR); + mprf(MSGCH_ERROR, "Both factions alive but one declared the winner."); faction_a.won = false; faction_b.won = false; } @@ -655,8 +652,8 @@ namespace arena if (faction_a.active_members == 0 || faction_b.active_members == 0) { - mpr("ERROR: Both sides have spawners, but the active member " - "count of one side has been reduced to zero!", MSGCH_ERROR); + mprf(MSGCH_ERROR, "ERROR: Both sides have spawners, but the active " + "member count of one side has been reduced to zero!"); return; } @@ -848,13 +845,13 @@ namespace arena { if (faction_a.active_members > 0) { - mpr("Tie declared, but faction_a won.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Tie declared, but faction_a won."); team_a_wins++; faction_a.won = true; } else if (faction_b.active_members > 0) { - mpr("Tie declared, but faction_b won.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Tie declared, but faction_b won."); faction_b.won = true; } else @@ -868,21 +865,21 @@ namespace arena faction_a.won = false; faction_b.won = false; - mpr("*BOTH* factions won?!", MSGCH_ERROR); + mprf(MSGCH_ERROR, "*BOTH* factions won?!"); if (faction_a.active_members > 0) { - mpr("Faction_a real winner.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Faction_a real winner."); team_a_wins++; faction_a.won = true; } else if (faction_b.active_members > 0) { - mpr("Faction_b real winner.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Faction_b real winner."); faction_b.won = true; } else { - mpr("Both sides dead.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Both sides dead."); ties++; was_tied = true; } 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()); } diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc index 3f23bf2c7f..aff508fcc2 100644 --- a/crawl-ref/source/attitude-change.cc +++ b/crawl-ref/source/attitude-change.cc @@ -298,7 +298,7 @@ static void _print_good_god_holy_being_speech(bool neutral, { msg = do_mon_str_replacements(msg, mon); strip_channel_prefix(msg, channel); - mpr(msg.c_str(), channel); + mprf(channel, "%s", msg.c_str()); } } @@ -377,7 +377,7 @@ static void _print_converted_orc_speech(const string key, { msg = do_mon_str_replacements(msg, mon); strip_channel_prefix(msg, channel); - mpr(msg.c_str(), channel); + mprf(channel, "%s", msg.c_str()); } } diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index da84f41e52..84372a8034 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -119,11 +119,11 @@ bool bolt::is_blockable() const return !is_beam && !is_explosion && flavour != BEAM_ELECTRICITY; } -void bolt::emit_message(msg_channel_type chan, const char* m) +void bolt::emit_message(const char* m) { const string message = m; if (!message_cache.count(message)) - mpr(m, chan); + mpr(m); message_cache.insert(message); } @@ -842,7 +842,7 @@ void bolt::digging_wall_effect() { if (!silenced(you.pos())) { - mpr("You hear a grinding noise.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a grinding noise."); obvious_effect = true; // You may still see the caster. msg_generated = true; } @@ -893,9 +893,9 @@ void bolt::fire_wall_effect() // Destroy the wall. nuke_wall(pos()); if (you.see_cell(pos())) - emit_message(MSGCH_PLAIN, "The tree burns like a torch!"); + emit_message("The tree burns like a torch!"); else if (you.can_smell()) - emit_message(MSGCH_PLAIN, "You smell burning wood."); + emit_message("You smell burning wood."); if (whose_kill() == KC_YOU) did_god_conduct(DID_KILL_PLANT, 1, god_cares()); else if (whose_kill() == KC_FRIENDLY && !crawl_state.game_is_arena()) @@ -914,7 +914,7 @@ void bolt::elec_wall_effect() static bool _nuke_wall_msg(dungeon_feature_type feat, const coord_def& p) { - string msg; + const char *msg = nullptr; msg_channel_type chan = MSGCH_PLAIN; bool hear = player_can_hear(p); bool see = you.see_cell(p); @@ -981,9 +981,9 @@ static bool _nuke_wall_msg(dungeon_feature_type feat, const coord_def& p) break; } - if (!msg.empty()) + if (msg) { - mpr(msg, chan); + mprf(chan, "%s", msg); return true; } else @@ -2791,7 +2791,7 @@ void bolt::affect_place_clouds() || (ctype == CLOUD_FIRE && flavour == BEAM_COLD)) { if (player_can_hear(p)) - mpr("You hear a sizzling sound!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a sizzling sound!"); delete_cloud(cloudidx); extra_range_used += 5; @@ -3227,7 +3227,7 @@ void bolt::tracer_affect_player() apply_dmg_funcs(&you, dummy, messages); for (unsigned int i = 0; i < messages.size(); ++i) - mpr(messages[i].c_str(), MSGCH_WARN); + mprf(MSGCH_WARN, "%s", messages[i].c_str()); apply_hit_funcs(&you, 0); extra_range_used += range_used_on_hit(); @@ -3897,7 +3897,7 @@ void bolt::affect_player() if (hurted > 0) { for (unsigned int i = 0; i < messages.size(); ++i) - mpr(messages[i].c_str(), MSGCH_WARN); + mprf(MSGCH_WARN, "%s", messages[i].c_str()); } internal_ouch(hurted); @@ -4150,7 +4150,7 @@ void bolt::tracer_nonenchantment_affect_monster(monster* mon) if (!is_tracer && final > 0) { for (unsigned int i = 0; i < messages.size(); ++i) - mpr(messages[i].c_str(), MSGCH_MONSTER_DAMAGE); + mprf(MSGCH_MONSTER_DAMAGE, "%s", messages[i].c_str()); } apply_hit_funcs(mon, final); @@ -4466,11 +4466,10 @@ bool bolt::handle_statue_disintegration(monster* mon) if (!silenced(you.pos())) { if (!you.see_cell(mon->pos())) - mpr("You hear a hideous screaming!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a hideous screaming!"); else { - mpr("The statue screams as its substance crumbles away!", - MSGCH_SOUND); + mprf(MSGCH_SOUND, "The statue screams as its substance crumbles away!"); } } else if (you.see_cell(mon->pos())) @@ -4742,7 +4741,7 @@ void bolt::affect_monster(monster* mon) if (final > 0) { for (unsigned int i = 0; i < messages.size(); ++i) - mpr(messages[i].c_str(), MSGCH_MONSTER_DAMAGE); + mprf(MSGCH_MONSTER_DAMAGE, "%s", messages[i].c_str()); } // Apply flavoured specials. @@ -5565,7 +5564,7 @@ void bolt::refine_for_explosion() if (!heard) msg_generated = false; else - mpr(hearMsg, MSGCH_SOUND); + mprf(MSGCH_SOUND, "%s", hearMsg); } } } diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h index daa624548c..3edb1edace 100644 --- a/crawl-ref/source/beam.h +++ b/crawl-ref/source/beam.h @@ -236,7 +236,7 @@ private: string zapper() const; set<string> message_cache; - void emit_message(msg_channel_type chan, const char* msg); + void emit_message(const char* msg); void step(); bool hit_wall(); diff --git a/crawl-ref/source/behold.cc b/crawl-ref/source/behold.cc index 7c4f212948..bf3db22e2c 100644 --- a/crawl-ref/source/behold.cc +++ b/crawl-ref/source/behold.cc @@ -240,9 +240,9 @@ void player::_removed_beholder() if (beholders.empty()) { duration[DUR_MESMERISED] = 0; - mpr(coinflip() ? "You break out of your daze!" - : "You are no longer entranced.", - MSGCH_DURATION); + mprf(MSGCH_DURATION, + coinflip() ? "You break out of your daze!" + : "You are no longer entranced."); } } 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') { diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc index dfce870bf4..d4052b33bc 100644 --- a/crawl-ref/source/database.cc +++ b/crawl-ref/source/database.cc @@ -445,7 +445,7 @@ static void _execute_embedded_lua(string &str) string::size_type end = str.find("}}", pos + 2); if (end == string::npos) { - mpr("Unbalanced {{, bailing.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Unbalanced {{, bailing."); break; } @@ -652,7 +652,7 @@ static string _getRandomisedStr(TextDB &db, const string &key, recursion_depth++; if (recursion_depth > MAX_RECURSION_DEPTH) { - mpr("Too many nested replacements, bailing.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Too many nested replacements, bailing."); return "TOO MUCH RECURSION"; } @@ -678,14 +678,14 @@ static void _call_recursive_replacement(string &str, TextDB &db, num_replacements++; if (num_replacements > MAX_REPLACEMENTS) { - mpr("Too many string replacements, bailing.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Too many string replacements, bailing."); return; } string::size_type end = str.find("@", pos + 1); if (end == string::npos) { - mpr("Unbalanced @, bailing.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Unbalanced @, bailing."); break; } diff --git a/crawl-ref/source/dbg-asrt.cc b/crawl-ref/source/dbg-asrt.cc index 5238327ba8..ccffb3c9d9 100644 --- a/crawl-ref/source/dbg-asrt.cc +++ b/crawl-ref/source/dbg-asrt.cc @@ -485,10 +485,7 @@ static void _debug_marker_scan() marker->pos.x, marker->pos.y); if (!in_bounds(marker->pos)) - { - mpr("Further, it thinks it's out of bounds.", - MSGCH_ERROR); - } + mprf(MSGCH_ERROR, "Further, it thinks it's out of bounds."); } } } diff --git a/crawl-ref/source/dbg-scan.cc b/crawl-ref/source/dbg-scan.cc index 6ebadb3c22..a4534e5d10 100644 --- a/crawl-ref/source/dbg-scan.cc +++ b/crawl-ref/source/dbg-scan.cc @@ -44,8 +44,8 @@ static void _dump_item(const char *name, int num, const item_def &item, string msg = vmake_stringf(format, args); va_end(args); - mpr(msg.c_str(), chan); - mpr(name, chan); + mprf(chan, "%s", msg.c_str()); + mprf(chan, "%s", name); mprf(" item #%d: base: %d; sub: %d; plus: %d; plus2: %d; special: %d", num, item.base_type, item.sub_type, @@ -235,8 +235,8 @@ static void _announce_level_prob(bool warned) { if (!warned && crawl_state.generating_level) { - mpr("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", MSGCH_ERROR); - mpr("mgrd problem occurred during level generation", MSGCH_ERROR); + mprf(MSGCH_ERROR, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + mprf(MSGCH_ERROR, "mgrd problem occurred during level generation"); debug_dump_levgen(); } @@ -331,7 +331,7 @@ void debug_mons_scan() x, y, m->name(DESC_PLAIN, true).c_str(), m->pos().x, m->pos().y); if (!m->alive()) - mpr("Additionally, it isn't alive.", MSGCH_WARN); + mprf(MSGCH_WARN, "Additionally, it isn't alive."); warned = true; } else if (!m->alive()) @@ -483,14 +483,13 @@ void debug_mons_scan() { if (holder->inv[k] == idx) { - mpr("Other monster thinks it's holding the item, too.", - MSGCH_WARN); + mprf(MSGCH_WARN, "Other monster thinks it's holding the item, too."); found = true; break; } } if (!found) - mpr("Other monster isn't holding it, though.", MSGCH_WARN); + mprf(MSGCH_WARN, "Other monster isn't holding it, though."); } // if (holder != m) } // for (int j = 0; j < NUM_MONSTER_SLOTS; j++) @@ -573,7 +572,7 @@ void debug_mons_scan() // No vaults to report on? if (env.level_vaults.empty() && Temp_Vaults.empty()) { - mpr("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", MSGCH_ERROR); + mprf(MSGCH_ERROR, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); // Force the dev to notice problems. :P more(); return; @@ -637,7 +636,7 @@ void debug_mons_scan() } } - mpr("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", MSGCH_ERROR); + mprf(MSGCH_ERROR, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); // Force the dev to notice problems. :P more(); } diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc index fac55f12a1..0d33e04d65 100644 --- a/crawl-ref/source/dbg-util.cc +++ b/crawl-ref/source/dbg-util.cc @@ -28,7 +28,7 @@ monster_type debug_prompt_for_monster(void) { char specs[1024]; - mpr("Which monster by name? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which monster by name? "); if (!cancellable_get_line_autohist(specs, sizeof specs)) { if (specs[0] == '\0') @@ -451,11 +451,11 @@ void wizard_toggle_dprf() Options.quiet_debug_messages[i] ? "</white>" : ""); if (i % 5 == 4 || i == NUM_DIAGNOSTICS - 1) { - mpr(line, MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", line.c_str()); line.clear(); } } - mpr("Toggle which debug class (ESC to exit)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Toggle which debug class (ESC to exit)? "); int keyin = toalower(get_ch()); diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 721d289e48..5fa61bfd3d 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -640,11 +640,11 @@ void handle_delay() switch (delay.type) { case DELAY_ARMOUR_ON: - mpr("You start putting on your armour.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You start putting on your armour."); break; case DELAY_ARMOUR_OFF: - mpr("You start removing your armour.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You start removing your armour."); break; case DELAY_BUTCHER: @@ -684,16 +684,16 @@ void handle_delay() spell_title(spell)); simple_god_message(message.c_str()); } - mpr("You start memorising the spell.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You start memorising the spell."); break; } case DELAY_PASSWALL: - mpr("You begin to meditate on the wall.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You begin to meditate on the wall."); break; case DELAY_SHAFT_SELF: - mpr("You begin to dig a shaft.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You begin to dig a shaft."); break; default: @@ -785,7 +785,7 @@ void handle_delay() // previously rotten. (special < 100 is the rottenness check). if (delay.parm2 >= 100) { - mpr("The corpse rots.", MSGCH_ROTTEN_MEAT); + mprf(MSGCH_ROTTEN_MEAT, "The corpse rots."); if (you.is_undead != US_UNDEAD && player_mutation_level(MUT_SAPROVOROUS) < 3) { @@ -880,16 +880,15 @@ void handle_delay() break; case DELAY_MEMORISE: - mpr("You continue memorising.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You continue memorising."); break; case DELAY_PASSWALL: - mpr("You continue meditating on the rock.", - MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You continue meditating on the rock."); break; case DELAY_SHAFT_SELF: - mpr("You continue digging a shaft.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You continue digging a shaft."); break; case DELAY_MULTIDROP: @@ -902,7 +901,7 @@ void handle_delay() break; case DELAY_EAT: - mpr("You continue eating.", MSGCH_MULTITURN_ACTION); + mprf(MSGCH_MULTITURN_ACTION, "You continue eating."); break; case DELAY_FEED_VAMPIRE: @@ -911,7 +910,7 @@ void handle_delay() : mitm[delay.parm2]); if (food_is_rotten(corpse)) { - mpr("This corpse has started to rot.", MSGCH_ROTTEN_MEAT); + mprf(MSGCH_ROTTEN_MEAT, "This corpse has started to rot."); _xom_check_corpse_waste(); stop_delay(); return; @@ -1442,7 +1441,7 @@ void run_macro(const char *macroname) #ifdef CLUA_BINDINGS if (!clua) { - mpr("Lua not initialised", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Lua not initialised"); stop_delay(); return; } @@ -1583,7 +1582,7 @@ static inline bool _monster_warning(activity_interrupt_type ai, { if (ai == AI_SENSE_MONSTER) { - mpr("You sense a monster nearby.", MSGCH_WARN); + mprf(MSGCH_WARN, "You sense a monster nearby."); return true; } if (ai != AI_SEE_MONSTER) @@ -1688,9 +1687,9 @@ static inline bool _monster_warning(activity_interrupt_type ai, msgs_buf->push_back(text); else { - mpr(text, MSGCH_WARN); + mprf(MSGCH_WARN, "%s", text.c_str()); if (ash_id) - mpr(ash_warning, MSGCH_GOD); + mprf(MSGCH_GOD, "%s", ash_warning.c_str()); } const_cast<monster* >(mon)->seen_context = SC_JUST_SEEN; } diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc index 6892b11bdb..c29e2f2748 100644 --- a/crawl-ref/source/dgn-overview.cc +++ b/crawl-ref/source/dgn-overview.cc @@ -896,9 +896,8 @@ void do_annotate(level_id& li) string old = get_level_annotation(li, true, true); if (!old.empty()) { - mpr("Current level annotation: " + - colour_string(old, LIGHTGREY), - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Current level annotation: <lightgrey>%s</lightgrey>", + old.c_str()); } const string prompt = "New annotation for " + li.describe() diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index d5e893f72e..8c57b66857 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -347,7 +347,7 @@ string direction_chooser::build_targetting_hint_string() const void direction_chooser::print_top_prompt() const { if (!top_prompt.empty()) - mpr(top_prompt, MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", top_prompt.c_str()); } void direction_chooser::print_key_hints() const @@ -384,7 +384,7 @@ void direction_chooser::print_key_hints() const } // Display the prompt. - mpr(prompt, MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", prompt.c_str()); } void direction_chooser::describe_cell() const @@ -949,12 +949,10 @@ bool direction_chooser::move_is_ok() const { if (you.see_cell(target())) { - mpr("There's something in the way.", - MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "There's something in the way."); } else - mpr("Sorry, you can't target what you can't see.", - MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "Sorry, you can't target what you can't see."); return false; } @@ -973,7 +971,7 @@ bool direction_chooser::move_is_ok() const { if (!may_target_self && (cancel_at_self || Options.allow_self_target == CONFIRM_CANCEL)) { - mpr("That would be overly suicidal.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "That would be overly suicidal."); return false; } else if (Options.allow_self_target != CONFIRM_NONE) @@ -982,7 +980,7 @@ bool direction_chooser::move_is_ok() const if (cancel_at_self) { - mpr("Sorry, you can't target yourself.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "Sorry, you can't target yourself."); return false; } } @@ -1078,16 +1076,15 @@ bool direction_chooser::find_default_monster_target(coord_def& result) const { // Special colouring in tutorial or hints mode. const bool need_hint = Hints.hints_events[HINT_TARGET_NO_FOE]; - mpr("All monsters which could be auto-targeted are covered by " + mprf(need_hint ? MSGCH_TUTORIAL : MSGCH_PROMPT, + "All monsters which could be auto-targeted are covered by " "a wall or statue which interrupts your line of fire, even " - "though it doesn't interrupt your line of sight.", - need_hint ? MSGCH_TUTORIAL : MSGCH_PROMPT); + "though it doesn't interrupt your line of sight."); if (need_hint) { - mpr("To return to the main mode, press <w>Escape</w>.", - MSGCH_TUTORIAL); - Hints.hints_events[HINT_TARGET_NO_FOE] = false; + mprf(MSGCH_TUTORIAL, "To return to the main mode, press <w>Escape</w>."); + Hints.hints_events[HINT_TARGET_NO_FOE] = false; } } } @@ -1314,8 +1311,8 @@ bool direction_chooser::select(bool allow_out_of_range, bool endpoint) if ((restricts == DIR_JUMP || !allow_out_of_range) && !in_range(target())) { - mpr(hitfunc? hitfunc->why_not : "That is beyond the maximum range.", - MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "%s", + hitfunc? hitfunc->why_not.c_str() : "That is beyond the maximum range."); return false; } moves.isEndpoint = endpoint || (mons && _mon_exposed(mons)); @@ -1332,7 +1329,7 @@ bool direction_chooser::pickup_item() ii = env.map_knowledge(target()).item(); if (!ii || !ii->is_valid(true)) { - mpr("You can't see any item there.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "You can't see any item there."); return false; } ii->flags |= ISFLAG_THROWN; // make autoexplore greedy @@ -1361,7 +1358,7 @@ bool direction_chooser::pickup_item() if (!just_looking) // firing/casting prompt { - mpr("Marked for pickup.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "Marked for pickup."); return false; } @@ -1380,7 +1377,7 @@ bool direction_chooser::handle_signals() moves.isValid = false; moves.isCancel = true; - mpr("Targetting interrupted by HUP signal.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Targetting interrupted by HUP signal."); return true; } return false; @@ -1403,7 +1400,10 @@ void direction_chooser::print_target_description(bool &did_cloud) const print_target_monster_description(did_cloud); if (!in_range(target())) - mpr(hitfunc ? hitfunc->why_not : "Out of range.", MSGCH_EXAMINE_FILTER); + { + mprf(MSGCH_EXAMINE_FILTER, "%s", + hitfunc ? hitfunc->why_not.c_str() : "Out of range."); + } } string direction_chooser::target_interesting_terrain_description() const @@ -1637,7 +1637,7 @@ bool direction_chooser::select_previous_target() } else { - mpr("Your target is gone.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "Your target is gone."); flush_prev_message(); return false; } @@ -2241,7 +2241,7 @@ static void _extend_move_to_edge(dist &moves) // cache and noted in the Dungeon (O)verview, names the stair. static void _describe_oos_square(const coord_def& where) { - mpr("You can't see that place.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "You can't see that place."); if (!in_bounds(where) || !env.map_knowledge(where).seen()) { @@ -2866,9 +2866,8 @@ void describe_floor() { dungeon_feature_type grid = env.map_knowledge(you.pos()).feat(); - string prefix = "There is "; + const char* prefix = "There is "; string feat; - string suffix = " here."; switch (grid) { @@ -2894,9 +2893,9 @@ void describe_floor() if (feat_is_water(grid) || feat_is_lava(grid)) return; - mpr((prefix + feat + suffix).c_str(), channel); + mprf(channel, "%s%s here.", prefix, feat.c_str()); if (grid == DNGN_ENTER_LABYRINTH && you.is_undead != US_UNDEAD) - mpr("Beware, for starvation awaits!", MSGCH_EXAMINE); + mprf(MSGCH_EXAMINE, "Beware, for starvation awaits!"); } string thing_do_grammar(description_level_type dtype, bool add_stop, @@ -3645,12 +3644,12 @@ static void _describe_monster(const monster_info& mi) const string constriction_desc = mi.constriction_description(); if (!constriction_desc.empty()) text += " It is" + constriction_desc + "."; - mpr(text, MSGCH_EXAMINE); + mprf(MSGCH_EXAMINE, "%s", text.c_str()); // Print the rest of the description. text = _get_monster_desc(mi); if (!text.empty()) - mpr(text, MSGCH_EXAMINE); + mprf(MSGCH_EXAMINE, "%s", text.c_str()); } // This method is called in two cases: @@ -3898,7 +3897,7 @@ static bool _print_item_desc(const coord_def where) mprf(MSGCH_FLOOR_ITEMS, "You see %s here.", name.c_str()); if (mitm[ targ_item ].link != NON_ITEM) - mpr("There is something else lying underneath.", MSGCH_FLOOR_ITEMS); + mprf(MSGCH_FLOOR_ITEMS, "There is something else lying underneath."); return true; } @@ -3956,7 +3955,7 @@ static void _describe_cell(const coord_def& where, bool in_range) #endif if (where == you.pos() && !crawl_state.arena_suspended) - mpr("You.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "You."); if (const monster* mon = monster_at(where)) { @@ -3972,13 +3971,11 @@ static void _describe_cell(const coord_def& where, bool in_range) { if (_mon_exposed_in_water(mon)) { - mpr("There is a strange disturbance in the water here.", - MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "There is a strange disturbance in the water here."); } else if (_mon_exposed_in_cloud(mon)) { - mpr("There is a strange disturbance in the cloud here.", - MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "There is a strange disturbance in the cloud here."); } goto look_clouds; diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index b99414a444..a7be85aa45 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -572,14 +572,14 @@ bool set_level_flags(uint32_t flags, bool silent) if (could_control && !can_control && !silent) { - mpr("You sense the appearance of a powerful magical force " - "which warps space.", MSGCH_WARN); + mprf(MSGCH_WARN, "You sense the appearance of a powerful magical force " + "which warps space."); } if (could_map && !can_map && !silent) { - mpr("A powerful force appears that prevents you from " - "remembering where you've been.", MSGCH_WARN); + mprf(MSGCH_WARN, "A powerful force appears that prevents you from " + "remembering where you've been."); } return old_flags != env.level_flags; @@ -600,16 +600,16 @@ bool unset_level_flags(uint32_t flags, bool silent) { // Isn't really a "recovery", but I couldn't think of where // else to send it. - mpr("You sense the disappearance of a powerful magical force " - "which warped space.", MSGCH_RECOVERY); + mprf(MSGCH_RECOVERY, "You sense the disappearance of a powerful " + "magical force which warped space."); } if (!could_map && can_map && !silent) { // Isn't really a "recovery", but I couldn't think of where // else to send it. - mpr("You sense the disappearance of the force that prevented you " - "from remembering where you've been.", MSGCH_RECOVERY); + mprf(MSGCH_RECOVERY, "You sense the disappearance of the force that " + "prevented you from remembering where you've been."); } return old_flags != env.level_flags; @@ -5327,7 +5327,7 @@ static dungeon_feature_type _pick_temple_altar(vault_placement &place) if (crawl_state.map_stat_gen) return DNGN_ALTAR_XOM; - mpr("Ran out of altars for temple!", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Ran out of altars for temple!"); return DNGN_FLOOR; } // Randomized altar list for mini-temples. diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 433f5c2421..b0d531d16e 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -466,7 +466,7 @@ void banished(const string &who) else { // On Abyss:5 we can't go deeper; cause a shift to a new area - mpr("You are banished to a different region of the Abyss.", MSGCH_BANISHMENT); + mprf(MSGCH_BANISHMENT, "You are banished to a different region of the Abyss."); abyss_teleport(true); } return; @@ -711,7 +711,7 @@ void random_uselessness(int scroll_slot) break; case 6: - mpr("You hear the tinkle of a tiny bell.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear the tinkle of a tiny bell."); noisy(2, you.pos()); cast_summon_butterflies(100); break; @@ -973,7 +973,7 @@ void yell(bool force) return; } - mpr("What do you say?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "What do you say?"); mprf(" t - %s!", cap_shout.c_str()); if (!you.berserk()) @@ -1205,7 +1205,7 @@ static void _hell_effects() bool loud = starts_with(msg, "SOUND:"); if (loud) msg.erase(0, 6); - mpr(msg.c_str(), MSGCH_HELL_EFFECT); + mprf(MSGCH_HELL_EFFECT, "%s", msg.c_str()); if (loud) noisy(15, you.pos()); @@ -1530,13 +1530,13 @@ void change_labyrinth(bool msg) c1.x, c1.y, c2.x, c2.y); string path_str = ""; - mpr("Here's the list of targets: ", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Here's the list of targets: "); for (unsigned int i = 0; i < targets.size(); i++) { snprintf(info, INFO_SIZE, "(%d, %d) ", targets[i].x, targets[i].y); path_str += info; } - mpr(path_str.c_str(), MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "%s", path_str.c_str()); mprf(MSGCH_DIAGNOSTICS, "-> #targets = %u", (unsigned int)targets.size()); } @@ -1580,8 +1580,7 @@ void change_labyrinth(bool msg) { if (msg) { - mpr("Something went badly wrong - no path found!", - MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Something went badly wrong - no path found!"); } continue; } @@ -2069,13 +2068,13 @@ static void _magic_contamination_effects() if (glow_effect && is_sanctuary(you.pos())) { - mpr("Your body momentarily shudders from a surge of wild " - "energies until Zin's power calms it.", MSGCH_GOD); + mprf(MSGCH_GOD, "Your body momentarily shudders from a surge of wild " + "energies until Zin's power calms it."); } else if (glow_effect) { - mpr("Your body shudders with the violent release " - "of wild energies!", MSGCH_WARN); + mprf(MSGCH_WARN, "Your body shudders with the violent release " + "of wild energies!"); // For particularly violent releases, make a little boom. if (you.magic_contamination > 10000 && coinflip()) @@ -2211,7 +2210,7 @@ void handle_time() && you.piety >= piety_breakpoint(0) && coinflip())) { - mpr("Your disease is taking its toll.", MSGCH_WARN); + mprf(MSGCH_WARN, "Your disease is taking its toll."); lose_stat(STAT_RANDOM, 1, false, "disease"); } } diff --git a/crawl-ref/source/evoke.cc b/crawl-ref/source/evoke.cc index fa66b03618..8f053103d8 100644 --- a/crawl-ref/source/evoke.cc +++ b/crawl-ref/source/evoke.cc @@ -311,7 +311,7 @@ static bool _evoke_horn_of_geryon(item_def &item) } else { - mpr("You produce a hideous howling noise!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You produce a hideous howling noise!"); create_monster( mgen_data::hostile_at(MONS_HELL_BEAST, "the horn of Geryon", true, 4, 0, you.pos())); @@ -341,13 +341,13 @@ static bool _efreet_flask(int slot) if (silenced(you.pos())) { - mpr(friendly ? "It nods graciously at you." - : "It snaps in your direction!", MSGCH_TALK_VISUAL); + mprf(MSGCH_TALK_VISUAL, friendly ? "It nods graciously at you." + : "It snaps in your direction!"); } else { - mpr(friendly ? "\"Thank you for releasing me!\"" - : "It howls insanely!", MSGCH_TALK); + mprf(MSGCH_TALK, friendly ? "\"Thank you for releasing me!\"" + : "It howls insanely!"); } } else diff --git a/crawl-ref/source/fearmonger.cc b/crawl-ref/source/fearmonger.cc index 3c12989937..f08348dfc5 100644 --- a/crawl-ref/source/fearmonger.cc +++ b/crawl-ref/source/fearmonger.cc @@ -168,8 +168,7 @@ void player::_removed_fearmonger() if (fearmongers.empty()) { duration[DUR_AFRAID] = 0; - mpr("You are no longer terrified.", - MSGCH_DURATION); + mprf(MSGCH_DURATION, "You are no longer terrified."); } } diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 6ffe07e685..b8d970104d 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -1754,7 +1754,7 @@ bool load_ghost(bool creating_level) if (!inf.valid()) { if (wiz_cmd && !creating_level) - mpr("No ghost files for this level.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "No ghost files for this level."); return false; // no such ghost. } @@ -1819,7 +1819,7 @@ bool load_ghost(bool creating_level) unplaced_ghosts--; if (!mons->alive()) { - mpr("Placed ghost is not alive.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Placed ghost is not alive."); ghost_errors = true; } else if (mons->type != MONS_PLAYER_GHOST) @@ -2256,8 +2256,7 @@ void save_ghost(bool force) { #ifdef BONES_DIAGNOSTICS if (do_diagnostics) - mpr("Ghost file for this level already exists.", - MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Ghost file for this level already exists."); #endif fclose(gfile); return; @@ -2269,8 +2268,7 @@ void save_ghost(bool force) { #ifdef BONES_DIAGNOSTICS if (do_diagnostics) - mpr("Could not find any ghosts for this level.", - MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Could not find any ghosts for this level."); #endif return; } diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 95d442acb3..9af8789dcf 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -1007,15 +1007,15 @@ bool food_change(bool initial) { if (you.duration[DUR_BERSERK] > 1) { - mpr("Your blood-deprived body can't sustain your rage any " - "longer.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your blood-deprived body can't sustain " + "your rage any longer."); you.duration[DUR_BERSERK] = 1; } if (you.form != TRAN_NONE && you.form != TRAN_BAT && you.duration[DUR_TRANSFORMATION] > 2 * BASELINE_DELAY) { - mpr("Your blood-deprived body can't sustain your " - "transformation much longer.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your blood-deprived body can't sustain " + "your transformation much longer."); you.set_duration(DUR_TRANSFORMATION, 2); } } @@ -1023,8 +1023,8 @@ bool food_change(bool initial) && you.duration[DUR_TRANSFORMATION] > 5) { print_stats(); - mpr("Your blood-filled body can't sustain your transformation " - "much longer.", MSGCH_WARN); + mprf(MSGCH_WARN, "Your blood-filled body can't sustain your " + "transformation much longer."); // Give more time because suddenly stopping flying can be fatal. you.set_duration(DUR_TRANSFORMATION, 5); @@ -2720,7 +2720,7 @@ void handle_starvation() { if (!you.cannot_act() && one_chance_in(40)) { - mpr("You lose consciousness!", MSGCH_FOOD); + mprf(MSGCH_FOOD, "You lose consciousness!"); stop_running(); you.increase_duration(DUR_PARALYSIS, 5 + random2(8), 13); @@ -2730,7 +2730,7 @@ void handle_starvation() if (you.hunger <= 0) { - mpr("You have starved to death.", MSGCH_FOOD); + mprf(MSGCH_FOOD, "You have starved to death."); ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_STARVATION); if (!you.dead) // if we're still here... set_hunger(HUNGER_DEFAULT, true); diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc index 40f13bb797..9596f3fe9f 100644 --- a/crawl-ref/source/godabil.cc +++ b/crawl-ref/source/godabil.cc @@ -698,7 +698,7 @@ int zin_check_recite_to_monsters(recite_type *prayertype) // But often, you'll have multiple options... mesclr(); - mpr("Recite against which type of sinner?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Recite against which type of sinner?"); int menu_cnt = 0; recite_type letters[NUM_RECITE_TYPES]; @@ -1225,7 +1225,7 @@ void zin_recite_interrupt() { if (!you.duration[DUR_RECITE]) return; - mpr("Your recitation is interrupted.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your recitation is interrupted."); mpr("You feel short of breath."); you.duration[DUR_RECITE] = 0; @@ -1254,7 +1254,7 @@ bool zin_vitalisation() void zin_remove_divine_stamina() { - mpr("Your divine stamina fades away.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your divine stamina fades away."); notify_stat_change(STAT_STR, -you.attribute[ATTR_DIVINE_STAMINA], true, "Zin's divine stamina running out"); notify_stat_change(STAT_INT, -you.attribute[ATTR_DIVINE_STAMINA], @@ -1291,7 +1291,7 @@ bool zin_sanctuary() // Yes, shamelessly stolen from NetHack... if (!silenced(you.pos())) // How did you manage that? - mpr("You hear a choir sing!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a choir sing!"); else mpr("You are suddenly bathed in radiance!"); @@ -1346,7 +1346,7 @@ void tso_divine_shield() void tso_remove_divine_shield() { - mpr("Your divine shield disappears!", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your divine shield disappears!"); you.duration[DUR_DIVINE_SHIELD] = 0; you.attribute[ATTR_DIVINE_SHIELD] = 0; you.redraw_armour_class = true; @@ -1404,7 +1404,7 @@ bool elyvilon_divine_vigour() void elyvilon_remove_divine_vigour() { - mpr("Your divine vigour fades away.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your divine vigour fades away."); you.duration[DUR_DIVINE_VIGOUR] = 0; you.attribute[ATTR_DIVINE_VIGOUR] = 0; calc_hp(); @@ -1560,14 +1560,14 @@ void trog_do_trogs_hand(int pow) you.increase_duration(DUR_TROGS_HAND, 5 + roll_dice(2, pow / 3 + 1), 100, "Your skin crawls."); - mpr("You feel resistant to hostile enchantments.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel resistant to hostile enchantments."); } void trog_remove_trogs_hand() { if (you.duration[DUR_REGENERATION] == 0) - mpr("Your skin stops crawling.", MSGCH_DURATION); - mpr("You feel less resistant to hostile enchantments.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your skin stops crawling."); + mprf(MSGCH_DURATION, "You feel less resistant to hostile enchantments."); you.duration[DUR_TROGS_HAND] = 0; } @@ -1601,9 +1601,9 @@ void jiyva_paralyse_jellies() if (jelly_count > 0) { if (jelly_count > 1) - mpr("The nearby slimes join your prayer.", MSGCH_PRAY); + mprf(MSGCH_PRAY, "The nearby slimes join your prayer."); else - mpr("A nearby slime joins your prayer.", MSGCH_PRAY); + mprf(MSGCH_PRAY, "A nearby slime joins your prayer."); lose_piety(5); } diff --git a/crawl-ref/source/godpassive.cc b/crawl-ref/source/godpassive.cc index 317047b749..61fb8145af 100644 --- a/crawl-ref/source/godpassive.cc +++ b/crawl-ref/source/godpassive.cc @@ -275,7 +275,7 @@ void ash_check_bondage(bool msg) { string desc = ash_describe_bondage(flags, you.bondage_level != old_level); if (!desc.empty()) - mpr(desc, MSGCH_GOD); + mprf(MSGCH_GOD, "%s", desc.c_str()); } } diff --git a/crawl-ref/source/godprayer.cc b/crawl-ref/source/godprayer.cc index 5b7d3a7490..fcc5877471 100644 --- a/crawl-ref/source/godprayer.cc +++ b/crawl-ref/source/godprayer.cc @@ -150,7 +150,7 @@ static bool _bless_weapon(god_type god, brand_type brand, int colour) wpn.name(DESC_A).c_str(), desc.c_str())); wpn.flags |= ISFLAG_NOTED_ID; - mpr("Your weapon shines brightly!", MSGCH_GOD); + mprf(MSGCH_GOD, "Your weapon shines brightly!"); flash_view(colour); @@ -340,11 +340,11 @@ void pray() something_happened |= _offer_items(); if (you_worship(GOD_XOM)) - mpr(getSpeakString("Xom prayer"), MSGCH_GOD); + mprf(MSGCH_GOD, "%s", getSpeakString("Xom prayer").c_str()); else if (player_under_penance()) simple_god_message(" demands penance!"); else - mpr(god_prayer_reaction().c_str(), MSGCH_PRAY, you.religion); + mprf(MSGCH_PRAY, you.religion, "%s", god_prayer_reaction().c_str()); if (something_happened) you.turn_is_over = true; diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc index 12dda4deb3..78814fffe1 100644 --- a/crawl-ref/source/godwrath.cc +++ b/crawl-ref/source/godwrath.cc @@ -361,7 +361,7 @@ static bool _cheibriados_retribution() case 2: if (you.duration[DUR_SLOW] < 180 * BASELINE_DELAY) { - mpr("You feel the world leave you behind!", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel the world leave you behind!"); you.set_duration(DUR_EXHAUSTED, 200); slow_player(100); } @@ -593,7 +593,7 @@ static bool _trog_retribution() if (!you.duration[DUR_PARALYSIS]) { dec_penance(god, 3); - mpr("You suddenly pass out!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly pass out!"); you.duration[DUR_PARALYSIS] = 2 + random2(6); } break; @@ -603,7 +603,7 @@ static bool _trog_retribution() if (you.duration[DUR_SLOW] < 180 * BASELINE_DELAY) { dec_penance(god, 1); - mpr("You suddenly feel exhausted!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel exhausted!"); you.set_duration(DUR_EXHAUSTED, 200); slow_player(100); } @@ -617,7 +617,7 @@ static bool _trog_retribution() // we'll leave this effect in, but we'll remove the wild // fire magic. -- bwr dec_penance(god, 2); - mpr("You feel Trog's fiery rage upon you!", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel Trog's fiery rage upon you!"); MiscastEffect(&you, -god, SPTYP_FIRE, 8 + you.experience_level, random2avg(98, 3), "the fiery rage of Trog"); } @@ -793,7 +793,7 @@ static bool _sif_muna_retribution() if (you.magic_points > 0 || you.species == SP_DJINNI) { drain_mp(100); // This should zero it. - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; @@ -1221,15 +1221,14 @@ bool divine_retribution(god_type god, bool no_bonus, bool force) { if (coinflip()) { - mpr("The divine experience confuses you!", MSGCH_WARN); + mprf(MSGCH_WARN, "The divine experience confuses you!"); confuse_player(3 + random2(10)); } else { if (you.duration[DUR_SLOW] < 180 * BASELINE_DELAY) { - mpr("The divine experience leaves you feeling exhausted!", - MSGCH_WARN); + mprf(MSGCH_WARN, "The divine experience leaves you feeling exhausted!"); slow_player(random2(20)); } @@ -1379,7 +1378,7 @@ static bool _ely_holy_revenge(const monster *victim) string msg = getSpeakString("Elyvilon holy"); if (msg.empty()) msg = "Elyvilon is displeased."; - mpr(msg.c_str(), MSGCH_GOD, GOD_ELYVILON); + mprf(MSGCH_GOD, GOD_ELYVILON, "%s", msg.c_str()); vector<monster*> targets; for (monster_near_iterator mi(you.pos(), LOS_NO_TRANS); mi; ++mi) diff --git a/crawl-ref/source/hints.cc b/crawl-ref/source/hints.cc index accd6bafe5..df5807f07e 100644 --- a/crawl-ref/source/hints.cc +++ b/crawl-ref/source/hints.cc @@ -442,7 +442,7 @@ void print_hint(string key, const string arg1, const string arg2) // paragraphs by "\n\n", split_string() will ignore the empty line. vector<string> chunks = split_string("\n", text); for (size_t i = 0; i < chunks.size(); i++) - mpr(chunks[i], MSGCH_TUTORIAL); + mprf(MSGCH_TUTORIAL, "%s", chunks[i].c_str()); stop_running(); } @@ -505,10 +505,10 @@ void hints_death_screen() print_hint(make_stringf("death random %d", hint)); } - mpr(untag_tiles_console(text), MSGCH_TUTORIAL, 0); + mprf(MSGCH_TUTORIAL, "%s", untag_tiles_console(text).c_str()); more(); - mpr("See you next game!", MSGCH_TUTORIAL); + mprf(MSGCH_TUTORIAL, "See you next game!"); Hints.hints_events.init(false); } @@ -654,7 +654,7 @@ static void _hints_healing_reminder() "hitpoints in the first place. To use your abilities type " "<w>a</w>."; } - mpr(text, MSGCH_TUTORIAL, 0); + mprf(MSGCH_TUTORIAL, "%s", text.c_str()); if (is_resting()) @@ -739,7 +739,7 @@ void hints_gained_new_skill(skill_type skill) case SK_THROWING: case SK_SPELLCASTING: { - mpr(get_skill_description(skill), MSGCH_TUTORIAL, 0); + mprf(MSGCH_TUTORIAL, "%s", get_skill_description(skill).c_str()); stop_running(); break; } @@ -942,7 +942,7 @@ void hints_monster_seen(const monster& mon) "death by misclicking."; } - mpr(text, MSGCH_TUTORIAL, 0); + mprf(MSGCH_TUTORIAL, "%s", text.c_str()); if (Hints.hints_type == HINT_RANGER_CHAR) { @@ -966,7 +966,7 @@ void hints_monster_seen(const monster& mon) "will also let you read its description.</tiles>"; } - mpr(untag_tiles_console(text), MSGCH_TUTORIAL, 0); + mprf(MSGCH_TUTORIAL, "%s", untag_tiles_console(text).c_str()); } else if (Hints.hints_type == HINT_MAGIC_CHAR) @@ -977,7 +977,7 @@ void hints_monster_seen(const monster& mon) "this." "<tiles>\nAs a short-cut you can also <w>right-click</w> on your " "book in your inventory to read its description.</tiles>"; - mpr(untag_tiles_console(text), MSGCH_TUTORIAL, 0); + mprf(MSGCH_TUTORIAL, "%s", untag_tiles_console(text).c_str()); } } @@ -3047,7 +3047,7 @@ void learned_something_new(hints_event_type seen_what, coord_def gc) string output = text.str(); if (!cmd.empty()) insert_commands(output, cmd); - mpr(output, MSGCH_TUTORIAL); + mprf(MSGCH_TUTORIAL, "%s", output.c_str()); stop_running(); } @@ -4546,7 +4546,7 @@ void tutorial_msg(const char *key, bool end) // paragraphs by "\n\n", split_string() will ignore the empty line. vector<string> chunks = split_string("\n", text, false); for (size_t i = 0; i < chunks.size(); i++) - mpr(chunks[i], MSGCH_TUTORIAL); + mprf(MSGCH_TUTORIAL, "%s", chunks[i].c_str()); stop_running(); } diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 8d3b1aa255..3e3eccd494 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -193,7 +193,7 @@ void logfile_new_entry(const scorefile_entry &ne) logfile = _hs_open("a", _log_file_name()); if (logfile == NULL) { - mpr("ERROR: failure writing to the logfile.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "ERROR: failure writing to the logfile."); return; } diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index fb119ada8e..c203bb413f 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -2020,7 +2020,7 @@ bool prompt_failed(int retval, string msg) canned_msg(MSG_OK); } else - mpr(msg.c_str(), MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", msg.c_str()); crawl_state.cancel_cmd_repeat(); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index f2ffeed1e5..79f4270541 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -173,7 +173,7 @@ static int _cull_items(void) // XXX: Not the prettiest of messages, but the player // deserves to know whenever this kicks in. -- bwr - mpr("Too many items on level, removing some.", MSGCH_WARN); + mprf(MSGCH_WARN, "Too many items on level, removing some."); // Rules: // 1. Don't cleanup anything nearby the player @@ -552,8 +552,7 @@ void unlink_item(int dest) // Okay, finally warn player if we didn't do anything. if (!linked) { - mpr("BUG WARNING: Item didn't seem to be linked at all.", - MSGCH_ERROR); + mprf(MSGCH_ERROR, "BUG WARNING: Item didn't seem to be linked at all."); } #endif } @@ -1660,19 +1659,19 @@ int move_item_to_player(int obj, int quant_got, bool quiet, // Take a note! _check_note_item(it); - mpr("You pick up the Orb of Zot!", MSGCH_ORB); + mprf(MSGCH_ORB, "You pick up the Orb of Zot!"); you.char_direction = GDT_ASCENDING; burden_change(); env.orb_pos = you.pos(); // can be wrong in wizmode orb_pickup_noise(you.pos(), 30); - mpr("The lords of Pandemonium are not amused. Beware!", MSGCH_WARN); + mprf(MSGCH_WARN, "The lords of Pandemonium are not amused. Beware!"); if (you_worship(GOD_CHEIBRIADOS)) simple_god_message(" tells them not to hurry."); - mpr("Now all you have to do is get back out of the dungeon!", MSGCH_ORB); + mprf(MSGCH_ORB, "Now all you have to do is get back out of the dungeon!"); xom_is_stimulated(200, XM_INTRIGUED); invalidate_agrid(true); @@ -3265,11 +3264,11 @@ static void _rune_from_specs(const char* _specs, item_def &item) line += make_stringf("[%c] %-10s ", i + 'a', rune_type_name(i)); if (i % 5 == 4 || i == NUM_RUNE_TYPES - 1) { - mpr(line, MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", line.c_str()); line.clear(); } } - mpr("Which rune (ESC to exit)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which rune (ESC to exit)? "); int keyin = toalower(get_ch()); @@ -3347,12 +3346,10 @@ static void _deck_from_specs(const char* _specs, item_def &item) { while (true) { - mpr( -"[a] escape [b] destruction [c] dungeons [d] summoning [e] wonders", - MSGCH_PROMPT); - mpr( -"[f] punishment [g] war [h] changes [i] defence", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, +"[a] escape [b] destruction [c] dungeons [d] summoning [e] wonders"); + mprf(MSGCH_PROMPT, +"[f] punishment [g] war [h] changes [i] defence"); mpr("Which deck (ESC to exit)? "); const int keyin = toalower(get_ch()); @@ -3394,8 +3391,7 @@ static void _deck_from_specs(const char* _specs, item_def &item) { while (true) { - mpr("[a] plain [b] ornate [c] legendary? (ESC to exit)", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "[a] plain [b] ornate [c] legendary? (ESC to exit)"); int keyin = toalower(get_ch()); @@ -4080,7 +4076,7 @@ object_class_type get_item_mimic_type() } mprf("[%c] random", letter); choices[letter] = OBJ_RANDOM; - mpr("\nWhat kind of item mimic? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "\nWhat kind of item mimic? "); const int keyin = toalower(get_ch()); if (!choices.count(keyin)) diff --git a/crawl-ref/source/l_colour.cc b/crawl-ref/source/l_colour.cc index 72136ba2ba..6bfa080a5c 100644 --- a/crawl-ref/source/l_colour.cc +++ b/crawl-ref/source/l_colour.cc @@ -60,7 +60,7 @@ static int _lua_element_colour(int rand, const coord_def& loc, lua_pushinteger(ls, loc.y); if (!dlua.callfn(NULL, 3, 1)) { - mpr(dlua.error.c_str(), MSGCH_WARN); + mprf(MSGCH_WARN, "%s", dlua.error.c_str()); return BLACK; } diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc index b4f9b10ffc..c10ebfe69b 100644 --- a/crawl-ref/source/l_crawl.cc +++ b/crawl-ref/source/l_crawl.cc @@ -81,7 +81,7 @@ static int crawl_mpr(lua_State *ls) if (ch < 0 || ch >= NUM_MESSAGE_CHANNELS) ch = MSGCH_PLAIN; - mpr(message, static_cast<msg_channel_type>(ch)); + mprf(static_cast<msg_channel_type>(ch), "%s", message); return 0; } @@ -953,7 +953,7 @@ static int crawl_call_dlua(lua_State *ls) const char *msg = lua_tostring(dlua, -1); if (msg == NULL) msg = "(error object is not a string)"; - mpr(msg, MSGCH_ERROR); + mprf(MSGCH_ERROR, "%s", msg); } lua_settop(dlua, 0); // don't bother unwinding, just nuke the stack @@ -973,7 +973,7 @@ static int crawl_call_dlua(lua_State *ls) lua_pushstring(ls, ret); else { - mpr("call_dlua: cannot pass non-scalars yet (TODO)", MSGCH_ERROR); + mprf(MSGCH_ERROR, "call_dlua: cannot pass non-scalars yet (TODO)"); lua_pushnil(ls); } diff --git a/crawl-ref/source/l_debug.cc b/crawl-ref/source/l_debug.cc index fcd0c1ab70..f65d0ad3e5 100644 --- a/crawl-ref/source/l_debug.cc +++ b/crawl-ref/source/l_debug.cc @@ -170,8 +170,7 @@ LUAFN(debug_cull_monsters) return 0; } - mpr("menv[] is full, dismissing non-near monsters", - MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "menv[] is full, dismissing non-near monsters"); // menv[] is full for (monster_iterator mi; mi; ++mi) diff --git a/crawl-ref/source/luaterp.cc b/crawl-ref/source/luaterp.cc index 406e757356..78d9ad6856 100644 --- a/crawl-ref/source/luaterp.cc +++ b/crawl-ref/source/luaterp.cc @@ -100,7 +100,7 @@ static int _report(lua_State *ls, int status) const char *msg = lua_tostring(ls, -1); if (msg == NULL) msg = "(error object is not a string)"; - mpr(msg, MSGCH_ERROR); + mprf(MSGCH_ERROR, "%s", msg); lua_pop(ls, 1); } return status; diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index 2dd78ff27b..631422c6df 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -710,7 +710,7 @@ static keyseq _getch_mul(int (*rgetch)() = NULL) // get new keys from the user. if (crawl_state.is_replaying_keys()) { - mpr("(Key replay ran out of keys)", MSGCH_ERROR); + mprf(MSGCH_ERROR, "(Key replay ran out of keys)"); crawl_state.cancel_cmd_repeat(); crawl_state.cancel_cmd_again(); } @@ -891,10 +891,9 @@ void macro_add_query(void) KeymapContext keymc = KMC_DEFAULT; mesclr(); - mpr("(m)acro, (M)acro raw, keymap " - "[(k) default, (x) level-map, (t)argetting, (c)onfirm, m(e)nu], " - "(s)ave? ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "(m)acro, (M)acro raw, keymap " + "[(k) default, (x) level-map, (t)argetting, " + "(c)onfirm, m(e)nu], (s)ave? "); input = m_getch(); int low = toalower(input); @@ -958,7 +957,7 @@ void macro_add_query(void) string action = vtostr(mapref[key]); action = replace_all(action, "<", "<<"); mprf(MSGCH_WARN, "Current Action: %s", action.c_str()); - mpr("Do you wish to (r)edefine, (c)lear, or (a)bort? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Do you wish to (r)edefine, (c)lear, or (a)bort? "); input = m_getch(); @@ -1327,13 +1326,13 @@ void bind_command_to_key(command_type cmd, int key) if (is_userfunction(key)) { - mpr("Cannot bind user function keys to a command.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Cannot bind user function keys to a command."); return; } if (is_synthetic_key(key)) { - mpr("Cannot bind synthetic keys to a command.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Cannot bind synthetic keys to a command."); return; } diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index abf4827e65..f5192d824e 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -854,10 +854,10 @@ static void _handle_wizard_command(void) if (!you.wizard) { - mpr("WARNING: ABOUT TO ENTER WIZARD MODE!", MSGCH_WARN); + mprf(MSGCH_WARN, "WARNING: ABOUT TO ENTER WIZARD MODE!"); #ifndef SCORE_WIZARD_CHARACTERS - mpr("If you continue, your game will not be scored!", MSGCH_WARN); + mprf(MSGCH_WARN, "If you continue, your game will not be scored!"); #endif if (!yesno("Do you really want to enter wizard mode?", false, 'n')) @@ -881,7 +881,7 @@ static void _handle_wizard_command(void) } { - mpr("Enter Wizard Command (? - help): ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Enter Wizard Command (? - help): "); cursor_control con(true); wiz_command = getchm(); if (wiz_command == '*') @@ -938,8 +938,7 @@ static void _start_running(int dir, int mode) if (env.grid(*ai) == DNGN_SLIMY_WALL && (!you_worship(GOD_JIYVA) || you.penance[GOD_JIYVA])) { - mpr("You're about to run into the slime covered wall!", - MSGCH_WARN); + mprf(MSGCH_WARN, "You're about to run into the slime covered wall!"); return; } } @@ -1709,8 +1708,8 @@ static void _toggle_friendly_pickup() // Toggle pickup mode for friendlies. _print_friendly_pickup_setting(false); - mpr("Change to (d)efault, (n)othing, (f)riend-dropped, (p)layer, " - "or (a)ll? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Change to (d)efault, (n)othing, (f)riend-dropped, " + "(p)layer, or (a)ll? "); int type; { @@ -2148,7 +2147,7 @@ void process_command(command_type cmd) mpr(msg); } else // well, not examine, but... - mpr("Unknown command.", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "Unknown command."); break; } @@ -2175,9 +2174,9 @@ static void _prep_input() { ASSERT(you_worship(GOD_ASHENZARI)); if (you.seen_portals == 1) - mpr("You have a vision of a gate.", MSGCH_GOD); + mprf(MSGCH_GOD, "You have a vision of a gate."); else - mpr("You have a vision of multiple gates.", MSGCH_GOD); + mprf(MSGCH_GOD, "You have a vision of multiple gates."); you.seen_portals = 0; } @@ -2220,7 +2219,7 @@ static bool _decrement_a_duration(duration_type dur, int delay, if (need_expiration_warning(dur)) mprf(MSGCH_DANGER, "Careful! %s", midmsg); else - mpr(midmsg, chan); + mprf(chan, "%s", midmsg); } you.duration[dur] -= midloss * BASELINE_DELAY; } @@ -2229,7 +2228,7 @@ static bool _decrement_a_duration(duration_type dur, int delay, if (you.duration[dur] == 0) { if (endmsg) - mpr(endmsg, chan); + mprf(chan, "%s", endmsg); return true; } @@ -2246,7 +2245,7 @@ static void _decrement_paralysis(int delay) if (!you.duration[DUR_PARALYSIS] && !you.petrified()) { - mpr("You can move again.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You can move again."); you.redraw_evasion = true; you.duration[DUR_PARALYSIS_IMMUNITY] = roll_dice(1, 3) * BASELINE_DELAY; @@ -2390,7 +2389,7 @@ static void _decrement_durations() you.duration[DUR_ICEMAIL_DEPLETED] -= delay; if (!you.duration[DUR_ICEMAIL_DEPLETED]) - mpr("Your icy envelope is fully restored.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your icy envelope is fully restored."); you.redraw_armour_class = true; } @@ -2461,7 +2460,7 @@ static void _decrement_durations() if (you.duration[DUR_DIVINE_SHIELD] <= 1) { you.duration[DUR_DIVINE_SHIELD] = 1; - mpr("Your divine shield starts to fade.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your divine shield starts to fade."); } } @@ -2471,7 +2470,7 @@ static void _decrement_durations() if (--you.attribute[ATTR_DIVINE_SHIELD] == 0) { you.duration[DUR_DIVINE_SHIELD] = 0; - mpr("Your divine shield fades away.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your divine shield fades away."); } } } @@ -2490,57 +2489,57 @@ static void _decrement_durations() const int temp_effect = get_weapon_brand(weapon); set_item_ego_type(weapon, OBJ_WEAPONS, SPWPN_NORMAL); - string msg = weapon.name(DESC_YOUR); + const char *msg = nullptr; switch (temp_effect) { case SPWPN_VORPAL: if (get_vorpal_type(weapon) == DVORP_SLICING) - msg += " seems blunter."; + msg = " seems blunter."; else - msg += " feels lighter."; + msg = " feels lighter."; break; case SPWPN_FLAME: case SPWPN_FLAMING: - msg += " goes out."; + msg = " goes out."; break; case SPWPN_FREEZING: - msg += " stops glowing."; + msg = " stops glowing."; break; case SPWPN_FROST: - msg += "'s frost melts away."; + msg = "'s frost melts away."; break; case SPWPN_VENOM: - msg += " stops dripping with poison."; + msg = " stops dripping with poison."; break; case SPWPN_DRAINING: - msg += " stops crackling."; + msg = " stops crackling."; break; case SPWPN_DISTORTION: - msg += " seems straighter."; + msg = " seems straighter."; break; case SPWPN_PAIN: - msg += " seems less pained."; + msg = " seems less pained."; break; case SPWPN_CHAOS: - msg += " seems more stable."; + msg = " seems more stable."; break; case SPWPN_ELECTROCUTION: - msg += " stops emitting sparks."; + msg = " stops emitting sparks."; break; case SPWPN_HOLY_WRATH: - msg += "'s light goes out."; + msg = "'s light goes out."; break; case SPWPN_ANTIMAGIC: - msg += " stops repelling magic."; + msg = " stops repelling magic."; calc_mp(); break; default: - msg += " seems inexplicably less special."; + msg = " seems inexplicably less special."; break; } - mpr(msg.c_str(), MSGCH_DURATION); + mprf(MSGCH_DURATION, "%s%s", weapon.name(DESC_YOUR).c_str(), msg); you.wield_change = true; } } @@ -2756,14 +2755,14 @@ static void _decrement_durations() } else { - mpr("You pass out from exhaustion.", MSGCH_WARN); + mprf(MSGCH_WARN, "You pass out from exhaustion."); you.increase_duration(DUR_PARALYSIS, roll_dice(1,4)); you.stop_constricting_all(); } } if (!you.duration[DUR_PARALYSIS] && !you.petrified()) - mpr("You are exhausted.", MSGCH_WARN); + mprf(MSGCH_WARN, "You are exhausted."); if (you.species == SP_LAVA_ORC) mpr("You feel less hot-headed."); @@ -2797,7 +2796,7 @@ static void _decrement_durations() } if (_decrement_a_duration(DUR_CORONA, delay) && !you.backlit()) - mpr("You are no longer glowing.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You are no longer glowing."); // Leak piety from the piety pool into actual piety. // Note that changes of religious status without corresponding actions @@ -2811,10 +2810,10 @@ static void _decrement_durations() gain_piety(1, 1, true); #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_SACRIFICE) || defined(DEBUG_PIETY) - mpr("Piety increases by 1 due to piety pool.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Piety increases by 1 due to piety pool."); if (you.duration[DUR_PIETY_POOL] == 0) - mpr("Piety pool is now empty.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Piety pool is now empty."); #endif } @@ -2873,7 +2872,7 @@ static void _decrement_durations() else if (x_chance_in_y(you.rotting, 20) && !you.duration[DUR_DEATHS_DOOR]) { - mpr("You feel your flesh rotting away.", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel your flesh rotting away."); rot_hp(1); you.rotting--; } @@ -2898,7 +2897,7 @@ static void _decrement_durations() if (one_chance_in(resilience)) { dprf("rot rate: 1/%d", resilience); - mpr("You feel your flesh rotting away.", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel your flesh rotting away."); rot_hp(1); if (you.rotting > 0) you.rotting--; @@ -3034,7 +3033,7 @@ static void _decrement_durations() } if (_decrement_a_duration(DUR_SPIRIT_HOWL, delay)) { - mpr("The howling abruptly ceases.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "The howling abruptly ceases."); add_daction(DACT_END_SPIRIT_HOWL); you.props["spirit_howl_cooldown"].get_int() = you.elapsed_time + random_range(1500, 3000); @@ -3085,11 +3084,11 @@ static void _check_banished() ASSERT(brdepth[BRANCH_ABYSS] != -1); you.banished = false; if (!player_in_branch(BRANCH_ABYSS)) - mpr("You are cast into the Abyss!", MSGCH_BANISHMENT); + mprf(MSGCH_BANISHMENT, "You are cast into the Abyss!"); else if (you.depth < brdepth[BRANCH_ABYSS]) - mpr("You are cast deeper into the Abyss!", MSGCH_BANISHMENT); + mprf(MSGCH_BANISHMENT, "You are cast deeper into the Abyss!"); else - mpr("The Abyss bends around you!", MSGCH_BANISHMENT); + mprf(MSGCH_BANISHMENT, "The Abyss bends around you!"); more(); banished(you.banished_by); you.banished_by.clear(); @@ -3284,8 +3283,7 @@ static void _player_reacts() else if (player_in_branch(BRANCH_ABYSS) && one_chance_in(80) && (!map_masked(you.pos(), MMT_VAULT) || one_chance_in(3))) { - mpr("You are suddenly pulled into a different region of the Abyss!", - MSGCH_BANISHMENT); + mprf(MSGCH_BANISHMENT, "You are suddenly pulled into a different region of the Abyss!"); you_teleport_now(false, true); // to new area of the Abyss // It's effectively a new level, make a checkpoint save so eventual @@ -3421,7 +3419,7 @@ static void _update_golubria_traps() if (you.see_cell(*it)) mpr("Your passage of Golubria closes with a snap!"); else - mpr("You hear a snapping sound.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a snapping sound."); trap->destroy(); noisy(8, *it); } @@ -3829,7 +3827,7 @@ static void _open_door(coord_def move, bool check_confused) door_move.delta = move; else { - mpr("Which direction?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which direction?"); direction_chooser_args args; args.restricts = DIR_DIR; direction(door_move, args); @@ -4088,7 +4086,7 @@ static void _close_door(coord_def move) door_move.delta = move; else { - mpr("Which direction?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which direction?"); direction_chooser_args args; args.restricts = DIR_DIR; direction(door_move, args); @@ -4308,13 +4306,13 @@ static void _do_berserk_no_combat_penalty(void) switch (you.berserk_penalty) { case 2: - mpr("You feel a strong urge to attack something.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel a strong urge to attack something."); break; case 4: - mpr("You feel your anger subside.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel your anger subside."); break; case 6: - mpr("Your blood rage is quickly leaving you.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your blood rage is quickly leaving you."); break; } @@ -4768,7 +4766,7 @@ static int _get_num_and_char_keyfun(int &ch) static int _get_num_and_char(const char* prompt, char* buf, int buf_len) { if (prompt != NULL) - mpr(prompt, MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", prompt); line_reader reader(buf, buf_len); @@ -4841,7 +4839,7 @@ static void _run_input_with_keys(const keyseq& keys) if (get_macro_buf_size() < old_buf_size) { - mpr("(Key replay stole keys)", MSGCH_ERROR); + mprf(MSGCH_ERROR, "(Key replay stole keys)"); crawl_state.cancel_cmd_all(); } } @@ -4884,7 +4882,7 @@ static void _do_cmd_repeat() c_input_reset(true); if (ch == ' ' || ch == CK_ENTER) { - mpr("Enter command to be repeated: ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Enter command to be repeated: "); // Enable the cursor to read input. cursor_control con(true); @@ -4964,7 +4962,7 @@ static void _do_prev_cmd_again() if (crawl_state.doing_prev_cmd_again) { - mpr("Trying to re-do re-do command, aborting.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Trying to re-do re-do command, aborting."); crawl_state.cancel_cmd_all(); return; } diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc index 2bd418f10c..04da00a997 100644 --- a/crawl-ref/source/melee_attack.cc +++ b/crawl-ref/source/melee_attack.cc @@ -867,7 +867,7 @@ bool melee_attack::handle_phase_damaged() } if (shroud_broken) - mpr("Your shroud falls apart!", MSGCH_WARN); + mprf(MSGCH_WARN, "Your shroud falls apart!"); if (defender->is_player() && you.mutation[MUT_JELLY_GROWTH] && x_chance_in_y(damage_done, you.hp_max)) @@ -2532,7 +2532,7 @@ void melee_attack::antimagic_affects_defender() int mp_loss = min(you.magic_points, random2(damage_done * 2)); if (!mp_loss) return; - mpr("You feel your power leaking away.", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel your power leaking away."); drain_mp(mp_loss); obvious_effect = true; } @@ -2927,7 +2927,7 @@ void melee_attack::chaos_affects_attacker() if (!msg.empty()) { - mpr(msg.c_str(), MSGCH_SOUND); + mprf(MSGCH_SOUND, "%s", msg.c_str()); noisy(15, attack_position, attacker->mindex()); #ifdef NOTE_DEBUG_CHAOS_EFFECTS take_note(Note(NOTE_MESSAGE, 0, 0, diff --git a/crawl-ref/source/message-stream.cc b/crawl-ref/source/message-stream.cc index 4b074359ee..e21e6f780b 100644 --- a/crawl-ref/source/message-stream.cc +++ b/crawl-ref/source/message-stream.cc @@ -73,7 +73,7 @@ namespace msg { // null-terminate and print the string internal_buf[internal_count] = 0; - mpr(internal_buf, channel, param); + mprf(channel, param, "%s", internal_buf); internal_count = 0; @@ -85,7 +85,7 @@ namespace msg if (internal_count + 3 > INTERNAL_LENGTH) { - mpr("oops, hit overflow", MSGCH_ERROR); + mprf(MSGCH_ERROR, "oops, hit overflow"); internal_count = 0; return streambuf::traits_type::eof(); } diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 1d3c6c199c..6f1c11113a 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -1274,7 +1274,7 @@ void msgwin_reply(string reply) msgwin_clear_temporary(); msgwin_set_temporary(false); reply = replace_all(reply, "<", "<<"); - mpr(_prompt + "<lightgrey>" + reply + "</lightgrey>", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s<lightgrey>%s</lightgrey>", _prompt.c_str(), reply.c_str()); msgwin.got_input(); } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 4a700e5092..0c6d4e2a32 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1611,7 +1611,7 @@ bool i_feel_safe(bool announce, bool want_move, bool just_monsters, return true; if (announce) - mpr(msg, MSGCH_WARN); + mprf(MSGCH_WARN, "%s", msg.c_str()); return false; } @@ -1764,7 +1764,7 @@ static void _drop_tomb(const coord_def& pos, bool premature, bool zin) else { if (!silenced(you.pos())) - mpr("You hear a deep rumble.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a deep rumble."); else mpr("You feel the ground shudder."); } diff --git a/crawl-ref/source/mislead.cc b/crawl-ref/source/mislead.cc index 5a9e1700bf..b024142054 100644 --- a/crawl-ref/source/mislead.cc +++ b/crawl-ref/source/mislead.cc @@ -126,7 +126,7 @@ void mons_cast_mislead(monster* mons) if (old_value <= 0) { - mpr("But for a moment, strange images dance in front of your eyes.", MSGCH_WARN); + mprf(MSGCH_WARN, "But for a moment, strange images dance in front of your eyes."); #ifdef USE_TILE_LOCAL tiles.add_overlay(you.pos(), tileidx_zap(MAGENTA)); update_screen(); @@ -136,7 +136,7 @@ void mons_cast_mislead(monster* mons) more(); } else - mpr("You are even more misled!", MSGCH_WARN); + mprf(MSGCH_WARN, "You are even more misled!"); learned_something_new(HINT_YOU_ENCHANTED); diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 3cc1f59bdb..542fde42d1 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -909,7 +909,7 @@ static void _starcursed_scream(monster* mon, actor* target) int n = chorus.size(); int dam = 0; int stun = 0; - string message; + const char* message = nullptr; dprf("Chorus size: %d", n); @@ -946,7 +946,7 @@ static void _starcursed_scream(monster* mon, actor* target) } else { - mpr(message, MSGCH_MONSTER_SPELL); + mprf(MSGCH_MONSTER_SPELL, "%s", message); ouch(dam, mon->mindex(), KILLED_BY_BEAM, "accursed screaming"); } @@ -2121,11 +2121,11 @@ bool apply_grasping_roots(monster* mons) { if (you.see_cell(mons->pos()) && one_chance_in(12)) { - mpr(random_choose( + mprf(MSGCH_TALK_VISUAL, "%s", random_choose( "Tangled roots snake along the ground.", "The ground creaks as gnarled roots bulge its surface.", "A root reaches out and grasps at passing movement.", - 0), MSGCH_TALK_VISUAL); + 0)); } bool found_hostile = false; @@ -3878,15 +3878,15 @@ bool mon_special_ability(monster* mons, bolt & beem) // If you're already mesmerised by an invisible mermaid she // can still prolong the enchantment; otherwise you "resist". if (already_mesmerised) - mpr("You hear a luring song.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a luring song."); else { if (one_chance_in(4)) // reduce spamminess { if (coinflip()) - mpr("You hear a haunting song.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a haunting song."); else - mpr("You hear an eerie melody.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear an eerie melody."); canned_msg(MSG_YOU_RESIST); // flavour only } diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 430ce54d23..1e689a25bd 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -1142,7 +1142,7 @@ static void _mons_fire_wand(monster* mons, item_def &wand, bolt &beem, if (!simple_monster_message(mons, " zaps a wand.")) { if (!silenced(you.pos())) - mpr("You hear a zap.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a zap."); } // charge expenditure {dlb} @@ -1182,7 +1182,7 @@ static void _rod_fired_pre(monster* mons) if (!simple_monster_message(mons, " zaps a rod.") && !silenced(you.pos())) { - mpr("You hear a zap.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a zap."); } } @@ -1938,9 +1938,9 @@ void handle_monster_move(monster* mons) mprf(MSGCH_ERROR, "Monster %s became detached from mgrd " "in handle_monster_move() loop", mons->name(DESC_PLAIN, true).c_str()); - mpr("[[[[[[[[[[[[[[[[[[", MSGCH_WARN); + mprf(MSGCH_WARN, "[[[[[[[[[[[[[[[[[["); debug_mons_scan(); - mpr("]]]]]]]]]]]]]]]]]]", MSGCH_WARN); + mprf(MSGCH_WARN, "]]]]]]]]]]]]]]]]]]"); monster_was_floating = true; } else if (monster_was_floating @@ -1982,7 +1982,7 @@ void handle_monster_move(monster* mons) MSGCH_WARN); } else - mpr("You hear a loud crackle.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a loud crackle."); } // Done this way to keep the detonation timer predictable mons->speed_increment -= 10; @@ -2554,7 +2554,7 @@ static bool _jelly_divide(monster* parent) if (!simple_monster_message(parent, " splits in two!") && (player_can_hear(parent->pos()) || player_can_hear(child->pos()))) { - mpr("You hear a squelching noise.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a squelching noise."); } if (crawl_state.game_is_arena()) @@ -3882,9 +3882,9 @@ static bool _monster_move(monster* mons) { // Message depends on whether caused by boring beetle or // acid (Dissolution). - mpr((mons->type == MONS_BORING_BEETLE) ? - "You hear a grinding noise." : - "You hear a sizzling sound.", MSGCH_SOUND); + mprf(MSGCH_SOUND, (mons->type == MONS_BORING_BEETLE) ? + "You hear a grinding noise." : + "You hear a sizzling sound."); } } } diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index f8b9470c9f..7fe5c5485b 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -329,8 +329,7 @@ void handle_behaviour(monster* mon) const int loss = div_rand_round(10, mon->speed); if (loss) { - mpr("Your flesh rots away as the Orb of Zot is desecrated.", - MSGCH_DANGER); + mprf(MSGCH_DANGER, "Your flesh rots away as the Orb of Zot is desecrated."); // If the rot would reduce us to <= 0 max HP, attribute the // kill to the monster. diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index 143ec872fd..f4d432e496 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -2972,8 +2972,7 @@ static int _monster_abjure_square(const coord_def &pos, else if (is_sanctuary(target->pos())) { pow = 0; - mpr("Zin's power protects your fellow warrior from evil magic!", - MSGCH_GOD); + mprf(MSGCH_GOD, "Zin's power protects your fellow warrior from evil magic!"); shielded = true; } @@ -3671,8 +3670,7 @@ static void _mons_create_tentacles(monster* head) int head_index = head->mindex(); if (invalid_monster_index(head_index)) { - mpr("Error! Tentacle head is not a part of the current environment!", - MSGCH_ERROR); + mprf(MSGCH_ERROR, "Error! Tentacle head is not a part of the current environment!"); return; } @@ -4546,7 +4544,7 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, { slugform = replace_all(slugform, "@The_monster@", mons->name(DESC_THE)); - mpr(slugform.c_str(), channel); + mprf(channel, "%s", slugform.c_str()); } } else if (!friendly && !has_mon_foe) @@ -4571,7 +4569,7 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, { slugform = replace_all(slugform, "@The_monster@", foe->name(DESC_THE)); - mpr(slugform.c_str(), MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "%s", slugform.c_str()); } } } @@ -4789,8 +4787,8 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, if (!msg.empty()) { msg = replace_all(msg, "@The_monster@", mons->name(DESC_THE)); - mpr(msg.c_str(), mons->wont_attack() ? MSGCH_FRIEND_ENCHANT - : MSGCH_MONSTER_ENCHANT); + mprf(mons->wont_attack() ? MSGCH_FRIEND_ENCHANT + : MSGCH_MONSTER_ENCHANT, "%s", msg.c_str()); } return; } diff --git a/crawl-ref/source/mon-clone.cc b/crawl-ref/source/mon-clone.cc index 9ca9e708b6..eb71bfddd2 100644 --- a/crawl-ref/source/mon-clone.cc +++ b/crawl-ref/source/mon-clone.cc @@ -195,8 +195,7 @@ void mons_summon_illusion_from(monster* mons, actor *foe, mgen_data(MONS_PLAYER_ILLUSION, SAME_ATTITUDE(mons), mons, 6, spell_cast, mons->pos(), mons->foe, 0))) { - mpr("There is a horrible, sudden wrenching feeling in your soul!", - MSGCH_WARN); + mprf(MSGCH_WARN, "There is a horrible, sudden wrenching feeling in your soul!"); // Change type from player ghost. clone->type = MONS_PLAYER_ILLUSION; diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index d30306d3a1..79cce57ee2 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -364,13 +364,13 @@ void spawn_random_monsters() } #ifdef DEBUG_MON_CREATION - mpr("in spawn_random_monsters()", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "in spawn_random_monsters()"); #endif int rate = env.spawn_random_rate; if (!rate) { #ifdef DEBUG_MON_CREATION - mpr("random monster gen turned off", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "random monster gen turned off"); #endif return; } @@ -806,7 +806,7 @@ static void _abyss_monster_creation_message(const monster* mon) monster* place_monster(mgen_data mg, bool force_pos, bool dont_place) { #ifdef DEBUG_MON_CREATION - mpr("in place_monster()", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "in place_monster()"); #endif int tries = 0; @@ -872,7 +872,7 @@ monster* place_monster(mgen_data mg, bool force_pos, bool dont_place) if (create_band) { #ifdef DEBUG_MON_CREATION - mpr("Choose band members...", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Choose band members..."); #endif band = _choose_band(mg.cls, band_size, leader); band_size++; @@ -2009,7 +2009,7 @@ static band_type _choose_band(monster_type mon_type, int &band_size, bool &natural_leader) { #ifdef DEBUG_MON_CREATION - mpr("in _choose_band()", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "in _choose_band()"); #endif // Band size describes the number of monsters in addition to // the band leader. @@ -3058,7 +3058,7 @@ static monster_type _pick_zot_exit_defender() if (one_chance_in(11)) { #ifdef DEBUG_MON_CREATION - mpr("Create a pandemonium lord!", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Create a pandemonium lord!"); #endif for (int i = 0; i < 4; i++) { @@ -3086,7 +3086,7 @@ static monster_type _pick_zot_exit_defender() monster* mons_place(mgen_data mg) { #ifdef DEBUG_MON_CREATION - mpr("in mons_place()", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "in mons_place()"); #endif int mon_count = 0; for (int il = 0; il < MAX_MONSTERS; il++) @@ -3099,7 +3099,7 @@ monster* mons_place(mgen_data mg) return 0; #ifdef DEBUG_MON_CREATION - mpr("Set class RANDOM_MONSTER", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Set class RANDOM_MONSTER"); #endif mg.cls = RANDOM_MONSTER; } @@ -3114,7 +3114,7 @@ monster* mons_place(mgen_data mg) && player_in_connected_branch() && !mg.summoned()) { #ifdef DEBUG_MON_CREATION - mpr("Call _pick_zot_exit_defender()", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Call _pick_zot_exit_defender()"); #endif mg.cls = _pick_zot_exit_defender(); mg.flags |= MG_PERMIT_BANDS; diff --git a/crawl-ref/source/mon-project.cc b/crawl-ref/source/mon-project.cc index 55e7bb35d8..ace0d0231b 100644 --- a/crawl-ref/source/mon-project.cc +++ b/crawl-ref/source/mon-project.cc @@ -54,7 +54,7 @@ spret_type cast_iood(actor *caster, int pow, bolt *beam, float vx, float vy, GOD_NO_GOD), true, true); if (!mon) { - mpr("Failed to spawn projectile.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Failed to spawn projectile."); return SPRET_ABORT; } diff --git a/crawl-ref/source/mon-speak.cc b/crawl-ref/source/mon-speak.cc index 12f957e0f7..2c5345c33d 100644 --- a/crawl-ref/source/mon-speak.cc +++ b/crawl-ref/source/mon-speak.cc @@ -862,7 +862,7 @@ bool mons_speaks_msg(monster* mons, const string &msg, { if (you.can_see(mons)) handle_seen_interrupt(mons); - mpr(line.c_str(), msg_type); + mprf(msg_type, "%s", line.c_str()); } } return noticed; diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index 4ac22a8b39..2ca98b91b3 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -1015,7 +1015,7 @@ static void _mummy_curse(monster* mons, killer_type killer, int index) case MONS_KHUFU: pow = 15; break; default: - mpr("Unknown mummy type.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Unknown mummy type."); return; } @@ -1053,15 +1053,14 @@ static void _mummy_curse(monster* mons, killer_type killer, int index) return; } - mpr("You feel nervous for a moment...", MSGCH_MONSTER_SPELL); + mprf(MSGCH_MONSTER_SPELL, "You feel nervous for a moment..."); curse_an_item(); } else { if (index == NON_MONSTER) { - mpr("You feel extremely nervous for a moment...", - MSGCH_MONSTER_SPELL); + mprf(MSGCH_MONSTER_SPELL, "You feel extremely nervous for a moment..."); } else if (you.can_see(target)) { @@ -1221,7 +1220,7 @@ static bool _explode_monster(monster* mons, killer_type killer, saw = true; viewwindow(); if (is_sanctuary(mons->pos())) - mpr(sanct_msg, MSGCH_GOD); + mprf(MSGCH_GOD, "%s", sanct_msg); else mprf(MSGCH_MONSTER_DAMAGE, MDAM_DEAD, "%s explodes!", mons->full_name(DESC_THE).c_str()); @@ -1689,8 +1688,8 @@ int monster_die(monster* mons, killer_type killer, you.increase_duration(DUR_BERSERK, bonus); - mpr("You feel the power of Trog in you as your rage grows.", - MSGCH_GOD, GOD_TROG); + mprf(MSGCH_GOD, GOD_TROG, + "You feel the power of Trog in you as your rage grows."); } else if (player_equip_unrand(UNRAND_BLOODLUST)) { @@ -1821,10 +1820,9 @@ int monster_die(monster* mons, killer_type killer, { if (you.can_see(mons)) { - mpr(silenced(mons->pos()) ? + mprf(MSGCH_MONSTER_DAMAGE, MDAM_DEAD, silenced(mons->pos()) ? "The tentacle is hauled back through the portal!" : - "With a roar, the tentacle is hauled back through the portal!", - MSGCH_MONSTER_DAMAGE, MDAM_DEAD); + "With a roar, the tentacle is hauled back through the portal!"); } silent = true; } @@ -3852,7 +3850,7 @@ bool simple_monster_message(const monster* mons, const char *event, if (channel == MSGCH_PLAIN && mons->wont_attack()) channel = MSGCH_FRIEND_ACTION; - mpr(msg.c_str(), channel, param); + mprf(channel, param, "%s", msg.c_str()); return true; } @@ -4950,32 +4948,32 @@ void temperature_changed(float change) // Just reached the temp that kills off stoneskin. if (change > pos_threshold && temperature_tier(TEMP_WARM)) { - mpr("Your stony skin melts.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your stony skin melts."); you.redraw_armour_class = true; } // Passive heat stuff. if (change > pos_threshold && temperature_tier(TEMP_FIRE)) - mpr("You're getting fired up.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You're getting fired up."); // Heat aura stuff. if (change > pos_threshold && temperature_tier(TEMP_MAX)) { - mpr("You blaze with the fury of an erupting volcano!", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You blaze with the fury of an erupting volcano!"); invalidate_agrid(true); } // For DECREMENTS (reverse order): if (change < neg_threshold && temperature_tier(TEMP_MAX)) - mpr("The intensity of your heat diminishes.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "The intensity of your heat diminishes."); if (change < neg_threshold && temperature_tier(TEMP_FIRE)) - mpr("You're cooling off.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You're cooling off."); // Cooled down enough for stoneskin to kick in again. if (change < neg_threshold && temperature_tier(TEMP_WARM)) { - mpr("Your skin cools and hardens.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your skin cools and hardens."); you.redraw_armour_class = true; } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 27b1a975d5..728644cd6c 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1083,7 +1083,7 @@ void discover_mimic(const coord_def& pos, bool wake) monster *mimic = place_monster(mg, true, true); if (!mimic) { - mpr("Too many monsters on level, can't place mimic.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Too many monsters on level, can't place mimic."); if (item) destroy_item(*item, true); return; @@ -4248,7 +4248,7 @@ string do_mon_str_replacements(const string &in_msg, const monster* mons, if (s_type < 0 || s_type >= NUM_LOUDNESS || s_type == NUM_SHOUTS) { - mpr("Invalid @says@ type.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Invalid @says@ type."); msg = replace_all(msg, "@says@", "buggily says"); } else diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 28e5197e25..ac98e76a42 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -891,7 +891,7 @@ void monster::equip_weapon(item_def &item, int near, bool msg) mpr("It softly glows with a divine radiance!"); break; case SPWPN_ELECTROCUTION: - mpr("You hear the crackle of electricity.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear the crackle of electricity."); break; case SPWPN_VENOM: mpr("It begins to drip with poison!"); @@ -2961,7 +2961,7 @@ bool monster::fumbles_attack(bool verbose) : " splashes around in the water.")); } else if (player_can_hear(pos(), LOS_RADIUS)) - mpr("You hear a splashing noise.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear a splashing noise."); } return true; @@ -5834,7 +5834,7 @@ void monster::steal_item_from_player() if (!msg.empty() && msg != "__NONE") { msg = replace_all(msg, "@The_monster@", name(DESC_THE)); - mpr(msg.c_str(), MSGCH_TALK); + mprf(MSGCH_TALK, "%s", msg.c_str()); } return; } @@ -5909,7 +5909,7 @@ void monster::steal_item_from_player() { complaint = replace_all(complaint, "@The_monster@", name(DESC_THE)); - mpr(complaint.c_str(), MSGCH_TALK); + mprf(MSGCH_TALK, "%s", complaint.c_str()); } bolt beem; diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 4e9084f635..63e398a873 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1506,7 +1506,7 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg, && !one_chance_in(temporary ? 2 : 3))) { if (failMsg) - mpr("You feel odd for a moment.", MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "You feel odd for a moment."); maybe_id_resist(BEAM_MALMUTATE); return false; } @@ -1533,7 +1533,7 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg, lose_stat(STAT_RANDOM, 1, false, reason); else { - mpr("Your body decomposes!", MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "Your body decomposes!"); if (coinflip()) lose_stat(STAT_RANDOM, 1, false, reason); @@ -1645,8 +1645,9 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg, arms = "tentacles"; else break; - mpr(replace_all(mdef.gain[you.mutation[mutat]-1], "arms", - arms).c_str(), MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "%s", + replace_all(mdef.gain[you.mutation[mutat]-1], "arms", + arms).c_str()); gain_msg = false; } break; @@ -1673,7 +1674,7 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg, notify_stat_change("gaining a mutation"); if (gain_msg) - mpr(mdef.gain[you.mutation[mutat]-1], MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "%s", mdef.gain[you.mutation[mutat]-1]); // Do post-mutation effects. switch (mutat) @@ -1824,7 +1825,7 @@ static bool _delete_single_mutation_level(mutation_type mutat, notify_stat_change("losing a mutation"); if (lose_msg) - mpr(mdef.lose[you.mutation[mutat]], MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "%s", mdef.lose[you.mutation[mutat]]); // Do post-mutation effects. if (mutat == MUT_FRAIL || mutat == MUT_ROBUST @@ -1873,7 +1874,7 @@ bool delete_mutation(mutation_type which_mutation, const string &reason, || coinflip())) { if (failMsg) - mpr("You feel rather odd for a moment.", MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "You feel rather odd for a moment."); return false; } } @@ -2423,7 +2424,7 @@ bool perma_mutate(mutation_type which_mut, int how_much, const string &reason) // than zero, and the innate mutation level for the mutation // in question is one less than the cap, we are permafying a // temporary mutation. This fails to produce any output normally. - mpr("Your mutations feel more permanent.", MSGCH_MUTATION); + mprf(MSGCH_MUTATION, "Your mutations feel more permanent."); } else if (you.mutation[which_mut] < cap && !mutate(which_mut, reason, false, true, false, false, true)) @@ -2489,8 +2490,8 @@ static bool _balance_demonic_guardian() && !one_chance_in(3) && !mons->has_ench(ENCH_LIFE_TIMER)) { - mpr(mons->name(DESC_THE) + " " - + summoned_poof_msg(*mons) + "!", MSGCH_PLAIN); + mprf("%s %s!", mons->name(DESC_THE).c_str(), + summoned_poof_msg(*mons).c_str()); monster_die(*mons, KILL_NONE, NON_MONSTER); } else diff --git a/crawl-ref/source/orb.cc b/crawl-ref/source/orb.cc index 119fe06aeb..f04df9f69a 100644 --- a/crawl-ref/source/orb.cc +++ b/crawl-ref/source/orb.cc @@ -57,15 +57,15 @@ void orb_pickup_noise(const coord_def& where, int loudness, const char* msg, con if (_orb_noise(where, loudness)) { if (msg) - mpr(msg, MSGCH_ORB); + mprf(MSGCH_ORB, "%s", msg); else - mpr("The orb lets out a hideous shriek!", MSGCH_ORB); + mprf(MSGCH_ORB, "The orb lets out a hideous shriek!"); } else { if (msg2) - mpr(msg2, MSGCH_ORB); + mprf(MSGCH_ORB, "%s", msg2); else - mpr("The orb lets out a furious burst of light!", MSGCH_ORB); + mprf(MSGCH_ORB, "The orb lets out a furious burst of light!"); } } diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index aef83f0cc3..7c1f50cfc5 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -89,7 +89,7 @@ static void _maybe_melt_player_enchantments(beam_type flavour, int damage) if (you.mutation[MUT_ICEMAIL]) { - mpr("Your icy envelope dissipates!", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your icy envelope dissipates!"); you.duration[DUR_ICEMAIL_DEPLETED] = ICEMAIL_TIME; you.redraw_armour_class = true; } @@ -645,7 +645,7 @@ bool expose_player_to_element(beam_type flavour, int strength, if (flavour == BEAM_WATER && you.duration[DUR_LIQUID_FLAMES]) { - mpr("The flames go out!", MSGCH_WARN); + mprf(MSGCH_WARN, "The flames go out!"); you.duration[DUR_LIQUID_FLAMES] = 0; you.props.erase("napalmer"); you.props.erase("napalm_aux"); @@ -665,7 +665,7 @@ static void _lose_level_abilities() { you.increase_duration(DUR_FLIGHT, 50, 100); you.attribute[ATTR_PERM_FLIGHT] = 0; - mpr("You feel your flight won't last long.", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel your flight won't last long."); } } @@ -1081,14 +1081,14 @@ void ouch(int dam, int death_source, kill_method_type death_type, // Even if we have low HP messages off, we'll still give a // big hit warning (in this case, a hit for half our HPs) -- bwr if (dam > 0 && you.hp_max <= dam * 2) - mpr("Ouch! That really hurt!", MSGCH_DANGER); + mprf(MSGCH_DANGER, "Ouch! That really hurt!"); if (you.hp > 0) { if (Options.hp_warning && you.hp <= (you.hp_max * Options.hp_warning) / 100) { - mpr("* * * LOW HITPOINT WARNING * * *", MSGCH_DANGER); + mprf(MSGCH_DANGER, "* * * LOW HITPOINT WARNING * * *"); dungeon_events.fire_event(DET_HP_WARNING); } @@ -1352,8 +1352,7 @@ void _end_game(scorefile_entry &se) else if (se.get_death_type() != KILLED_BY_DISINT && se.get_death_type() != KILLED_BY_LAVA) { - mpr("Your body rises from the dead as a mindless zombie.", - MSGCH_GOD); + mprf(MSGCH_GOD, "Your body rises from the dead as a mindless zombie."); } // No message if you're not undead and your corpse is lost. break; 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; diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc index 86fa5d5058..0bf1af07d4 100644 --- a/crawl-ref/source/player-stats.cc +++ b/crawl-ref/source/player-stats.cc @@ -98,10 +98,9 @@ bool attribute_increase() me->add_tile(tile_def(TILEG_DODGING_ON, TEX_GUI)); pop->push_entry(me); #else - mpr("Your experience leads to an increase in your attributes!", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your experience leads to an increase in your attributes!"); learned_something_new(HINT_CHOOSE_STAT); - mpr("Increase (S)trength, (I)ntelligence, or (D)exterity? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Increase (S)trength, (I)ntelligence, or (D)exterity? "); #endif mouse_control mc(MOUSE_MODE_PROMPT); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 2cc60cc101..cbe8ec1ff5 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2902,9 +2902,9 @@ static void _remove_temp_mutations() 2 + random2(3))); if (num_remove >= you.attribute[ATTR_TEMP_MUTATIONS]) - mpr("You feel the corruption within you wane completely.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel the corruption within you wane completely."); else - mpr("You feel the corruption within you wane somewhat.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel the corruption within you wane somewhat."); for (int i = 0; i < num_remove; ++i) delete_temp_mutation(); @@ -3055,7 +3055,7 @@ void gain_exp(unsigned int exp_gained, unsigned int* actual_gain) if (you.attribute[ATTR_XP_DRAIN] <= 0) { you.attribute[ATTR_XP_DRAIN] = 0; - mpr("Your life force feels restored.", MSGCH_RECOVERY); + mprf(MSGCH_RECOVERY, "Your life force feels restored."); } } } @@ -3065,53 +3065,44 @@ static void _draconian_scale_colour_message() switch (you.species) { case SP_RED_DRACONIAN: - mpr("Your scales start taking on a fiery red colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a fiery red colour."); perma_mutate(MUT_HEAT_RESISTANCE, 1, "draconian maturity"); break; case SP_WHITE_DRACONIAN: - mpr("Your scales start taking on an icy white colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on an icy white colour."); perma_mutate(MUT_COLD_RESISTANCE, 1, "draconian maturity"); break; case SP_GREEN_DRACONIAN: - mpr("Your scales start taking on a lurid green colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a lurid green colour."); perma_mutate(MUT_POISON_RESISTANCE, 1, "draconian maturity"); break; case SP_YELLOW_DRACONIAN: - mpr("Your scales start taking on a golden yellow colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a golden yellow colour."); break; case SP_GREY_DRACONIAN: - mpr("Your scales start taking on a dull iron-grey colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a dull iron-grey colour."); perma_mutate(MUT_UNBREATHING, 1, "draconian maturity"); break; case SP_BLACK_DRACONIAN: - mpr("Your scales start taking on a glossy black colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a glossy black colour."); perma_mutate(MUT_SHOCK_RESISTANCE, 1, "draconian maturity"); break; case SP_PURPLE_DRACONIAN: - mpr("Your scales start taking on a rich purple colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a rich purple colour."); break; case SP_MOTTLED_DRACONIAN: - mpr("Your scales start taking on a weird mottled pattern.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start taking on a weird mottled pattern."); break; case SP_PALE_DRACONIAN: - mpr("Your scales start fading to a pale cyan-grey colour.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales start fading to a pale cyan-grey colour."); break; case SP_BASE_DRACONIAN: @@ -3137,7 +3128,7 @@ static void _felid_extra_life() && you.lives < 2) { you.lives++; - mpr("Extra life!", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Extra life!"); you.attribute[ATTR_LIFE_GAINED] = you.max_level; // Should play the 1UP sound from SMB... } @@ -3193,8 +3184,7 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) if (new_exp == 27) { - mpr("You have reached level 27, the final one!", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You have reached level 27, the final one!"); } else { @@ -3249,8 +3239,7 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) case SP_DEEP_DWARF: if (you.experience_level == 14) { - mpr("You feel somewhat more resistant.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You feel somewhat more resistant."); perma_mutate(MUT_NEGATIVE_ENERGY_RESISTANCE, 1, "level up"); } @@ -3291,14 +3280,13 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) case SP_MUMMY: if (you.experience_level == 13 || you.experience_level == 26) { - mpr("You feel more in touch with the powers of death.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You feel more in touch with the powers of death."); } if (you.experience_level == 13) // level 13 for now -- bwr { - mpr("You can now infuse your body with magic to restore " - "decomposition.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You can now infuse your body with " + "magic to restore decomposition."); } break; @@ -3307,19 +3295,18 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) { if (you.hunger_state > HS_SATIATED) { - mpr("If you weren't so full you could now transform " - "into a vampire bat.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "If you weren't so full you " + "could now transform into a vampire bat."); } else { - mpr("You can now transform into a vampire bat.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You can now transform into " + "a vampire bat."); } } else if (you.experience_level == 6) { - mpr("You can now bottle potions of blood from corpses.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You can now bottle potions of blood from corpses."); } break; @@ -3329,14 +3316,14 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) if (!(you.experience_level % 3)) { - mpr("Your skin feels tougher.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your skin feels tougher."); you.redraw_armour_class = true; } if (you.experience_level == 13) { - mpr("Your tail grows strong enough to constrict" - " your enemies.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, + "Your tail grows strong enough to constrict your enemies."); } break; @@ -3402,7 +3389,7 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) case SP_PALE_DRACONIAN: if (!(you.experience_level % 3)) { - mpr("Your scales feel tougher.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your scales feel tougher."); you.redraw_armour_class = true; } @@ -3421,7 +3408,7 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) break; case SP_BLACK_DRACONIAN: perma_mutate(MUT_BIG_WINGS, 1, "draconian growth"); - mpr("You can now fly continuously.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You can now fly continuously."); break; default: break; @@ -3477,10 +3464,8 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) { if (you.experience_level == level) { - mpr("You feel monstrous as your " - "demonic heritage exerts itself.", - MSGCH_MUTATION); - + mprf(MSGCH_MUTATION, "You feel monstrous as your " + "demonic heritage exerts itself."); mark_milestone("monstrous", "is a " "monstrous demonspawn!"); } @@ -3502,8 +3487,7 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) { if (!gave_message) { - mpr("Your demonic ancestry asserts itself...", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your demonic ancestry asserts itself..."); gave_message = true; } @@ -3528,11 +3512,10 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) if (you.experience_level == 5) { - mpr("You have gained the ability to fly.", - MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You have gained the ability to fly."); } else if (you.experience_level == 15) - mpr("You can now fly continuously.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You can now fly continuously."); break; case SP_MERFOLK: @@ -3582,7 +3565,7 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) if (you.experience_level == 14) { perma_mutate(MUT_BIG_WINGS, 1, "gargoyle growth"); - mpr("You can now fly continuously.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "You can now fly continuously."); } break; @@ -3595,63 +3578,63 @@ void level_change(int source, const char* aux, bool skip_attribute_increase) if (crawl_state.game_is_zotdef()) { if (you.experience_level == 1) - mpr("Your Zot abilities now extend through the making of dart traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of dart traps."); if (you.experience_level == 2) - mpr("Your Zot abilities now extend through the making of oklob saplings.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of oklob saplings."); if (you.experience_level == 3) - mpr("Your Zot abilities now extend through the making of arrow traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of arrow traps."); if (you.experience_level == 4) - mpr("Your Zot abilities now extend through the making of plants.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of plants."); if (you.experience_level == 4) - mpr("Your Zot abilities now extend through removing curses.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through removing curses."); if (you.experience_level == 5) - mpr("Your Zot abilities now extend through the making of burning bushes.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of burning bushes."); if (you.experience_level == 6) - mpr("Your Zot abilities now extend through the making of altars and grenades.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of altars and grenades."); if (you.experience_level == 7) - mpr("Your Zot abilities now extend through the making of oklob plants.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of oklob plants."); if (you.experience_level == 8) - mpr("Your Zot abilities now extend through the making of net traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of net traps."); if (you.experience_level == 9) - mpr("Your Zot abilities now extend through the making of ice statues.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of ice statues."); if (you.experience_level == 10) - mpr("Your Zot abilities now extend through the making of spear traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of spear traps."); if (you.experience_level == 11) - mpr("Your Zot abilities now extend through the making of alarm traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of alarm traps."); if (you.experience_level == 12) - mpr("Your Zot abilities now extend through the making of mushroom circles.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of mushroom circles."); if (you.experience_level == 13) - mpr("Your Zot abilities now extend through the making of bolt traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of bolt traps."); if (you.experience_level == 14) - mpr("Your Zot abilities now extend through the making of orange crystal statues.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of orange crystal statues."); if (you.experience_level == 15) - mpr("Your Zot abilities now extend through the making of needle traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of needle traps."); if (you.experience_level == 16) - mpr("Your Zot abilities now extend through self-teleportation.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through self-teleportation."); if (you.experience_level == 17) - mpr("Your Zot abilities now extend through making water.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through making water."); if (you.experience_level == 19) - mpr("Your Zot abilities now extend through the making of lightning spires.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of lightning spires."); if (you.experience_level == 20) - mpr("Your Zot abilities now extend through the making of silver statues.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of silver statues."); // gold and bazaars gained together if (you.experience_level == 21) - mpr("Your Zot abilities now extend through the making of bazaars.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of bazaars."); if (you.experience_level == 21) - mpr("Your Zot abilities now extend through acquiring gold.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through acquiring gold."); if (you.experience_level == 22) - mpr("Your Zot abilities now extend through the making of oklob circles.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of oklob circles."); if (you.experience_level == 23) - mpr("Your Zot abilities now extend through invoking Sage effects.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through invoking Sage effects."); if (you.experience_level == 24) - mpr("Your Zot abilities now extend through acquirement.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through acquirement."); if (you.experience_level == 25) - mpr("Your Zot abilities now extend through the making of blade traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of blade traps."); if (you.experience_level == 26) - mpr("Your Zot abilities now extend through the making of curse skulls.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of curse skulls."); #if 0 if (you.experience_level == 27) - mpr("Your Zot abilities now extend through the making of teleport traps.", MSGCH_INTRINSIC_GAIN); + mprf(MSGCH_INTRINSIC_GAIN, "Your Zot abilities now extend through the making of teleport traps."); #endif } @@ -4573,7 +4556,7 @@ void flush_mp() && you.magic_points < (you.max_magic_points * Options.magic_point_warning) / 100) { - mpr("* * * LOW MAGIC WARNING * * *", MSGCH_DANGER); + mprf(MSGCH_DANGER, "* * * LOW MAGIC WARNING * * *"); } take_note(Note(NOTE_MP_CHANGE, you.magic_points, you.max_magic_points)); @@ -5285,7 +5268,7 @@ bool napalm_player(int amount, string source, string source_aux) you.increase_duration(DUR_LIQUID_FLAMES, amount, 100); if (you.duration[DUR_LIQUID_FLAMES] > old_value) - mpr("You are covered in liquid flames!", MSGCH_WARN); + mprf(MSGCH_WARN, "You are covered in liquid flames!"); you.props["napalmer"] = source; you.props["napalm_aux"] = source_aux; @@ -5300,16 +5283,16 @@ void dec_napalm_player(int delay) if (feat_is_watery(grd(you.pos()))) { if (you.ground_level()) - mpr("The flames go out!", MSGCH_WARN); + mprf(MSGCH_WARN, "The flames go out!"); else - mpr("You dip into the water, and the flames go out!", MSGCH_WARN); + mprf(MSGCH_WARN, "You dip into the water, and the flames go out!"); you.duration[DUR_LIQUID_FLAMES] = 0; you.props.erase("napalmer"); you.props.erase("napalm_aux"); return; } - mpr("You are covered in liquid flames!", MSGCH_WARN); + mprf(MSGCH_WARN, "You are covered in liquid flames!"); expose_player_to_element(BEAM_NAPALM, div_rand_round(delay * 12, BASELINE_DELAY)); @@ -5392,7 +5375,7 @@ void dec_slow_player(int delay) } if (you.duration[DUR_SLOW] <= BASELINE_DELAY) { - mpr("You feel yourself speed up.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel yourself speed up."); you.duration[DUR_SLOW] = 0; } } @@ -5410,7 +5393,7 @@ void dec_exhaust_player(int delay) } if (you.duration[DUR_EXHAUSTED] <= BASELINE_DELAY) { - mpr("You feel less exhausted.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel less exhausted."); you.duration[DUR_EXHAUSTED] = 0; } } @@ -5463,7 +5446,7 @@ void dec_haste_player(int delay) // message if we cross the threshold if (old_dur > threshold && you.duration[DUR_HASTE] <= threshold) { - mpr("Your extra speed is starting to run out.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your extra speed is starting to run out."); if (coinflip()) you.duration[DUR_HASTE] -= BASELINE_DELAY; } @@ -5471,7 +5454,7 @@ void dec_haste_player(int delay) else if (you.duration[DUR_HASTE] <= BASELINE_DELAY) { if (!you.duration[DUR_BERSERK]) - mpr("You feel yourself slow down.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel yourself slow down."); you.duration[DUR_HASTE] = 0; } } @@ -5505,7 +5488,7 @@ void dec_disease_player(int delay) you.disease = 0; if (you.disease == 0) - mpr("You feel your health improve.", MSGCH_RECOVERY); + mprf(MSGCH_RECOVERY, "You feel your health improve."); } } @@ -5656,7 +5639,7 @@ void handle_player_drowning(int delay) * delay, BASELINE_DELAY * 10); ouch(dam, mons->mindex(), KILLED_BY_WATER); - mpr("Your lungs strain for air!", MSGCH_WARN); + mprf(MSGCH_WARN, "Your lungs strain for air!"); } } } @@ -7232,7 +7215,7 @@ void player::petrify(actor *who, bool force) duration[DUR_PETRIFYING] = 3 * BASELINE_DELAY; redraw_evasion = true; - mpr("You are slowing down.", MSGCH_WARN); + mprf(MSGCH_WARN, "You are slowing down."); } bool player::fully_petrify(actor *foe, bool quiet) @@ -8011,7 +7994,7 @@ void player::sentinel_mark(bool trap) } else { - mpr("A sentinel's mark forms upon you.", MSGCH_WARN); + mprf(MSGCH_WARN, "A sentinel's mark forms upon you."); increase_duration(DUR_SENTINEL_MARK, trap ? random_range(35, 55) : random_range(50, 80), 250); @@ -8044,9 +8027,9 @@ bool player::made_nervous_by(const coord_def &p) void player::weaken(actor *attacker, int pow) { if (!duration[DUR_WEAK]) - mpr("You feel yourself grow feeble.", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel yourself grow feeble."); else - mpr("You feel as though you will be weak longer.", MSGCH_WARN); + mprf(MSGCH_WARN, "You feel as though you will be weak longer."); increase_duration(DUR_WEAK, pow + random2(pow + 3), 50); } diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc index a4b4bc0bfd..8d8599ec6d 100644 --- a/crawl-ref/source/potion.cc +++ b/crawl-ref/source/potion.cc @@ -327,9 +327,9 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know } else { - mpr(!you.duration[DUR_INVIS] ? "You fade into invisibility!" - : "You fade further into invisibility.", - MSGCH_DURATION); + mprf(MSGCH_DURATION, !you.duration[DUR_INVIS] + ? "You fade into invisibility!" + : "You fade further into invisibility."); } // Now multiple invisiblity casts aren't as good. -- bwr @@ -413,7 +413,7 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know bool nothing_happens = true; if (you.duration[DUR_BREATH_WEAPON]) { - mpr("You have got your breath back.", MSGCH_RECOVERY); + mprf(MSGCH_RECOVERY, "You have got your breath back."); you.duration[DUR_BREATH_WEAPON] = 0; nothing_happens = false; } @@ -498,7 +498,7 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know case POT_RESISTANCE: - mpr("You feel protected.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel protected."); you.increase_duration(DUR_RESISTANCE, (random2(pow) + 35) / factor); break; diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index 851775c628..1d5239f0ae 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -336,7 +336,7 @@ void player_quiver::_maybe_fill_empty_slot() } #ifdef DEBUG_QUIVER - mpr("Recalculating fire order...", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Recalculating fire order..."); #endif const launch_retval desired_ret = diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index dfe86311b6..b51124bca1 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2446,7 +2446,7 @@ void god_speaks(god_type god, const char *mesg) fake_mon.foe = MHITYOU; fake_mon.mname = "FAKE GOD MONSTER"; - mpr(do_mon_str_replacements(mesg, &fake_mon).c_str(), MSGCH_GOD, god); + mprf(MSGCH_GOD, god, "%s", do_mon_str_replacements(mesg, &fake_mon).c_str()); fake_mon.reset(); mgrd(you.pos()) = orig_mon; @@ -3075,8 +3075,7 @@ void excommunication(god_type new_god) { simple_god_message("'s voice booms out, \"Who do you think you " "are?\"", GOD_BEOGH); - mpr("All of your followers decide to abandon you.", - MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "All of your followers decide to abandon you."); add_daction(DACT_ALLY_BEOGH); remove_all_companions(GOD_BEOGH); } @@ -3154,8 +3153,7 @@ void excommunication(god_type new_god) if (query_da_counter(DACT_ALLY_SLIME)) { - mpr("All of your fellow slimes turn on you.", - MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "All of your fellow slimes turn on you."); add_daction(DACT_ALLY_SLIME); } @@ -3165,8 +3163,7 @@ void excommunication(god_type new_god) case GOD_FEDHAS: if (query_da_counter(DACT_ALLY_PLANT)) { - mpr("The plants of the dungeon turn on you.", - MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "The plants of the dungeon turn on you."); add_daction(DACT_ALLY_PLANT); } _set_penance(old_god, 30); @@ -3192,7 +3189,7 @@ void excommunication(god_type new_god) // all non-hostile holy beings that worship a good god hostile. if (!is_good_god(new_god) && query_da_counter(DACT_ALLY_HOLY)) { - mpr("The divine host forsakes you.", MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "The divine host forsakes you."); add_daction(DACT_ALLY_HOLY); } @@ -3260,11 +3257,11 @@ void print_sacrifice_message(god_type god, const item_def &item, return; } const string itname = item.name(your ? DESC_YOUR : DESC_THE); - mpr(_sacrifice_message(_Sacrifice_Messages[god][piety_gain], itname, + mprf(MSGCH_GOD, god, "%s", + _sacrifice_message(_Sacrifice_Messages[god][piety_gain], itname, itname.find("glowing") != string::npos, item.quantity > 1, - piety_gain), - MSGCH_GOD, god); + piety_gain).c_str()); } void nemelex_death_message() @@ -3432,7 +3429,7 @@ static void _god_welcome_identify_gear() if (amulet && amulet->sub_type == AMU_FAITH) { // The flash happens independent of item id. - mpr("Your amulet flashes!", MSGCH_GOD); + mprf(MSGCH_GOD, "Your amulet flashes!"); flash_view_delay(god_colour(you.religion), 300); set_ident_type(*amulet, ID_KNOWN_TYPE); set_ident_flags(*amulet, ISFLAG_KNOW_TYPE); @@ -3599,7 +3596,7 @@ void god_pitch(god_type which_god) simple_god_message(" begins to support your attributes as your " "movement slows."); notify_stat_change("Cheibriados worship"); - mpr("You can now bend time to slow others.", MSGCH_GOD); + mprf(MSGCH_GOD, "You can now bend time to slow others."); } // We disable all magical skills to avoid accidentally angering Trog. @@ -3623,40 +3620,37 @@ void god_pitch(god_type which_god) && query_da_counter(DACT_ALLY_UNHOLY_EVIL)) { add_daction(DACT_ALLY_UNHOLY_EVIL); - mpr("Your unholy and evil allies forsake you.", MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "Your unholy and evil allies forsake you."); } if (you_worship(GOD_ZIN) && query_da_counter(DACT_ALLY_UNCLEAN_CHAOTIC)) { add_daction(DACT_ALLY_UNCLEAN_CHAOTIC); - mpr("Your unclean and chaotic allies forsake you.", - MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "Your unclean and chaotic allies forsake you."); } else if (you_worship(GOD_TROG) && query_da_counter(DACT_ALLY_SPELLCASTER)) { add_daction(DACT_ALLY_SPELLCASTER); - mpr("Your magic-using allies forsake you.", MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_MONSTER_ENCHANT, "Your magic-using allies forsake you."); } if (you_worship(GOD_ELYVILON)) { - mpr("You can now call upon Elyvilon to destroy weapons lying on the " - "ground.", MSGCH_GOD); - mpr("You can now provide lesser healing for others.", MSGCH_GOD); + mprf(MSGCH_GOD, "You can now call upon Elyvilon to destroy weapons " + "lying on the ground."); + mprf(MSGCH_GOD, "You can now provide lesser healing for others."); } else if (you_worship(GOD_TROG)) { - mpr("You can now call upon Trog to burn spellbooks in your " - "surroundings.", MSGCH_GOD); + mprf(MSGCH_GOD, "You can now call upon Trog to burn spellbooks in your " + "surroundings."); } else if (you_worship(GOD_FEDHAS)) { - mpr("You can now call upon Fedhas to speed up the decay of corpses.", - MSGCH_GOD); - mpr("The plants of the dungeon cease their hostilities.", - MSGCH_MONSTER_ENCHANT); + mprf(MSGCH_GOD, "You can now call upon Fedhas to speed up the decay of corpses."); + mprf(MSGCH_MONSTER_ENCHANT, "The plants of the dungeon cease their hostilities."); if (env.forest_awoken_until) for (monster_iterator mi; mi; ++mi) mi->del_ench(ENCH_AWAKEN_FOREST); @@ -3689,7 +3683,7 @@ void god_pitch(god_type which_god) + god_name(you.religion) + ".").c_str(), old_god); break; default: - mpr("Unknown good god.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Unknown good god."); } // Give a piety bonus when switching between good gods. if (old_piety > piety_breakpoint(0)) diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 294582f46b..61c0e18034 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -2326,7 +2326,7 @@ void shop() if (i == MAX_SHOPS) { - mpr("Help! Non-existent shop.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Help! Non-existent shop."); return; } @@ -3110,8 +3110,7 @@ void ShoppingList::display() const int index = shopmenu.get_entry_index(sel[0]); if (index == -1) { - mpr("ERROR: Unable to delete thing from shopping list!", - MSGCH_ERROR); + mprf(MSGCH_ERROR, "ERROR: Unable to delete thing from shopping list!"); more(); continue; } 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; 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 diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 977b1709a1..572ae96059 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -666,12 +666,12 @@ bool cast_a_spell(bool check_range, spell_type spell) } if (you.last_cast_spell == SPELL_NO_SPELL) - mpr("Cast which spell? (? or * to list) ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Cast which spell? (? or * to list) "); else { mprf(MSGCH_PROMPT, "Casting: <w>%s</w>", spell_title(you.last_cast_spell)); - mpr("Confirm with . or Enter, or press ? or * to list all spells.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Confirm with . or Enter, or press ? or * to list all spells."); } keyin = get_ch(); @@ -1200,7 +1200,7 @@ spret_type your_spells(spell_type spell, int powc, const char *prompt = get_spell_target_prompt(spell); if (dir == DIR_DIR) - mpr(prompt ? prompt : "Which direction?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", prompt ? prompt : "Which direction?"); const bool needs_path = (!testbits(flags, SPFLAG_GRID) && !testbits(flags, SPFLAG_TARGET)); @@ -1378,7 +1378,7 @@ spret_type your_spells(spell_type spell, int powc, spell_title(spell)); } else - mpr("Invalid spell!", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Invalid spell!"); return SPRET_ABORT; } diff --git a/crawl-ref/source/spl-clouds.cc b/crawl-ref/source/spl-clouds.cc index b1e361b662..b58db2a039 100644 --- a/crawl-ref/source/spl-clouds.cc +++ b/crawl-ref/source/spl-clouds.cc @@ -275,7 +275,7 @@ void manage_fire_shield(int delay) if (!you.duration[DUR_FIRE_SHIELD]) { - mpr("Your ring of flames gutters out.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your ring of flames gutters out."); return; } @@ -283,7 +283,7 @@ void manage_fire_shield(int delay) if (old_dur > threshold && you.duration[DUR_FIRE_SHIELD] < threshold) - mpr("Your ring of flames is guttering out.", MSGCH_WARN); + mprf(MSGCH_WARN, "Your ring of flames is guttering out."); // Place fire clouds all around you for (adjacent_iterator ai(you.pos()); ai; ++ai) diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc index 696461dca6..ff0d7fb6bd 100644 --- a/crawl-ref/source/spl-damage.cc +++ b/crawl-ref/source/spl-damage.cc @@ -1200,7 +1200,7 @@ spret_type cast_shatter(int pow, bool fail) else { noisy(30, you.pos()); - mpr("The dungeon rumbles!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "The dungeon rumbles!"); } int rad = 3 + you.skill_rdiv(SK_EARTH_MAGIC, 1, 5); @@ -1217,7 +1217,7 @@ spret_type cast_shatter(int pow, bool fail) } if (dest && !silence) - mpr("Ka-crash!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "Ka-crash!"); return SPRET_SUCCESS; } @@ -1311,7 +1311,7 @@ bool mons_shatter(monster* caster, bool actual) } if (dest && !silence) - mpr("Ka-crash!", MSGCH_SOUND); + mprf(MSGCH_SOUND, "Ka-crash!"); if (!caster->wont_attack()) foes *= -1; @@ -2431,7 +2431,7 @@ void forest_message(const coord_def pos, const string &msg, msg_channel_type ch) if (feat_is_tree(grd(*ri)) && cell_see_cell(you.pos(), *ri, LOS_DEFAULT)) { - mpr(msg, ch); + mprf(ch, "%s", msg.c_str()); return; } } diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc index 988917dbc6..27a56a1759 100644 --- a/crawl-ref/source/spl-goditem.cc +++ b/crawl-ref/source/spl-goditem.cc @@ -420,19 +420,19 @@ void antimagic() if (you.duration[DUR_TELEPORT] > 0) { you.duration[DUR_TELEPORT] = 0; - mpr("You feel strangely stable.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel strangely stable."); } if (you.duration[DUR_PETRIFYING] > 0) { you.duration[DUR_PETRIFYING] = 0; - mpr("You feel limber!", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel limber!"); } if (you.attribute[ATTR_DELAYED_FIREBALL]) { you.attribute[ATTR_DELAYED_FIREBALL] = 0; - mpr("Your charged fireball dissipates.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your charged fireball dissipates."); } if (you.attribute[ATTR_SWIFTNESS] > 0) @@ -689,7 +689,7 @@ bool remove_curse(bool alreadyknown, string *pre_msg) learned_something_new(HINT_REMOVED_CURSE); } else if (alreadyknown) - mpr("None of your equipped items are cursed.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "None of your equipped items are cursed."); else { if (pre_msg) diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc index 6eea1ea015..c1815de1c4 100644 --- a/crawl-ref/source/spl-miscast.cc +++ b/crawl-ref/source/spl-miscast.cc @@ -493,7 +493,7 @@ void MiscastEffect::do_msg(bool suppress_nothing_happens) msg = replace_all(msg, "'s body", ""); } - mpr(msg.c_str(), msg_ch); + mprf(msg_ch, "%s", msg.c_str()); if (msg_ch == MSGCH_SOUND) { @@ -682,14 +682,14 @@ bool MiscastEffect::avoid_lethal(int dam) if (did_msg) { #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_MISCAST) - mpr("Couldn't avoid lethal miscast: already printed message for this " - "miscast.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Couldn't avoid lethal miscast: already printed " + "message for this miscast."); #endif return false; } #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_MISCAST) - mpr("Avoided lethal miscast.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Avoided lethal miscast."); #endif do_miscast(); @@ -1460,7 +1460,7 @@ void MiscastEffect::_divination_you(int severity) case 1: if (!silenced(you.pos())) { - mpr("You hear strange voices.", MSGCH_SOUND); + mprf(MSGCH_SOUND, "You hear strange voices."); noisy(2, you.pos()); } else @@ -1524,7 +1524,7 @@ void MiscastEffect::_divination_you(int severity) if (you.magic_points > 0 || you.species == SP_DJINNI) { drain_mp(3 + random2(10)); - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; } @@ -1540,7 +1540,7 @@ void MiscastEffect::_divination_you(int severity) if (you.magic_points > 0 || you.species == SP_DJINNI) { drain_mp(5 + random2(20)); - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; case 1: @@ -3055,7 +3055,7 @@ void MiscastEffect::_zot() if (you.magic_points > 0) { dec_mp(10 + random2(21)); - mpr("You suddenly feel drained of magical energy!", MSGCH_WARN); + mprf(MSGCH_WARN, "You suddenly feel drained of magical energy!"); } break; case 11: diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc index 037f0f634f..8e055ccf27 100644 --- a/crawl-ref/source/spl-other.cc +++ b/crawl-ref/source/spl-other.cc @@ -447,7 +447,7 @@ spret_type cast_intoxicate(int pow, bool fail) void remove_condensation_shield() { - mpr("Your icy shield evaporates.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your icy shield evaporates."); you.duration[DUR_CONDENSATION_SHIELD] = 0; you.redraw_armour_class = true; } diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc index 19e97357b6..f4daa80bbb 100644 --- a/crawl-ref/source/spl-selfench.cc +++ b/crawl-ref/source/spl-selfench.cc @@ -46,8 +46,7 @@ spret_type cast_deaths_door(int pow, bool fail) { fail_check(); mpr("You feel invincible!"); - mpr("You seem to hear sand running through an hourglass...", - MSGCH_SOUND); + mprf(MSGCH_SOUND, "You seem to hear sand running through an hourglass..."); set_hp(allowed_deaths_door_hp()); deflate_hp(you.hp_max, false); @@ -65,7 +64,7 @@ spret_type cast_deaths_door(int pow, bool fail) void remove_ice_armour() { - mpr("Your icy armour melts away.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your icy armour melts away."); you.redraw_armour_class = true; you.duration[DUR_ICY_ARMOUR] = 0; } @@ -156,7 +155,7 @@ spret_type cast_revivification(int pow, bool fail) if (you.duration[DUR_DEATHS_DOOR]) { - mpr("Your life is in your own hands once again.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your life is in your own hands once again."); // XXX: better cause name? paralyse_player("Death's Door abortion", 5 + random2(5)); confuse_player(10 + random2(10)); @@ -264,7 +263,7 @@ int cast_selective_amnesia(string *pre_msg) int slot; // Pick a spell to forget. - mpr("Forget which spell ([?*] list [ESC] exit)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Forget which spell ([?*] list [ESC] exit)? "); keyin = Options.auto_list ? list_spells(false, false, false, "Forget which spell?") : get_ch(); @@ -297,7 +296,7 @@ int cast_selective_amnesia(string *pre_msg) if (spell == SPELL_NO_SPELL) { mpr("You don't know that spell."); - mpr("Forget which spell ([?*] list [ESC] exit)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Forget which spell ([?*] list [ESC] exit)? "); keyin = get_ch(); } else diff --git a/crawl-ref/source/spl-summoning.cc b/crawl-ref/source/spl-summoning.cc index 062e6d3dcc..c7bd50c6e7 100644 --- a/crawl-ref/source/spl-summoning.cc +++ b/crawl-ref/source/spl-summoning.cc @@ -398,7 +398,7 @@ spret_type cast_summon_elemental(int pow, god_type god, const int dur = min(2 + (random2(pow) / 5), 6); - mpr("Summon from material in which direction?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Summon from material in which direction?"); direction_chooser_args args; args.restricts = DIR_DIR; @@ -1195,8 +1195,8 @@ spret_type cast_malign_gateway(actor * caster, int pow, god_type god, bool fail) set_terrain_changed(point); noisy(10, point); - mpr("The dungeon shakes, a horrible noise fills the air, and a portal " - "to some otherworldly place is opened!", MSGCH_WARN); + mprf(MSGCH_WARN, "The dungeon shakes, a horrible noise fills the air, " + "and a portal to some otherworldly place is opened!"); if (one_chance_in(5) && caster->is_player()) { @@ -2750,7 +2750,7 @@ bool fire_battlesphere(monster* mons) // Sanity check: if we have somehow ended up targeting ourselves, bail if (beam.target == mons->pos()) { - mpr("Battlesphere targetting itself? Fixing.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Battlesphere targetting itself? Fixing."); mons->props.erase("firing"); mons->props.erase("firing_target"); mons->props.erase("foe"); diff --git a/crawl-ref/source/spl-transloc.cc b/crawl-ref/source/spl-transloc.cc index b417b8ddc4..340967577c 100644 --- a/crawl-ref/source/spl-transloc.cc +++ b/crawl-ref/source/spl-transloc.cc @@ -156,7 +156,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink, { if (pre_msg) mpr(pre_msg->c_str()); - mpr("The orb interferes with your control of the blink!", MSGCH_ORB); + mprf(MSGCH_ORB, "The orb interferes with your control of the blink!"); // abort still wastes the turn if (high_level_controlled_blink && coinflip()) return cast_semi_controlled_blink(pow, false, false) ? 1 : 0; @@ -356,7 +356,7 @@ bool allow_control_teleport(bool quiet) if (!quiet && !retval && player_control_teleport()) { if (orb_haloed(you.pos())) - mpr("The orb prevents control of your teleportation!", MSGCH_ORB); + mprf(MSGCH_ORB, "The orb prevents control of your teleportation!"); else if (you.beheld()) mpr("It is impossible to concentrate on your destination whilst mesmerised."); else @@ -403,7 +403,7 @@ void you_teleport(void) } else if (orb_haloed(you.pos())) { - mpr("You feel the orb delaying this translocation!", MSGCH_ORB); + mprf(MSGCH_ORB, "You feel the orb delaying this translocation!"); teleport_delay += 5 + random2(5); } @@ -529,8 +529,8 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, // location, so cancel the teleport. if (crawl_state.seen_hups) { - mpr("Controlled teleport interrupted by HUP signal, " - "cancelling teleport.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Controlled teleport interrupted by HUP signal, " + "cancelling teleport."); if (!wizard_tele) contaminate_player(1000, true); return false; @@ -605,7 +605,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, { if (wizard_tele) { - mpr("Even you can't go there right now. Sorry!", MSGCH_WARN); + mprf(MSGCH_WARN, "Even you can't go there right now. Sorry!"); return false; } @@ -617,7 +617,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, { is_controlled = false; large_change = false; - mpr("A strong magical force throws you back!", MSGCH_WARN); + mprf(MSGCH_WARN, "A strong magical force throws you back!"); } else { @@ -634,7 +634,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, // End teleport control. if (you.duration[DUR_CONTROL_TELEPORT]) { - mpr("You feel uncertain.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel uncertain."); you.duration[DUR_CONTROL_TELEPORT] = 0; } } @@ -1052,7 +1052,7 @@ spret_type cast_semi_controlled_blink(int pow, bool cheap_cancel, bool end_ctele while (1) { - mpr("Which direction? [ESC to cancel]", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which direction? [ESC to cancel]"); direction(bmove, args); if (crawl_state.seen_hups) @@ -1082,7 +1082,7 @@ spret_type cast_semi_controlled_blink(int pow, bool cheap_cancel, bool end_ctele // End teleport control if this was a random blink upgraded by cTele. if (end_ctele && you.duration[DUR_CONTROL_TELEPORT]) { - mpr("You feel uncertain.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel uncertain."); you.duration[DUR_CONTROL_TELEPORT] = 0; } } diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc index a253e78619..fef318a596 100644 --- a/crawl-ref/source/stairs.cc +++ b/crawl-ref/source/stairs.cc @@ -76,9 +76,8 @@ bool check_annotation_exclusion_warning() && next_level_id != level_id::current() && is_connected_branch(next_level_id)) { - mpr("Warning, next level annotated: " + - colour_string(get_level_annotation(next_level_id), YELLOW), - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Warning, next level annotated: <yellow>%s</yellow>", + get_level_annotation(next_level_id).c_str()); might_be_dangerous = true; crawl_state.level_annotation_shown = true; } @@ -86,7 +85,7 @@ bool check_annotation_exclusion_warning() && feat_is_travelable_stair(grd(you.pos())) && !strstr(get_exclusion_desc(you.pos()).c_str(), "cloud")) { - mpr("This staircase is marked as excluded!", MSGCH_WARN); + mprf(MSGCH_WARN, "This staircase is marked as excluded!"); might_be_dangerous = true; } @@ -475,7 +474,7 @@ void up_stairs(dungeon_feature_type force_stair) seen_monsters_react(); if (!allow_control_teleport(true)) - mpr("You sense a powerful magical force warping space.", MSGCH_WARN); + mprf(MSGCH_WARN, "You sense a powerful magical force warping space."); request_autopickup(); } @@ -539,8 +538,8 @@ level_id stair_destination(dungeon_feature_type feat, const string &dst, { if (for_real) { - mpr("Error: no Hell exit level, how in the Vestibule did " - "you get here? Let's go to D:1.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Error: no Hell exit level, how in the " + "Vestibule did you get here? Let's go to D:1."); } return level_id(BRANCH_DUNGEON, 1); } @@ -593,8 +592,8 @@ level_id stair_destination(dungeon_feature_type feat, const string &dst, { if (for_real) { - mpr("Error: no return path. You did create the exit manually, " - "didn't you? Let's go to D:1.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Error: no return path. You did create " + "the exit manually, didn't you? Let's go to D:1."); } return level_id(BRANCH_DUNGEON, 1); } @@ -929,7 +928,7 @@ void down_stairs(dungeon_feature_type force_stair, bool force_known_shaft) case BRANCH_ABYSS: if (old_level.branch == BRANCH_ABYSS) { - mpr("You plunge deeper into the Abyss.", MSGCH_BANISHMENT); + mprf(MSGCH_BANISHMENT, "You plunge deeper into the Abyss."); break; } if (!force_stair) @@ -938,8 +937,8 @@ void down_stairs(dungeon_feature_type force_stair, bool force_known_shaft) mpr("To return, you must find a gate leading back."); if (you_worship(GOD_CHEIBRIADOS)) { - mpr("You feel Cheibriados slowing down the madness of this place.", - MSGCH_GOD, GOD_CHEIBRIADOS); + mprf(MSGCH_GOD, GOD_CHEIBRIADOS, + "You feel Cheibriados slowing down the madness of this place."); } // Re-entering the Abyss halves accumulated speed. @@ -1048,7 +1047,7 @@ void down_stairs(dungeon_feature_type force_stair, bool force_known_shaft) you.stop_being_constricted(); if (!allow_control_teleport(true)) - mpr("You sense a powerful magical force warping space.", MSGCH_WARN); + mprf(MSGCH_WARN, "You sense a powerful magical force warping space."); trackers_init_new_level(true); _update_travel_cache(old_level, stair_pos); diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index f84693a176..e18db60a3c 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -131,7 +131,7 @@ void describe_stash(const coord_def& c) { string desc = get_stash_desc(c); if (!desc.empty()) - mpr(desc.c_str(), MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "%s", desc.c_str()); } @@ -1781,7 +1781,7 @@ void StashTracker::search_stashes() if (!search->valid() && csearch != "*") { - mpr("Your search expression is invalid.", MSGCH_PLAIN); + mprf(MSGCH_PLAIN, "Your search expression is invalid."); lastsearch = help; return ; } @@ -1790,13 +1790,13 @@ void StashTracker::search_stashes() if (results.empty()) { - mpr("Can't find anything matching that.", MSGCH_PLAIN); + mprf(MSGCH_PLAIN, "Can't find anything matching that."); return; } if (results.size() > SEARCH_SPAM_THRESHOLD) { - mpr("Too many matches; use a more specific search.", MSGCH_PLAIN); + mprf(MSGCH_PLAIN, "Too many matches; use a more specific search."); return; } diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index b5fd4d0a90..d3e780b9c3 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -443,7 +443,7 @@ void canned_msg(canned_message_type which_message) crawl_state.cancel_cmd_repeat(); break; case MSG_OK: - mpr("Okay, then.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Okay, then."); crawl_state.cancel_cmd_repeat(); break; case MSG_UNTHINKING_ACT: @@ -466,7 +466,7 @@ void canned_msg(canned_message_type which_message) mpr("The spell fizzles."); break; case MSG_HUH: - mpr("Huh?", MSGCH_EXAMINE_FILTER); + mprf(MSGCH_EXAMINE_FILTER, "Huh?"); crawl_state.cancel_cmd_repeat(); break; case MSG_EMPTY_HANDED_ALREADY: @@ -595,7 +595,7 @@ bool yesno(const char *str, bool safe, int safeanswer, bool clear_after, if (!noprompt) { if (message) - mpr(prompt.c_str(), MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", prompt.c_str()); else cprintf("%s", prompt.c_str()); } @@ -720,7 +720,7 @@ int yesnoquit(const char* str, bool safe, int safeanswer, bool allow_all, safe, allow_all).c_str()); while (true) { - mpr(prompt.c_str(), MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", prompt.c_str()); int tmp = getchm(KMC_CONFIRM); diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index b7a3599597..cd09107cec 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -1174,7 +1174,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, if (!in_bounds(temp)) { - mpr("swap_features(): No boring squares on level?", MSGCH_ERROR); + mprf(MSGCH_ERROR, "swap_features(): No boring squares on level?"); return false; } diff --git a/crawl-ref/source/transform.cc b/crawl-ref/source/transform.cc index 8f8d412d23..571a416db9 100644 --- a/crawl-ref/source/transform.cc +++ b/crawl-ref/source/transform.cc @@ -1051,7 +1051,7 @@ bool transform(int pow, transformation_type which_trans, bool involuntary, mpr("Your new body is particularly stony."); if (you.duration[DUR_ICY_ARMOUR]) { - mpr("Your new body cracks your icy armour.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your new body cracks your icy armour."); you.duration[DUR_ICY_ARMOUR] = 0; } break; @@ -1116,7 +1116,7 @@ bool transform(int pow, transformation_type which_trans, bool involuntary, // undead cannot regenerate -- bwr if (you.duration[DUR_REGENERATION]) { - mpr("You stop regenerating.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You stop regenerating."); you.duration[DUR_REGENERATION] = 0; } @@ -1230,7 +1230,7 @@ void untransform(bool skip_wielding, bool skip_move) switch (old_form) { case TRAN_SPIDER: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); notify_stat_change(STAT_DEX, -5, true, "losing the spider transformation"); if (!skip_move) @@ -1238,7 +1238,7 @@ void untransform(bool skip_wielding, bool skip_move) break; case TRAN_BAT: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); notify_stat_change(STAT_DEX, -5, true, "losing the bat transformation"); notify_stat_change(STAT_STR, 5, true, @@ -1256,10 +1256,10 @@ void untransform(bool skip_wielding, bool skip_move) if (you.species == SP_LAVA_ORC && temperature_effect(LORC_STONESKIN) || you.species == SP_GARGOYLE) { - mpr("You revert to a slightly less stony form.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You revert to a slightly less stony form."); } else if (you.species != SP_LAVA_ORC) - mpr("You revert to your normal fleshy form.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You revert to your normal fleshy form."); notify_stat_change(STAT_DEX, 2, true, "losing the statue transformation"); notify_stat_change(STAT_STR, -2, true, @@ -1273,9 +1273,9 @@ void untransform(bool skip_wielding, bool skip_move) case TRAN_ICE_BEAST: if (you.species == SP_LAVA_ORC && !temperature_effect(LORC_STONESKIN)) - mpr("Your icy form melts away into molten rock.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your icy form melts away into molten rock."); else - mpr("You warm up again.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You warm up again."); // Note: if the core goes down, the combined effect soon disappears, // but the reverse isn't true. -- bwr @@ -1284,7 +1284,7 @@ void untransform(bool skip_wielding, bool skip_move) break; case TRAN_DRAGON: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); notify_stat_change(STAT_STR, -10, true, "losing the dragon transformation"); break; @@ -1292,16 +1292,16 @@ void untransform(bool skip_wielding, bool skip_move) case TRAN_LICH: you.is_undead = get_undead_state(you.species); if (you.is_undead == US_ALIVE) - mpr("You feel yourself come back to life.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel yourself come back to life."); else - mpr("You feel your undeath return to normal.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel your undeath return to normal."); break; case TRAN_PIG: case TRAN_JELLY: case TRAN_PORCUPINE: case TRAN_WISP: - mpr("Your transformation has ended.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "Your transformation has ended."); break; case TRAN_APPENDAGE: @@ -1318,11 +1318,11 @@ void untransform(bool skip_wielding, bool skip_move) break; case TRAN_FUNGUS: - mpr("You stop sporulating.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You stop sporulating."); you.set_duration(DUR_CONFUSING_TOUCH, 0); break; case TRAN_TREE: - mpr("You feel less woody.", MSGCH_DURATION); + mprf(MSGCH_DURATION, "You feel less woody."); if (grd(you.pos()) == DNGN_DEEP_WATER) { if (beogh_water_walk() || species_likes_water(you.species)) diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 81a4112d1d..0d0f312e5f 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -3721,8 +3721,7 @@ void TravelCache::delete_waypoint() mesclr(); mpr("Existing waypoints:"); list_waypoints(); - mpr("Delete which waypoint? (* - delete all, Esc - exit) ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Delete which waypoint? (* - delete all, Esc - exit) "); int key = getchm(); if (key >= '0' && key <= '9') diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index b039186082..751c4df3f1 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -301,12 +301,12 @@ void update_monsters_in_view() } if (size == 1) - mpr(msgs[0], MSGCH_WARN); + mprf(MSGCH_WARN, "%s", msgs[0].c_str()); else { while (types.size() > max_msgs && !genera.empty()) _genus_factoring(types, genera); - mpr(_desc_mons_type_map(types), MSGCH_WARN); + mprf(MSGCH_WARN, "%s", _desc_mons_type_map(types).c_str()); } bool warning = false; @@ -342,7 +342,7 @@ void update_monsters_in_view() warning_msg += "."; } if (warning) - mpr(warning_msg, MSGCH_GOD); + mprf(MSGCH_GOD, "%s", warning_msg.c_str()); } // Xom thinks it's hilarious the way the player picks up an ever diff --git a/crawl-ref/source/wiz-dgn.cc b/crawl-ref/source/wiz-dgn.cc index 6e9526a9cd..26e3e66b99 100644 --- a/crawl-ref/source/wiz-dgn.cc +++ b/crawl-ref/source/wiz-dgn.cc @@ -209,7 +209,7 @@ void wizard_interlevel_travel() bool wizard_create_portal(const coord_def& pos) { - mpr("Destination for portal:", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Destination for portal:"); string dummy; level_id dest = prompt_translevel_target(TPF_ALLOW_UPDOWN @@ -240,9 +240,9 @@ bool wizard_create_feature(const coord_def& pos) char specs[256]; dungeon_feature_type feat; if (mimic) - mpr("Create what kind of feature mimic? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Create what kind of feature mimic? "); else - mpr("Create which feature? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Create which feature? "); if (cancellable_get_line(specs, sizeof(specs)) || specs[0] == 0) { @@ -356,8 +356,8 @@ void wizard_list_branches() if (!you.props.exists(OVERFLOW_TEMPLES_KEY)) return; - mpr("----", MSGCH_DIAGNOSTICS); - mpr("Overflow temples: ", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "----"); + mprf(MSGCH_DIAGNOSTICS, "Overflow temples: "); CrawlVector &levels = you.props[OVERFLOW_TEMPLES_KEY].get_vector(); diff --git a/crawl-ref/source/wiz-fsim.cc b/crawl-ref/source/wiz-fsim.cc index bb2041deb3..fc42c4b51e 100644 --- a/crawl-ref/source/wiz-fsim.cc +++ b/crawl-ref/source/wiz-fsim.cc @@ -238,7 +238,7 @@ static monster* _init_fsim() if (mtype == MONS_PROGRAM_BUG) { char specs[100]; - mpr("Enter monster name (or MONS spec): ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Enter monster name (or MONS spec): "); if (cancellable_get_line_autohist(specs, sizeof specs) || !*specs) { canned_msg(MSG_OK); @@ -599,7 +599,7 @@ void wizard_fight_sim(bool double_scale) } else { - mpr("(A)ttack or (D)efense?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "(A)ttack or (D)efense?"); switch (toalower(getchk())) { diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index 0e55bd9292..cb76341a0c 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -99,13 +99,10 @@ void wizard_create_spec_object() do { - mpr(") - weapons ( - missiles [ - armour / - wands ? - scrolls", - MSGCH_PROMPT); - mpr("= - jewellery ! - potions : - books | - staves \\ - rods", - MSGCH_PROMPT); - mpr("} - miscellany X - corpses % - food $ - gold 0 - the Orb", - MSGCH_PROMPT); - mpr("ESC - exit", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, ") - weapons ( - missiles [ - armour / - wands ? - scrolls"); + mprf(MSGCH_PROMPT, "= - jewellery ! - potions : - books | - staves \\ - rods"); + mprf(MSGCH_PROMPT, "} - miscellany X - corpses %% - food $ - gold 0 - the Orb"); + mprf(MSGCH_PROMPT, "ESC - exit"); msgwin_prompt("What class of item? "); @@ -349,8 +346,7 @@ static void _tweak_randart(item_def &item) if (item_is_equipped(item)) { - mpr("You can't tweak the randart properties of an equipped item.", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "You can't tweak the randart properties of an equipped item."); return; } else @@ -392,9 +388,9 @@ static void _tweak_randart(item_def &item) choice_num++; } - mpr(prompt, MSGCH_PROMPT, 0); + mprf(MSGCH_PROMPT, "%s", prompt.c_str()); - mpr("Change which field? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Change which field? "); int keyin = toalower(get_ch()); unsigned int choice; @@ -473,18 +469,11 @@ void wizard_tweak_object(void) { mpr_nocap(you.inv[item].name(DESC_INVENTORY_EQUIP).c_str()); - if (is_art) - { - mpr("a - plus b - plus2 c - art props d - quantity " - "e - flags ESC - exit", MSGCH_PROMPT); - } - else - { - mpr("a - plus b - plus2 c - special d - quantity " - "e - flags ESC - exit", MSGCH_PROMPT); - } + mprf(MSGCH_PROMPT, "a - plus b - plus2 c - %s " + "d - quantity e - flags ESC - exit", + is_art ? "art props" : "special"); - mpr("Which field? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which field? "); keyin = toalower(get_ch()); @@ -571,7 +560,7 @@ static bool _make_book_randart(item_def &book) do { - mpr("Make book fixed [t]heme or fixed [l]evel? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Make book fixed [t]heme or fixed [l]evel? "); type = toalower(getchk()); } while (type != 't' && type != 'l'); @@ -692,8 +681,7 @@ void wizard_make_object_randart() item.props.clear(); } - mpr("Fake item as gift from which god (ENTER to leave alone): ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Fake item as gift from which god (ENTER to leave alone): "); char name[80]; if (!cancellable_get_line(name, sizeof(name)) && name[0]) { @@ -884,8 +872,7 @@ static void _debug_acquirement_stats(FILE *ostat) mesclr(); mpr("[a] Weapons [b] Armours [c] Jewellery [d] Books"); mpr("[e] Staves [f] Wands [g] Miscellaneous [h] Food"); - mpr("What kind of item would you like to get acquirement stats on? ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "What kind of item would you like to get acquirement stats on? "); object_class_type type; const int keyin = toalower(get_ch()); diff --git a/crawl-ref/source/wiz-mon.cc b/crawl-ref/source/wiz-mon.cc index e4381bd3db..11c3815813 100644 --- a/crawl-ref/source/wiz-mon.cc +++ b/crawl-ref/source/wiz-mon.cc @@ -175,7 +175,7 @@ static int _make_mimic_item(object_class_type type) void wizard_create_spec_monster_name() { char specs[1024]; - mpr("Enter monster name (or MONS spec): ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Enter monster name (or MONS spec): "); if (cancellable_get_line_autohist(specs, sizeof specs) || !*specs) { canned_msg(MSG_OK); @@ -207,7 +207,7 @@ void wizard_create_spec_monster_name() mons_spec mspec = mlist.get_monster(0); if (mspec.type == MONS_NO_MONSTER) { - mpr("Such a monster couldn't be found.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Such a monster couldn't be found."); return; } @@ -225,7 +225,7 @@ void wizard_create_spec_monster_name() if (!in_bounds(place)) { - mpr("Found no space to place monster.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Found no space to place monster."); return; } @@ -247,7 +247,7 @@ void wizard_create_spec_monster_name() int it = _make_mimic_item(item_type); if (it == NON_ITEM) { - mpr("Cannot create item.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Cannot create item."); return; } move_item_to_grid(&it, place); @@ -262,7 +262,7 @@ void wizard_create_spec_monster_name() if (!dgn_place_monster(mspec, place, true, false)) { - mpr("Unable to place monster.", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Unable to place monster."); return; } @@ -466,7 +466,7 @@ void debug_list_monsters() void wizard_spawn_control() { - mpr("(c)hange spawn rate or (s)pawn monsters? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "(c)hange spawn rate or (s)pawn monsters? "); const int c = toalower(getchm()); char specs[256]; @@ -497,8 +497,8 @@ void wizard_spawn_control() if (max_spawn <= 0) { - mpr("Level already filled with monsters, get rid of some " - "of them first.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Level already filled with monsters, " + "get rid of some of them first."); return; } @@ -540,7 +540,7 @@ void debug_stethoscope(int mon) i = mon; else { - mpr("Which monster?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which monster?"); direction(stth, direction_chooser_args()); @@ -734,8 +734,8 @@ void wizard_dismiss_all_monsters(bool force_all) char buf[1024] = ""; if (!force_all) { - mpr("What monsters to dismiss (ENTER for all, \"harmful\", \"mobile\" or a regex)? ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "What monsters to dismiss (ENTER for all, " + "\"harmful\", \"mobile\" or a regex)? "); bool validline = !cancellable_get_line_autohist(buf, sizeof buf); if (!validline) @@ -753,7 +753,7 @@ void wizard_dismiss_all_monsters(bool force_all) void debug_make_monster_shout(monster* mon) { - mpr("Make the monster (S)hout or (T)alk? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Make the monster (S)hout or (T)alk? "); char type = (char) getchm(KMC_DEFAULT); type = toalower(type); @@ -827,8 +827,7 @@ void wizard_gain_monster_level(monster* mon) void wizard_apply_monster_blessing(monster* mon) { - mpr("Apply blessing of (B)eogh, The (S)hining One, or (R)andomly? ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Apply blessing of (B)eogh, The (S)hining One, or (R)andomly? "); char type = (char) getchm(KMC_DEFAULT); type = toalower(type); @@ -1151,7 +1150,7 @@ void wizard_make_monster_summoned(monster* mon) int summon_type = 0; if (mon->is_summoned(NULL, &summon_type) || summon_type != 0) { - mpr("Monster is already summoned.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Monster is already summoned."); return; } @@ -1163,11 +1162,10 @@ void wizard_make_monster_summoned(monster* mon) return; } - mpr("[a] clone [b] animated [c] chaos [d] miscast [e] zot", MSGCH_PROMPT); - mpr("[f] wrath [g] aid [m] misc [s] spell", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "[a] clone [b] animated [c] chaos [d] miscast [e] zot"); + mprf(MSGCH_PROMPT, "[f] wrath [g] aid [m] misc [s] spell"); - mpr("Which summon type? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which summon type? "); char choice = toalower(getchm()); @@ -1206,7 +1204,7 @@ void wizard_make_monster_summoned(monster* mon) spell_type spell = spell_by_name(specs, true); if (spell == SPELL_NO_SPELL) { - mpr("No such spell.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "No such spell."); return; } type = (int) spell; @@ -1235,7 +1233,7 @@ void wizard_polymorph_monster(monster* mon) if (invalid_monster_type(type)) { - mpr("Invalid monster type.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Invalid monster type."); return; } @@ -1255,7 +1253,7 @@ void wizard_polymorph_monster(monster* mon) if (!mon->alive()) { - mpr("Polymorph killed monster?", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Polymorph killed monster?"); return; } @@ -1267,7 +1265,7 @@ void wizard_polymorph_monster(monster* mon) change_monster_type(mon, type); if (!mon->alive()) { - mpr("Polymorph killed monster?", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Polymorph killed monster?"); return; } @@ -1363,7 +1361,7 @@ void debug_miscast(int target_index) } char specs[100]; - mpr("Miscast which school or spell, by name? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Miscast which school or spell, by name? "); if (cancellable_get_line_autohist(specs, sizeof specs) || !*specs) { canned_msg(MSG_OK); @@ -1412,11 +1410,10 @@ void debug_miscast(int target_index) mprf("Miscasting school %s.", spelltype_long_name(school)); if (spell != SPELL_NO_SPELL) - mpr("Enter spell_power,spell_failure: ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Enter spell_power,spell_failure: "); else { - mpr("Enter miscast_level or spell_power,spell_failure: ", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Enter miscast_level or spell_power,spell_failure: "); } if (cancellable_get_line_autohist(specs, sizeof specs) || !*specs) @@ -1524,7 +1521,7 @@ void debug_miscast(int target_index) #ifdef DEBUG_BONES void debug_ghosts() { - mpr("(C)reate or (L)oad bones file?", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "(C)reate or (L)oad bones file?"); const char c = toalower(getchm()); if (c == 'c') diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc index c9bb2ea7df..fb6f79a056 100644 --- a/crawl-ref/source/wiz-you.cc +++ b/crawl-ref/source/wiz-you.cc @@ -238,7 +238,7 @@ void wizard_cast_spec_spell(void) char specs[80], *end; int spell; - mpr("Cast which spell? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Cast which spell? "); if (cancellable_get_line_autohist(specs, sizeof(specs)) || specs[0] == '\0') { @@ -268,7 +268,7 @@ void wizard_memorise_spec_spell(void) char specs[80], *end; int spell; - mpr("Memorise which spell? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Memorise which spell? "); if (cancellable_get_line_autohist(specs, sizeof(specs)) || specs[0] == '\0') { @@ -880,11 +880,11 @@ void wizard_edit_durations(void) mprf_nocap(MSGCH_PROMPT, "%c) %-*s : %d", 'a' + i, (int)max_len, dur_names[dur], you.duration[dur]); } - mpr("", MSGCH_PROMPT); - mpr("Edit which duration (letter or name)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, ""); + mprf(MSGCH_PROMPT, "Edit which duration (letter or name)? "); } else - mpr("Edit which duration (name)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Edit which duration (name)? "); char buf[80]; @@ -906,14 +906,14 @@ void wizard_edit_durations(void) { if (durs.empty()) { - mpr("No existing durations to choose from.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "No existing durations to choose from."); return; } choice = buf[0] - 'a'; if (choice < 0 || choice >= (int) durs.size()) { - mpr("Invalid choice.", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Invalid choice."); return; } choice = durs[choice]; @@ -962,8 +962,7 @@ void wizard_edit_durations(void) if (num == 0) { - mpr("Can't set duration directly to 0, setting it to 1 instead.", - MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Can't set duration directly to 0, setting it to 1 instead."); num = 1; } you.duration[choice] = num; @@ -1085,11 +1084,11 @@ void wizard_transform() transform_name((transformation_type)i)); if (i % 5 == 4 || i == LAST_FORM) { - mpr(line, MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s", line.c_str()); line.clear(); } } - mpr("Which form (ESC to exit)? ", MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "Which form (ESC to exit)? "); int keyin = toalower(get_ch()); diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 62a0a9c136..c4d8e027c5 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -1467,7 +1467,7 @@ static int _xom_swap_weapons(bool debug = false) unwind_var<int> save_speedinc(mon->speed_increment); if (!mon->pickup_item(mitm[index], false, true)) { - mpr("Monster wouldn't take item.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Monster wouldn't take item."); mon->inv[MSLOT_WEAPON] = monwpn; mon->equip(mitm[monwpn], MSLOT_WEAPON, 0); unlink_item(index); @@ -2934,7 +2934,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) ray_def ray; if (!find_ray(begin, towards, ray, opc_solid_see)) { - mpr("Couldn't find ray between player and stairs.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Couldn't find ray between player and stairs."); return stairs_moved; } @@ -2969,7 +2969,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) return stairs_moved; } - mpr("Ray didn't cross stairs.", MSGCH_ERROR); + mprf(MSGCH_ERROR, "Ray didn't cross stairs."); } if (away && past_stairs <= 0) @@ -3692,13 +3692,11 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) ASSERT(!you.did_escape_death()); if (is_feat_dangerous(grd(you.pos()))) { - mpr("Player is standing in deadly terrain, skipping Xom act.", - MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Player is standing in deadly terrain, skipping Xom act."); } else { - mpr("Player is already dead, skipping Xom act.", - MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "Player is already dead, skipping Xom act."); } return XOM_PLAYER_DEAD; } diff --git a/crawl-ref/source/zotdef.cc b/crawl-ref/source/zotdef.cc index 1967253e95..9753ca9fe9 100644 --- a/crawl-ref/source/zotdef.cc +++ b/crawl-ref/source/zotdef.cc @@ -209,7 +209,7 @@ static void _zotdef_choose_boss(monster_type mlist[], int power) static void _zotdef_danger_msg(const char *msg) { - mpr(msg, MSGCH_DANGER); + mprf(MSGCH_DANGER, "%s", msg); more(); } |