From 46dff5896c09c3950088d77665fb2b48538add79 Mon Sep 17 00:00:00 2001 From: dolorous Date: Thu, 12 Feb 2009 18:04:00 +0000 Subject: Properly use default parameters when displaying comma-separated lists. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9048 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/debug.cc | 12 ++++++------ crawl-ref/source/describe.cc | 2 +- crawl-ref/source/hiscores.cc | 2 +- crawl-ref/source/mapdef.cc | 2 +- crawl-ref/source/message.h | 2 +- crawl-ref/source/output.cc | 5 +---- crawl-ref/source/player.cc | 3 +-- crawl-ref/source/religion.cc | 5 ++--- crawl-ref/source/travel.cc | 4 ++-- crawl-ref/source/tutorial.cc | 3 +-- 10 files changed, 17 insertions(+), 23 deletions(-) diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index e3e2931740..f723ad61ff 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -2350,7 +2350,7 @@ void wizard_create_feature_name() // Use mpr_comma_separated_list() because the list // might be *LONG*. - mpr_comma_separated_list(prefix, matches, " and ", ", ", + mpr_comma_separated_list(prefix, matches, ", and ", ", ", MSGCH_DIAGNOSTICS); return; } @@ -3073,7 +3073,7 @@ void debug_mons_scan() mprf(MSGCH_WARN, "%s not in any vaults.", str.c_str()); else mpr_comma_separated_list(str + " in vault(s) ", vaults, - " and ", ", ", MSGCH_WARN); + ", and ", ", ", MSGCH_WARN); } mpr(""); @@ -3094,7 +3094,7 @@ void debug_mons_scan() mprf(MSGCH_WARN, "%s not in any vaults.", str.c_str()); else mpr_comma_separated_list(str + " in vault(s) ", vaults, - " and ", ", ", MSGCH_WARN); + ", and ", ", ", MSGCH_WARN); // Don't report on same monster twice. if (is_floating[idx]) @@ -3107,7 +3107,7 @@ void debug_mons_scan() mprf(MSGCH_WARN, "%s not in any vaults.", str.c_str()); else mpr_comma_separated_list(str + " in vault(s) ", vaults, - " and ", ", ", MSGCH_WARN); + ", and ", ", ", MSGCH_WARN); } mpr("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", MSGCH_ERROR); @@ -3960,7 +3960,7 @@ bool wizard_add_mutation(void) // Use mpr_comma_separated_list() because the list // might be *LONG*. - mpr_comma_separated_list(prefix, matches, " and ", ", ", + mpr_comma_separated_list(prefix, matches, ", and ", ", ", MSGCH_DIAGNOSTICS); } @@ -4918,7 +4918,7 @@ void wizard_edit_durations( void ) prefix += buf; prefix += "', possible matches are: "; - mpr_comma_separated_list(prefix, match_names, " and ", ", ", + mpr_comma_separated_list(prefix, match_names, ", and ", ", ", MSGCH_DIAGNOSTICS); return; } diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 8a28f28b41..adf578e393 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -3658,7 +3658,7 @@ std::string get_skill_description(int skill, bool need_title) std::string broken = "For example, you could "; broken += comma_separated_line(unarmed_attacks.begin(), unarmed_attacks.end(), - " or ", ", "); + ", or ", ", "); broken += "."; linebreak_string2(broken, 72); diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index d221d4a56b..cf27ba0992 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -724,7 +724,7 @@ std::string scorefile_entry::make_oneline(const std::string &ml) const trim_string(s); } } - return comma_separated_line(lines.begin(), lines.end(), " ", " "); + return (comma_separated_line(lines.begin(), lines.end(), " ", " ")); } std::string scorefile_entry::long_kill_message() const diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 98e41ce51d..b373c9b40d 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -982,7 +982,7 @@ std::string map_lines::block_shuffle(const std::string &s) { std::vector segs = split_string("/", s); std::random_shuffle(segs.begin(), segs.end(), random2); - return comma_separated_line(segs.begin(), segs.end(), "/", "/"); + return (comma_separated_line(segs.begin(), segs.end(), "/", "/")); } std::string map_lines::shuffle(std::string s) diff --git a/crawl-ref/source/message.h b/crawl-ref/source/message.h index 123551047b..49830df41f 100644 --- a/crawl-ref/source/message.h +++ b/crawl-ref/source/message.h @@ -47,7 +47,7 @@ void formatted_message_history(const std::string &st, // mpr() an arbitrarily long list of strings void mpr_comma_separated_list(const std::string prefix, const std::vector list, - const std::string &andc = " and ", + const std::string &andc = ", and ", const std::string &comma = ", ", const msg_channel_type channel = MSGCH_PLAIN, const int param = 0); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 814fff9d3d..434b5dc504 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1166,10 +1166,7 @@ std::string mpr_monster_list(bool past) if (describe.size() == 1) msg += describe[0]; else - { - msg += comma_separated_line(describe.begin(), describe.end(), - ", and ", ", "); - } + msg += comma_separated_line(describe.begin(), describe.end()); msg += "."; return (msg); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index ee77d16af3..2f8dbbc7ba 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -3930,8 +3930,7 @@ void display_char_status() if (!attrib.empty()) { - msg += comma_separated_line(attrib.begin(), attrib.end(), - ", and ", ", "); + msg += comma_separated_line(attrib.begin(), attrib.end()); mpr(msg.c_str()); } } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index c334a1e2d2..71bf56135a 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -687,8 +687,7 @@ std::string get_god_likes(god_type which_god, bool verbose) else { text += " likes it when "; - text += comma_separated_line(likes.begin(), likes.end(), - ", and ", ", "); + text += comma_separated_line(likes.begin(), likes.end()); text += "."; if (really_likes.size() > 0) @@ -698,7 +697,7 @@ std::string get_god_likes(god_type which_god, bool verbose) text += " especially likes it when "; text += comma_separated_line(really_likes.begin(), - really_likes.end(), ", and ", ", "); + really_likes.end()); text += "."; } } diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 3cacfce33a..caba8bb6ce 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -1069,8 +1069,8 @@ static void _explore_find_target_square() inacc.push_back("places"); mprf("Partly explored, can't reach some %s.", - comma_separated_line( inacc.begin(), - inacc.end()).c_str()); + comma_separated_line(inacc.begin(), + inacc.end()).c_str()); } stop_running(); } diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index f5c8d62edc..d12e781346 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -2801,8 +2801,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) listed.push_back("your religious standing (^)"); listed.push_back("the character overview screen (%)."); - text << comma_separated_line(listed.begin(), listed.end(), - " and ", ", "); + text << comma_separated_line(listed.begin(), listed.end()); text << "\nAlternatively, you can dump all information pertaining to " "your character into a text file with the # command. " -- cgit v1.2.3-54-g00ecf