diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 373a316ff6108..f28bcb192aa19 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -3248,12 +3248,11 @@ void activity_handlers::craft_do_turn( player_activity *act, player *p ) // item_location::get_item() will return nullptr if the item is lost if( !craft ) { p->add_msg_player_or_npc( - string_format( _( "You no longer have the in progress craft in your possession. " - "You stop crafting. " - "Reactivate the in progress craft to continue crafting." ) ), - string_format( _( " no longer has the in progress craft in their possession. " - " stops crafting." ) ) - ); + _( "You no longer have the in progress craft in your possession. " + "You stop crafting. " + "Reactivate the in progress craft to continue crafting." ), + _( " no longer has the in progress craft in their possession. " + " stops crafting." ) ); p->cancel_activity(); return; } diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 744f0ef1a24e5..34a161fcd7a5a 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -1358,7 +1358,7 @@ void activity_on_turn_move_loot( player_activity &, player &p ) } // If we got here without restarting the activity, it means we're done - add_msg( m_info, string_format( _( "%s sorted out every item possible." ), p.disp_name() ) ); + add_msg( m_info, _( "%s sorted out every item possible." ), p.disp_name() ); if( p.is_npc() ) { npc *guy = dynamic_cast( &p ); guy->current_activity_id = activity_id::NULL_ID(); diff --git a/src/advanced_inv.cpp b/src/advanced_inv.cpp index 5c840c7805444..0ba28602957af 100644 --- a/src/advanced_inv.cpp +++ b/src/advanced_inv.cpp @@ -355,7 +355,7 @@ void advanced_inventory::print_items( advanced_inventory_pane &pane, bool active if( it.has_owner() ) { const faction *item_fac = it.get_owner(); if( item_fac != g->faction_manager_ptr->get( faction_id( "your_followers" ) ) ) { - stolen_string = string_format( "!" ); + stolen_string = "!"; stolen = true; } } diff --git a/src/basecamp.cpp b/src/basecamp.cpp index 560d40a783455..1dc541b226384 100644 --- a/src/basecamp.cpp +++ b/src/basecamp.cpp @@ -482,7 +482,7 @@ void basecamp::query_new_name() { std::string camp_name; string_input_popup popup; - popup.title( string_format( _( "Name this camp" ) ) ) + popup.title( _( "Name this camp" ) ) .width( 40 ) .text( "" ) .max_length( 25 ) diff --git a/src/bionics.cpp b/src/bionics.cpp index 756978b73d05a..eef0ed87ebbf9 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -751,8 +751,7 @@ bool player::deactivate_bionic( int b, bool eff_only ) if( weapon.typeId() == bionics[ bio.id ].fake_item ) { add_msg_if_player( _( "You withdraw your %s." ), weapon.tname() ); if( g->u.sees( pos() ) ) { - add_msg_if_npc( m_info, string_format( _( "%s withdraws %s %s." ), disp_name(), disp_name( true ), - weapon.tname() ) ); + add_msg_if_npc( m_info, _( " withdraws %s %s." ), disp_name( true ), weapon.tname() ); } bio.ammo_loaded = weapon.ammo_data() != nullptr ? weapon.ammo_data()->get_id() : "null"; bio.ammo_count = static_cast( weapon.ammo_remaining() ); diff --git a/src/character.cpp b/src/character.cpp index 667339b809369..10cd514705a8a 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -2738,8 +2738,7 @@ hp_part Character::body_window( const std::string &menu_header, if( bitten ) { desc << colorize( string_format( "%s: ", get_effect( effect_bite, e.bp ).get_speed_name() ), c_red ); - desc << colorize( string_format( _( "It has a deep bite wound that needs cleaning." ) ), - c_red ) << "\n"; + desc << colorize( _( "It has a deep bite wound that needs cleaning." ), c_red ) << "\n"; if( bite > 0 ) { desc << colorize( string_format( _( "Chance to clean and disinfect: %d %%" ), static_cast( bite * 100 ) ), c_light_green ) << "\n"; @@ -2751,8 +2750,7 @@ hp_part Character::body_window( const std::string &menu_header, if( infected ) { desc << colorize( string_format( "%s: ", get_effect( effect_infected, e.bp ).get_speed_name() ), c_red ); - desc << colorize( string_format( - _( "It has a deep wound that looks infected. Antibiotics might be required." ) ), + desc << colorize( _( "It has a deep wound that looks infected. Antibiotics might be required." ), c_red ) << "\n"; if( infect > 0 ) { desc << colorize( string_format( _( "Chance to heal infection: %d %%" ), @@ -2781,7 +2779,7 @@ hp_part Character::body_window( const std::string &menu_header, if( ( !e.allowed && !limb_is_broken ) || ( show_all && current_hp == maximal_hp && !limb_is_broken && !bitten && !infected && !bleeding ) ) { - desc << colorize( string_format( _( "Healthy." ) ), c_green ) << "\n"; + desc << colorize( _( "Healthy." ), c_green ) << "\n"; } if( !e.allowed ) { desc << colorize( _( "You don't expect any effect from using this." ), c_yellow ); diff --git a/src/crafting.cpp b/src/crafting.cpp index 5822c4d549670..010927bd4f2a6 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -698,22 +698,18 @@ static item_location set_item_map_or_vehicle( const player &p, const tripoint &l if( const cata::optional it = vp->vehicle().add_item( vp->part_index(), newit ) ) { p.add_msg_player_or_npc( - string_format( pgettext( "item, furniture", "You put the %s on the %s." ), - ( *it )->tname(), vp->part().name() ), - string_format( pgettext( "item, furniture", " puts the %s on the %s." ), - ( *it )->tname(), vp->part().name() ) ); + pgettext( "item, furniture", "You put the %s on the %s." ), + pgettext( "item, furniture", " puts the %s on the %s." ), + ( *it )->tname(), vp->part().name() ); return item_location( vehicle_cursor( vp->vehicle(), vp->part_index() ), & **it ); } // Couldn't add the in progress craft to the target part, so drop it to the map. p.add_msg_player_or_npc( - string_format( pgettext( "furniture, item", - "Not enough space on the %s. You drop the %s on the ground." ), - vp->part().name(), newit.tname() ), - string_format( pgettext( "furniture, item", - "Not enough space on the %s. drops the %s on the ground." ), - vp->part().name(), newit.tname() ) ); + pgettext( "furniture, item", "Not enough space on the %s. You drop the %s on the ground." ), + pgettext( "furniture, item", "Not enough space on the %s. drops the %s on the ground." ), + vp->part().name(), newit.tname() ); return set_item_map( loc, newit ); @@ -721,16 +717,14 @@ static item_location set_item_map_or_vehicle( const player &p, const tripoint &l if( g->m.has_furn( loc ) ) { const furn_t &workbench = g->m.furn( loc ).obj(); p.add_msg_player_or_npc( - string_format( pgettext( "item, furniture", "You put the %s on the %s." ), - newit.tname(), workbench.name() ), - string_format( pgettext( "item, furniture", " puts the %s on the %s." ), - newit.tname(), workbench.name() ) ); + pgettext( "item, furniture", "You put the %s on the %s." ), + pgettext( "item, furniture", " puts the %s on the %s." ), + newit.tname(), workbench.name() ); } else { p.add_msg_player_or_npc( - string_format( pgettext( "item", "You put the %s on the ground." ), - newit.tname() ), - string_format( pgettext( "item", " puts the %s on the ground." ), - newit.tname() ) ); + pgettext( "item", "You put the %s on the ground." ), + pgettext( "item", " puts the %s on the ground." ), + newit.tname() ); } return set_item_map( loc, newit ); } @@ -795,7 +789,7 @@ void player::start_craft( craft_command &command, const tripoint &loc ) amenu.text = string_format( pgettext( "in progress craft", "What to do with the %s?" ), craft.display_name() ); amenu.addentry( WIELD_CRAFT, !weapon.has_flag( "NO_UNWIELD" ), '1', - string_format( _( "Dispose of your wielded %s and start working." ), weapon.tname() ) ); + _( "Dispose of your wielded %s and start working." ), weapon.tname() ); amenu.addentry( DROP_CRAFT, true, '2', _( "Put it down and start working." ) ); const bool can_stash = can_pickVolume( craft ) && can_pickWeight( craft, !get_option( "DANGEROUS_PICKUPS" ) ); @@ -843,10 +837,9 @@ void player::start_craft( craft_command &command, const tripoint &loc ) activity.values.push_back( command.is_long() ); add_msg_player_or_npc( - string_format( pgettext( "in progress craft", "You start working on the %s." ), - craft.tname() ), - string_format( pgettext( "in progress craft", " starts working on the %s." ), - craft.tname() ) ); + pgettext( "in progress craft", "You start working on the %s." ), + pgettext( "in progress craft", " starts working on the %s." ), + craft.tname() ); } void player::craft_skill_gain( const item &craft, const int &multiplier ) @@ -1000,10 +993,8 @@ static void destroy_random_component( item &craft, const player &crafter ) item destroyed = random_entry_removed( craft.components ); - crafter.add_msg_player_or_npc( - string_format( _( "You mess up and destroy the %s." ), destroyed.tname() ), - string_format( _( " messes up and destroys the %s" ), destroyed.tname() ) - ); + crafter.add_msg_player_or_npc( _( "You mess up and destroy the %s." ), + _( " messes up and destroys the %s" ), destroyed.tname() ); } void item::handle_craft_failure( player &crafter ) @@ -1034,10 +1025,8 @@ void item::handle_craft_failure( player &crafter ) const double percent_progress_loss = rng_exponential( 0.25, 0.35 ) * ( 1.0 - std::min( success_roll, 1.0 ) ); const int progess_loss = item_counter * percent_progress_loss; - crafter.add_msg_player_or_npc( - string_format( _( "You mess up and lose %d%% progress." ), progess_loss / 100000 ), - string_format( _( " messes up and loses %d%% progress." ), progess_loss / 100000 ) - ); + crafter.add_msg_player_or_npc( _( "You mess up and lose %d%% progress." ), + _( " messes up and loses %d%% progress." ), progess_loss / 100000 ); item_counter = clamp( item_counter - progess_loss, 0, 10000000 ); set_next_failure_point( crafter ); @@ -1712,10 +1701,9 @@ bool player::craft_consume_tools( item &craft, int mulitplier, bool start_craft case use_from_player: if( !has_charges( type, count ) ) { add_msg_player_or_npc( - string_format( _( "You have insufficient %s charges and can't continue crafting" ), - item::nname( type ) ), - string_format( _( " has insufficient %s charges and can't continue crafting" ), - item::nname( type ) ) ); + _( "You have insufficient %s charges and can't continue crafting" ), + _( " has insufficient %s charges and can't continue crafting" ), + item::nname( type ) ); craft.set_tools_to_continue( false ); return false; } @@ -1723,10 +1711,9 @@ bool player::craft_consume_tools( item &craft, int mulitplier, bool start_craft case use_from_map: if( !map_inv.has_charges( type, count ) ) { add_msg_player_or_npc( - string_format( _( "You have insufficient %s charges and can't continue crafting" ), - item::nname( type ) ), - string_format( _( " has insufficient %s charges and can't continue crafting" ), - item::nname( type ) ) ); + _( "You have insufficient %s charges and can't continue crafting" ), + _( " has insufficient %s charges and can't continue crafting" ), + item::nname( type ) ); craft.set_tools_to_continue( false ); return false; } @@ -1738,10 +1725,9 @@ bool player::craft_consume_tools( item &craft, int mulitplier, bool start_craft } } else if( !has_amount( type, 1 ) && !map_inv.has_tools( type, 1 ) ) { add_msg_player_or_npc( - string_format( _( "You no longer have a %s and can't continue crafting" ), - item::nname( type ) ), - string_format( _( " no longer has a %s and can't continue crafting" ), - item::nname( type ) ) ); + _( "You no longer have a %s and can't continue crafting" ), + _( " no longer has a %s and can't continue crafting" ), + item::nname( type ) ); craft.set_tools_to_continue( false ); return false; } diff --git a/src/debug_menu.cpp b/src/debug_menu.cpp index f0357a1184150..f9a159ba7a38a 100644 --- a/src/debug_menu.cpp +++ b/src/debug_menu.cpp @@ -1529,7 +1529,7 @@ void debug() // Take a screenshot of the viewport. if ( g->take_screenshot( current_file_path ) ) { - popup( string_format( _( "Successfully saved your screenshot to: %s" ), map_directory.str() ) ); + popup( _( "Successfully saved your screenshot to: %s" ), map_directory.str() ); } else { popup( _( "An error occurred while trying to save the screenshot." ) ); diff --git a/src/descriptions.cpp b/src/descriptions.cpp index 5cfbb62030836..a3ff692cced03 100644 --- a/src/descriptions.cpp +++ b/src/descriptions.cpp @@ -98,8 +98,8 @@ c to describe creatures, f to describe furniture, t to describe terrain, Esc/Ent std::string signage = m.get_signage( p ); if( !signage.empty() ) { - desc += u.has_trait( trait_ILLITERATE ) ? string_format( _( "\nSign: ???" ) ) : string_format( - _( "\nSign: %s" ), signage ); + desc += u.has_trait( trait_ILLITERATE ) ? _( "\nSign: ???" ) : string_format( _( "\nSign: %s" ), + signage ); } werase( w_main ); diff --git a/src/faction_camp.cpp b/src/faction_camp.cpp index a743ee394daee..8a7ce8fbe5337 100644 --- a/src/faction_camp.cpp +++ b/src/faction_camp.cpp @@ -2344,13 +2344,13 @@ void basecamp::recruit_return( const std::string &task, int score ) int appeal = rng( -5, 3 ) + std::min( skill / 3, 3 ); int food_desire = rng( 0, 5 ); while( rec_m >= 0 ) { - std::string description = string_format( _( "NPC Overview:\n \n" ) ); + std::string description = _( "NPC Overview:\n \n" ); description += string_format( _( "Name: %20s\n \n" ), recruit->name ); description += string_format( _( "Strength: %10d\n" ), recruit->str_max ); description += string_format( _( "Dexterity: %10d\n" ), recruit->dex_max ); description += string_format( _( "Intelligence: %10d\n" ), recruit->int_max ); description += string_format( _( "Perception: %10d\n \n" ), recruit->per_max ); - description += string_format( _( "Top 3 Skills:\n" ) ); + description += _( "Top 3 Skills:\n" ); const auto skillslist = Skill::get_skills_sorted_by( [&]( const Skill & a, const Skill & b ) { @@ -2366,7 +2366,7 @@ void basecamp::recruit_return( const std::string &task, int score ) description += string_format( "%12s: %4d\n \n", skillslist[2]->name(), recruit->get_skill_level( skillslist[2]->ident() ) ); - description += string_format( _( "Asking for:\n" ) ); + description += _( "Asking for:\n" ); description += string_format( _( "> Food: %10d days\n \n" ), food_desire ); description += string_format( _( "Faction Food:%9d days\n \n" ), camp_food_supply( 0, true ) ); diff --git a/src/game.cpp b/src/game.cpp index 9c7ade702cf76..1e7cc2536ab3d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5451,9 +5451,9 @@ static std::string get_fire_fuel_string( const tripoint &examp ) field_entry *fire = g->m.get_field( examp, fd_fire ); if( fire ) { std::stringstream ss; - ss << string_format( _( "There is a fire here." ) ) << " "; + ss << _( "There is a fire here." ) << " "; if( fire->get_field_intensity() > 1 ) { - ss << string_format( _( "It's too big and unpredictable to evaluate how long it will last." ) ); + ss << _( "It's too big and unpredictable to evaluate how long it will last." ); return ss.str(); } time_duration fire_age = fire->get_field_age(); @@ -5462,7 +5462,7 @@ static std::string get_fire_fuel_string( const tripoint &examp ) mod = std::max( mod, 0 ); if( fire_age >= 0_turns ) { if( mod >= 4 ) { // = survival level 0-1 - ss << string_format( _( "It's going to go out soon without extra fuel." ) ); + ss << _( "It's going to go out soon without extra fuel." ); return ss.str(); } else { fire_age = 30_minutes - fire_age; @@ -5483,15 +5483,13 @@ static std::string get_fire_fuel_string( const tripoint &examp ) fire_age = fire_age * -1 + 30_minutes; if( mod >= 4 ) { // = survival level 0-1 if( fire_age <= 1_hours ) { - ss << string_format( - _( "It's quite decent and looks like it'll burn for a bit without extra fuel." ) ); + ss << _( "It's quite decent and looks like it'll burn for a bit without extra fuel." ); return ss.str(); } else if( fire_age <= 3_hours ) { - ss << string_format( _( "It looks solid, and will burn for a few hours without extra fuel." ) ); + ss << _( "It looks solid, and will burn for a few hours without extra fuel." ); return ss.str(); } else { - ss << string_format( - _( "It's very well supplied and even without extra fuel might burn for at least a part of a day." ) ); + ss << _( "It's very well supplied and even without extra fuel might burn for at least a part of a day." ); return ss.str(); } } else { @@ -6699,10 +6697,10 @@ look_around_result game::look_around( catacurses::window w_info, tripoint ¢e werase( w_info ); draw_border( w_info ); - static const char *title_prefix = "< "; + static const std::string title_prefix = "< "; static const char *title = _( "Look Around" ); - static const char *title_suffix = " >"; - static const std::string full_title = string_format( "%s%s%s", title_prefix, title, title_suffix ); + static const std::string title_suffix = " >"; + static const std::string full_title = title_prefix + title + title_suffix; const int start_pos = center_text_pos( full_title, 0, getmaxx( w_info ) - 1 ); mvwprintz( w_info, point( start_pos, 0 ), c_white, title_prefix ); wprintz( w_info, c_green, title ); diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 1567b094408ac..197511674f894 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -1272,9 +1272,8 @@ void iexamine::locked_object( player &p, const tripoint &examp ) return a->get_quality( quality_id( "PRY" ) ) > b->get_quality( quality_id( "PRY" ) ); } ); - p.add_msg_if_player( string_format( _( "You attempt to pry open the %s using your %s..." ), - g->m.has_furn( examp ) ? g->m.furnname( examp ) : g->m.tername( examp ), - prying_items[0]->tname() ) ); + p.add_msg_if_player( _( "You attempt to pry open the %s using your %s..." ), + g->m.has_furn( examp ) ? g->m.furnname( examp ) : g->m.tername( examp ), prying_items[0]->tname() ); // if crowbar() ever eats charges or otherwise alters the passed item, rewrite this to reflect // changes to the original item. @@ -2619,8 +2618,7 @@ void iexamine::fireplace( player &p, const tripoint &examp ) selection_menu.addentry( 4, false, 'e', _( "Extinguish fire (bashing item required)" ) ); } if( furn_is_deployed ) { - selection_menu.addentry( 3, true, 't', string_format( _( "Take down the %s" ), - g->m.furnname( examp ) ) ); + selection_menu.addentry( 3, true, 't', _( "Take down the %s" ), g->m.furnname( examp ) ); } selection_menu.query(); @@ -2634,8 +2632,7 @@ void iexamine::fireplace( player &p, const tripoint &examp ) item *it = firestarter.second; const auto usef = it->type->get_use( "firestarter" ); const auto actor = dynamic_cast( usef->get_actor_ptr() ); - p.add_msg_if_player( string_format( _( "You attempt to start a fire with your %s..." ), - it->tname() ) ); + p.add_msg_if_player( _( "You attempt to start a fire with your %s..." ), it->tname() ); const ret_val can_use = actor->can_use( p, *it, false, examp ); if( can_use.success() ) { const int charges = actor->use( p, *it, false, examp ); @@ -2752,9 +2749,9 @@ void iexamine::fvat_empty( player &p, const tripoint &examp ) uilist selectmenu; selectmenu.text = _( "Select an action" ); selectmenu.addentry( ADD_BREW, ( p.charges_of( brew_type ) > 0 ), MENU_AUTOASSIGN, - string_format( _( "Add more %s to the vat" ), brew_nname ) ); + _( "Add more %s to the vat" ), brew_nname ); selectmenu.addentry( REMOVE_BREW, brew.made_of( LIQUID ), MENU_AUTOASSIGN, - string_format( _( "Remove %s from the vat" ), brew.tname() ) ); + _( "Remove %s from the vat" ), brew.tname() ); selectmenu.addentry( START_FERMENT, true, MENU_AUTOASSIGN, _( "Start fermenting cycle" ) ); selectmenu.query(); switch( selectmenu.ret ) { @@ -4282,9 +4279,9 @@ static player &best_installer( player &p, player &null_player, int difficulty ) int ally_cos = bionic_manip_cos( ally_skills[ i ].first, true, difficulty ); if( e->has_effect( effect_sleep ) ) { //~ %1$s is the name of the ally - if( !g->u.query_yn( string_format( - _( "%1$s is asleep, but has a %2$d chance of success compared to your %3$d chance of success. Continue with a higher risk of failure?" ), - ally.disp_name(), ally_cos, player_cos ) ) ) { + if( !g->u.query_yn( + _( "%1$s is asleep, but has a %2$d chance of success compared to your %3$d chance of success. Continue with a higher risk of failure?" ), + ally.disp_name(), ally_cos, player_cos ) ) { return null_player; } else { continue; @@ -5568,18 +5565,15 @@ void iexamine::workbench_internal( player &p, const tripoint &examp, const recipe &rec = selected_craft->get_making(); if( p.has_recipe( &rec, p.crafting_inventory(), p.get_crafting_helpers() ) == -1 ) { p.add_msg_player_or_npc( - string_format( _( "You don't know the recipe for the %s and can't continue crafting." ), - rec.result_name() ), - string_format( _( " doesn't know the recipe for the %s and can't continue crafting." ), - rec.result_name() ) - ); + _( "You don't know the recipe for the %s and can't continue crafting." ), + _( " doesn't know the recipe for the %s and can't continue crafting." ), + rec.result_name() ); break; } p.add_msg_player_or_npc( - string_format( pgettext( "in progress craft", "You start working on the %s." ), - selected_craft->tname() ), - string_format( pgettext( "in progress craft", " starts working on the %s." ), - selected_craft->tname() ) ); + pgettext( "in progress craft", "You start working on the %s." ), + pgettext( "in progress craft", " starts working on the %s." ), + selected_craft->tname() ); p.assign_activity( activity_id( "ACT_CRAFT" ) ); p.activity.targets.push_back( crafts[amenu2.ret] ); p.activity.values.push_back( 0 ); // Not a long craft diff --git a/src/item.cpp b/src/item.cpp index 6ea9866d238fe..9b292bacbd2ac 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -2370,8 +2370,7 @@ std::string item::info( std::vector &info, const iteminfo_query *parts int attack_cost = g->u.attack_speed( *this ); insert_separation_line(); if( parts->test( iteminfo_parts::DESCRIPTION_MELEEDMG ) ) { - info.push_back( iteminfo( "DESCRIPTION", - string_format( _( "Average melee damage:" ) ) ) ); + info.push_back( iteminfo( "DESCRIPTION", _( "Average melee damage:" ) ) ); } if( parts->test( iteminfo_parts::DESCRIPTION_MELEEDMG_CRIT ) ) { info.push_back( iteminfo( "DESCRIPTION", @@ -2449,15 +2448,12 @@ std::string item::info( std::vector &info, const iteminfo_query *parts if( parts->test( iteminfo_parts::DESCRIPTION_CONDUCTIVITY ) ) { if( !conductive() ) { - info.push_back( iteminfo( "BASE", - string_format( _( "* This item does not conduct electricity." ) ) ) ); + info.push_back( iteminfo( "BASE", _( "* This item does not conduct electricity." ) ) ); } else if( has_flag( "CONDUCTIVE" ) ) { info.push_back( iteminfo( "BASE", - string_format( - _( "* This item effectively conducts electricity, as it has no guard." ) ) ) ); + _( "* This item effectively conducts electricity, as it has no guard." ) ) ); } else { - info.push_back( iteminfo( "BASE", - string_format( _( "* This item conducts electricity." ) ) ) ); + info.push_back( iteminfo( "BASE", _( "* This item conducts electricity." ) ) ); } } @@ -8512,8 +8508,7 @@ std::string item::type_name( unsigned int quantity ) const } } else if( typeId() == "blood" ) { if( corpse == nullptr || corpse->id.is_null() ) { - return string_format( npgettext( "item name", "human blood", - "human blood", quantity ) ); + return npgettext( "item name", "human blood", "human blood", quantity ); } else { return string_format( npgettext( "item name", "%s blood", "%s blood", quantity ), diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 37b1fa03393e6..693a80a06e91d 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -933,7 +933,7 @@ void Item_factory::check_definitions() const } if( type->brewable->results.empty() ) { - msg << string_format( "empty product list" ) << "\n"; + msg << "empty product list" << "\n"; } for( auto &b : type->brewable->results ) { @@ -957,7 +957,7 @@ void Item_factory::check_definitions() const } if( type->book ) { if( type->book->skill && !type->book->skill.is_valid() ) { - msg << string_format( "uses invalid book skill." ) << "\n"; + msg << "uses invalid book skill." << "\n"; } if( type->book->martial_art && !type->book->martial_art.is_valid() ) { msg << string_format( "trains invalid martial art '%s'.", @@ -1017,18 +1017,18 @@ void Item_factory::check_definitions() const } if( !type->gun->skill_used ) { - msg << string_format( "uses no skill" ) << "\n"; + msg << "uses no skill" << "\n"; } else if( !type->gun->skill_used.is_valid() ) { msg << "uses an invalid skill " << type->gun->skill_used.str() << "\n"; } for( auto &gm : type->gun->default_mods ) { if( !has_template( gm ) ) { - msg << string_format( "invalid default mod." ) << "\n"; + msg << "invalid default mod." << "\n"; } } for( auto &gm : type->gun->built_in_mods ) { if( !has_template( gm ) ) { - msg << string_format( "invalid built-in mod." ) << "\n"; + msg << "invalid built-in mod." << "\n"; } } } @@ -1203,9 +1203,8 @@ const itype *Item_factory::find_template( const itype_id &id ) const ( making_id.is_valid() && making_id.obj().is_blueprint() ) ) { itype *def = new itype(); def->id = id; - def->name = string_format( "DEBUG: %s", id.c_str() ); - def->name_plural = string_format( "%s", id.c_str() ); - def->description = string_format( making_id.obj().description ); + def->name = def->name_plural = string_format( "DEBUG: %s", id.c_str() ); + def->description = making_id.obj().description; m_runtimes[ id ].reset( def ); return def; } diff --git a/src/iuse.cpp b/src/iuse.cpp index 89d737b9fbaef..f60824f4d92c1 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -4245,14 +4245,13 @@ int iuse::hand_crank( player *p, item *it, bool, const tripoint & ) // expectation is it runs until the player is too tired. int moves = to_moves( 1600_minutes ); if( it->ammo_capacity() > it->ammo_remaining() ) { - p->add_msg_if_player( string_format( _( "You start cranking the %s to charge its %s." ), - it->tname(), it->magazine_current()->tname() ) ) ; + p->add_msg_if_player( _( "You start cranking the %s to charge its %s." ), it->tname(), + it->magazine_current()->tname() ); p->assign_activity( activity_id( "ACT_HAND_CRANK" ), moves, -1, p->get_item_position( it ), "hand-cranking" ); } else { - p->add_msg_if_player( string_format( - _( "You could use the %s to charge its %s, but it's already charged." ), it->tname(), - magazine->tname() ) ) ; + p->add_msg_if_player( _( "You could use the %s to charge its %s, but it's already charged." ), + it->tname(), magazine->tname() ); } } else { p->add_msg_if_player( m_info, _( "You need a rechargeable battery cell to charge." ) ); @@ -6464,7 +6463,7 @@ static std::string colorized_field_description_at( const tripoint &point ) } } if( affix.empty() ) { - field_text = string_format( " in %s cloud", colorize( entry->name(), entry->color() ) ); + field_text = string_format( _( " in %s cloud" ), colorize( entry->name(), entry->color() ) ); } else { field_text = string_format( affix, colorize( entry->name(), entry->color() ) ); } @@ -6566,7 +6565,7 @@ static std::string format_object_pair( const std::pair &pair, const std::string &article ) { if( pair.second == 1 ) { - return string_format( "%s%s", article, pair.first ); + return article + pair.first; } else if( pair.second > 1 ) { return string_format( "%s%i %s", article, pair.second, pair.first ); } @@ -8082,9 +8081,8 @@ int iuse::autoclave( player *p, item *it, bool t, const tripoint &pos ) static const int power_need = ( ( it->type->tool->power_draw / 1000 ) * to_seconds ( 90_minutes ) ) / 1000 + 100; if( power_need > it->ammo_remaining() ) { - popup( string_format( - _( "The autoclave doesn't have enough battery for one cycle. You need at least %s charges." ), - power_need ) ); + popup( _( "The autoclave doesn't have enough battery for one cycle. You need at least %s charges." ), + power_need ); return 0; } @@ -9152,17 +9150,14 @@ int iuse::craft( player *p, item *it, bool, const tripoint & ) const recipe &rec = it->get_making(); if( p->has_recipe( &rec, p->crafting_inventory(), p->get_crafting_helpers() ) == -1 ) { p->add_msg_player_or_npc( - string_format( _( "You don't know the recipe for the %s and can't continue crafting." ), - rec.result_name() ), - string_format( _( " doesn't know the recipe for the %s and can't continue crafting." ), - rec.result_name() ) - ); + _( "You don't know the recipe for the %s and can't continue crafting." ), + _( " doesn't know the recipe for the %s and can't continue crafting." ), + rec.result_name() ); return 0; } p->add_msg_player_or_npc( - string_format( pgettext( "in progress craft", "You start working on the %s." ), craft_name ), - string_format( pgettext( "in progress craft", " starts working on the %s." ), - craft_name ) ); + pgettext( "in progress craft", "You start working on the %s." ), + pgettext( "in progress craft", " starts working on the %s." ), craft_name ); p->assign_activity( activity_id( "ACT_CRAFT" ) ); p->activity.targets.push_back( item_location( *p, it ) ); p->activity.values.push_back( 0 ); // Not a long craft diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 79f2378e400d0..91b56b6fc9dc0 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -271,9 +271,8 @@ ret_val iuse_transform::can_use( const player &p, const item &, bool, [&]( const std::pair &unmet_req ) { return string_format( "%s %d", unmet_req.first.obj().name, unmet_req.second ); } ); - return ret_val::make_failure( string_format( ngettext( "You need a tool with %s.", - "You need tools with %s.", unmet_reqs.size() ), - unmet_reqs_string ) ); + return ret_val::make_failure( ngettext( "You need a tool with %s.", "You need tools with %s.", + unmet_reqs.size() ), unmet_reqs_string ); } std::string iuse_transform::get_name() const @@ -2687,12 +2686,11 @@ int bandolier_actor::use( player &p, item &it, bool, const tripoint & ) const std::vector> actions; menu.addentry( -1, it.contents.empty() || it.contents.front().charges < capacity, - 'r', string_format( _( "Store ammo in %s" ), it.type_name() ) ); + 'r', _( "Store ammo in %s" ), it.type_name() ); actions.emplace_back( [&] { reload( p, it ); } ); - menu.addentry( -1, !it.contents.empty(), 'u', string_format( _( "Unload %s" ), - it.type_name() ) ); + menu.addentry( -1, !it.contents.empty(), 'u', _( "Unload %s" ), it.type_name() ); actions.emplace_back( [&] { if( p.i_add_or_drop( it.contents.front() ) ) @@ -4323,7 +4321,7 @@ int weigh_self_actor::use( player &p, item &, bool, const tripoint & ) const if( weight > convert_weight( max_weight ) ) { popup( _( "ERROR: Max weight of %.0f %s exceeded" ), convert_weight( max_weight ), weight_units() ); } else { - popup( string_format( "%.0f %s", weight, weight_units() ) ); + popup( "%.0f %s", weight, weight_units() ); } return 0; } @@ -4474,8 +4472,7 @@ int sew_advanced_actor::use( player &p, item &it, bool, const tripoint & ) const format_volume( before ), volume_units_abbr(), format_volume( after ), volume_units_abbr() ), get_volume_compare_color( before, after, true ) ); - tmenu.addentry_desc( index++, enab, MENU_AUTOASSIGN, string_format( "%s", _( prompt.c_str() ) ), - desc.str() ); + tmenu.addentry_desc( index++, enab, MENU_AUTOASSIGN, _( prompt.c_str() ), desc.str() ); } tmenu.textwidth = 80; tmenu.desc_enabled = true; diff --git a/src/magic.cpp b/src/magic.cpp index 3fa1638f11bcd..a004289df1cd7 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -909,13 +909,14 @@ std::string spell::enumerate_targets() const return all_valid_targets[0]; } std::string ret; + // @todo if only we had a function to enumerate strings and concatenate them... for( auto iter = all_valid_targets.begin(); iter != all_valid_targets.end(); iter++ ) { if( iter + 1 == all_valid_targets.end() ) { - ret = string_format( "%s and %s", ret, *iter ); + ret = string_format( _( "%s and %s" ), ret, *iter ); } else if( iter == all_valid_targets.begin() ) { - ret = string_format( "%s", *iter ); + ret = *iter; } else { - ret = string_format( "%s, %s", ret, *iter ); + ret = string_format( _( "%s, %s" ), ret, *iter ); } } return ret; @@ -1070,14 +1071,14 @@ void known_magic::learn_spell( const spell_type *sp, player &p, bool force ) for( const trait_id &cancel : sp->spell_class->cancels ) { if( cancel == sp->spell_class->cancels.back() && sp->spell_class->cancels.back() != sp->spell_class->cancels.front() ) { - trait_cancel = string_format( "%s and %s", trait_cancel, cancel->name() ); + trait_cancel = string_format( _( "%s and %s" ), trait_cancel, cancel->name() ); } else if( cancel == sp->spell_class->cancels.front() ) { trait_cancel = cancel->name(); if( sp->spell_class->cancels.size() == 1 ) { trait_cancel = string_format( "%s: %s", trait_cancel, cancel->desc() ); } } else { - trait_cancel = string_format( "%s, %s", trait_cancel, cancel->name() ); + trait_cancel = string_format( _( "%s, %s" ), trait_cancel, cancel->name() ); } if( cancel == sp->spell_class->cancels.back() ) { trait_cancel += "."; @@ -1268,15 +1269,10 @@ class spellcasting_callback : public uilist_callback static std::string moves_to_string( const int moves ) { - const int turns = moves / 100; - if( moves < 200 ) { - return _( string_format( "%d %s", moves, "moves" ) ); - } else if( moves < to_moves( 2_minutes ) ) { - return _( string_format( "%d %s", turns, "turns" ) ); - } else if( moves < to_moves( 2_hours ) ) { - return _( string_format( "%d %s", to_minutes( turns * 1_turns ), "minutes" ) ); + if( moves < to_moves( 2_seconds ) ) { + return string_format( _( "%d moves" ), moves ); } else { - return _( string_format( "%d %s", to_hours( turns * 1_turns ), "hours" ) ); + return to_string( time_duration::from_turns( moves / 100 ) ); } } diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 746d7c1d8a23d..9428556d8457a 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -450,7 +450,7 @@ std::string ma_requirements::get_description( bool buff ) const } if( !req_buffs.empty() ) { - dump << string_format( _( "Requires: " ) ); + dump << _( "Requires: " ); dump << enumerate_as_string( req_buffs.begin(), req_buffs.end(), []( const mabuff_id & bid ) { return _( bid->name ); diff --git a/src/monster.cpp b/src/monster.cpp index e603b21f7a191..425af6efe9a1d 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -504,20 +504,20 @@ std::string monster::name_with_armor() const { std::string ret; if( type->in_species( INSECT ) ) { - ret = string_format( _( "carapace" ) ); + ret = _( "carapace" ); } else if( made_of( material_id( "veggy" ) ) ) { - ret = string_format( _( "thick bark" ) ); + ret = _( "thick bark" ); } else if( made_of( material_id( "bone" ) ) ) { - ret = string_format( _( "exoskeleton" ) ); + ret = _( "exoskeleton" ); } else if( made_of( material_id( "flesh" ) ) || made_of( material_id( "hflesh" ) ) || made_of( material_id( "iflesh" ) ) ) { - ret = string_format( _( "thick hide" ) ); + ret = _( "thick hide" ); } else if( made_of( material_id( "iron" ) ) || made_of( material_id( "steel" ) ) ) { - ret = string_format( _( "armor plating" ) ); + ret = _( "armor plating" ); } else if( made_of( LIQUID ) ) { - ret = string_format( _( "dense jelly mass" ) ); + ret = _( "dense jelly mass" ); } else { - ret = string_format( _( "armor" ) ); + ret = _( "armor" ); } if( has_effect( effect_monster_armor ) && !inv.empty() ) { for( const item &armor : inv ) { diff --git a/src/newcharacter.cpp b/src/newcharacter.cpp index 82c81a8cbfcf6..8ac5b916af303 100644 --- a/src/newcharacter.cpp +++ b/src/newcharacter.cpp @@ -474,9 +474,9 @@ bool avatar::create( character_type type, const std::string &tempname ) auto nameExists = [&]( const std::string & name ) { return world_generator->active_world->save_exists( save_t::from_player_name( name ) ) && - !query_yn( string_format( _( "A character with the name '%s' already exists in this world.\n" - "Saving will override the already existing character.\n\n" - "Continue anyways?" ), name ) ); + !query_yn( _( "A character with the name '%s' already exists in this world.\n" + "Saving will override the already existing character.\n\n" + "Continue anyways?" ), name ); }; const bool allow_reroll = type == PLTYPE_RANDOM; diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 67015c56a4158..c67dd6ead244a 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -1037,8 +1037,7 @@ void npc::execute_action( npc_action action ) if( path.size() == 1 ) { // We're adjacent to u, and thus can heal u heal_player( *patient ); } else if( !path.empty() ) { - say( string_format( _( "Hold still %s, I'm coming to help you." ), - patient->disp_name() ) ); + say( _( "Hold still %s, I'm coming to help you." ), patient->disp_name() ); move_to_next(); } else { move_pause(); @@ -3023,7 +3022,7 @@ bool npc::do_player_activity() } /* if the activity is finished, grab any backlog or change the mission */ if( !has_destination() && !activity ) { - add_msg( m_info, string_format( "%s completed the assigned task.", disp_name() ) ); + add_msg( m_info, _( "%s completed the assigned task." ), disp_name() ); if( !backlog.empty() ) { activity = backlog.front(); backlog.pop_front(); diff --git a/src/npctalk.cpp b/src/npctalk.cpp index 8fad4c6fc2a63..6c93075b3a788 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -390,9 +390,9 @@ void game::chat() message = _( "loudly." ); break; case NPC_CHAT_SENTENCE: { - std::string popupdesc = string_format( _( "Enter a sentence to yell" ) ); + std::string popupdesc = _( "Enter a sentence to yell" ); string_input_popup popup; - popup.title( string_format( _( "Yell a sentence" ) ) ) + popup.title( _( "Yell a sentence" ) ) .width( 64 ) .description( popupdesc ) .identifier( "sentence" ) @@ -3039,22 +3039,22 @@ std::string give_item_to( npc &p, bool allow_use, bool allow_carry ) reason += "\n" + string_format( _( "(new weapon value: %.1f vs %.1f)." ), new_weapon_value, cur_weapon_value ); if( !given.is_gun() && given.is_armor() ) { - reason += "\n" + string_format( _( "It's too encumbering to wear." ) ); + reason += std::string( "\n" ) + _( "It's too encumbering to wear." ); } } if( allow_carry ) { if( !p.can_pickVolume( given ) ) { const units::volume free_space = p.volume_capacity() - p.volume_carried(); - reason += "\n" + string_format( _( "I have no space to store it." ) ) + "\n"; + reason += "\n" + std::string( _( "I have no space to store it." ) ) + "\n"; if( free_space > 0_ml ) { reason += string_format( _( "I can only store %s %s more." ), format_volume( free_space ), volume_units_long() ); } else { - reason += string_format( _( "...or to store anything else for that matter." ) ); + reason += _( "...or to store anything else for that matter." ); } } if( !p.can_pickWeight( given ) ) { - reason += "\n" + string_format( _( "It is too heavy for me to carry." ) ); + reason += std::string( "\n" ) + _( "It is too heavy for me to carry." ); } } diff --git a/src/npctalk_funcs.cpp b/src/npctalk_funcs.cpp index 9355a087cb54c..0ffdc6bbd5971 100644 --- a/src/npctalk_funcs.cpp +++ b/src/npctalk_funcs.cpp @@ -223,7 +223,7 @@ void talk_function::goto_location( npc &p ) { int i = 0; uilist selection_menu; - selection_menu.text = string_format( _( "Select a destination" ) ); + selection_menu.text = _( "Select a destination" ); std::vector camps; tripoint destination; for( auto elem : g->u.camps ) { diff --git a/src/pickup.cpp b/src/pickup.cpp index 882bb9e947d83..f8a575903bcba 100644 --- a/src/pickup.cpp +++ b/src/pickup.cpp @@ -800,7 +800,7 @@ void Pickup::pick_up( const tripoint &p, int min, from_where get_items_from ) if( this_item.has_owner() ) { const faction *item_fac = this_item.get_owner(); if( item_fac != g->faction_manager_ptr->get( faction_id( "your_followers" ) ) ) { - stolen = string_format( "!" ); + stolen = "!"; stealing = true; } } diff --git a/src/sounds.cpp b/src/sounds.cpp index 802827926d03e..42fd1a2e5b7a6 100644 --- a/src/sounds.cpp +++ b/src/sounds.cpp @@ -679,7 +679,7 @@ void sfx::do_vehicle_engine_sfx() add_msg( m_debug, "STOP speed %d =/= %d", current_speed, previous_speed ); play_ambient_variant_sound( id_and_variant.first, id_and_variant.second, sfx::get_heard_volume( g->u.pos() ), ch, 1000, pitch ); - add_msg( m_debug, string_format( "PITCH %f", pitch ) ); + add_msg( m_debug, "PITCH %f", pitch ); } previous_speed = current_speed; previous_gear = current_gear; diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index a7af3758a3128..3334463099d8a 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -2810,7 +2810,7 @@ void act_vehicle_siphon( vehicle *veh ) return; } - std::string title = string_format( _( "Select tank to siphon:" ) ); + std::string title = _( "Select tank to siphon:" ); auto sel = []( const vehicle_part & pt ) { return pt.is_tank() && pt.get_base().contents_made_of( LIQUID ); };