diff --git a/src/dump.cpp b/src/dump.cpp index a547f12df35c..4d532c920cc4 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -114,7 +114,7 @@ bool game::dump_stats( const std::string& what, dump_mode mode, const std::vecto for( const auto& v : vitamin::all() ) { header.push_back( v.second.name() ); } - auto dump = [&rows,&test_npcs]( const item& obj ) { + auto dump = [&rows]( const item& obj ) { std::vector r; r.push_back( obj.tname( false ) ); r.push_back( to_string( obj.volume() / units::legacy_volume_factor ) ); diff --git a/src/game.cpp b/src/game.cpp index fc596250840c..5e894b27dc3c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -7538,7 +7538,7 @@ bool game::npc_menu( npc &who ) who.body_window( precise ); } else if( choice == use_item ) { static const std::string heal_string( "heal" ); - const auto will_accept = [&who]( const item &it ) { + const auto will_accept = []( const item &it ) { const auto use_fun = it.get_use( heal_string ); if( use_fun == nullptr ) { return false; diff --git a/src/game_inventory.cpp b/src/game_inventory.cpp index 177b646ca54b..3ddc21bb9b5b 100644 --- a/src/game_inventory.cpp +++ b/src/game_inventory.cpp @@ -253,19 +253,19 @@ class comestible_inventory_preset : public inventory_selector_preset public: comestible_inventory_preset( const player &p ) : inventory_selector_preset(), p( p ) { - append_cell( [ this, &p ]( const item_location & loc ) { + append_cell( [ this ]( const item_location & loc ) { return good_bad_none( get_edible_comestible( loc ).nutr ); }, _( "NUTRITION" ) ); - append_cell( [ this, &p ]( const item_location & loc ) { + append_cell( [ this ]( const item_location & loc ) { return good_bad_none( get_edible_comestible( loc ).quench ); }, _( "QUENCH" ) ); - append_cell( [ this, &p ]( const item_location & loc ) { + append_cell( [ this ]( const item_location & loc ) { return good_bad_none( get_edible_comestible( loc ).fun ); }, _( "JOY" ) ); - append_cell( [ this, &p ]( const item_location & loc ) { + append_cell( [ this ]( const item_location & loc ) { const int spoils = get_edible_comestible( loc ).spoils; if( spoils > 0 ) { return calendar( spoils ).textify_period(); diff --git a/src/item.cpp b/src/item.cpp index c75432c61778..a0a5256fe39a 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -304,7 +304,7 @@ item& item::ammo_set( const itype_id& ammo, long qty ) // as above call to magazine_default successful can infer minimum one option exists auto iter = type->magazines.find( ammo_type() ); std::vector opts( iter->second.begin(), iter->second.end() ); - std::sort( opts.begin(), opts.end(), [qty]( const itype_id &lhs, const itype_id &rhs ) { + std::sort( opts.begin(), opts.end(), []( const itype_id &lhs, const itype_id &rhs ) { return find_type( lhs )->magazine->capacity < find_type( rhs )->magazine->capacity; } ); mag = find_type( opts.back() ); diff --git a/src/item_action.cpp b/src/item_action.cpp index 981ef34b16d7..f6d6bef34bbd 100644 --- a/src/item_action.cpp +++ b/src/item_action.cpp @@ -243,7 +243,7 @@ void game::item_action_menu() std::vector> menu_items; // Sorts menu items by action. typedef decltype( menu_items )::iterator Iter; - const auto sort_menu = [&menu_items]( Iter from, Iter to ) { + const auto sort_menu = []( Iter from, Iter to ) { std::sort( from, to, []( const std::tuple &lhs, const std::tuple &rhs ) { return std::get<1>( lhs ).compare( std::get<1>( rhs ) ) < 0; diff --git a/src/iuse.cpp b/src/iuse.cpp index f35ac90ffdb6..8d9adca52a58 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -2300,7 +2300,7 @@ int iuse::remove_all_mods(player *p, item *, bool, const tripoint& ) } if( !loc->ammo_remaining() || g->unload( *loc ) ) { - auto mod = std::find_if( loc->contents.begin(), loc->contents.end(), [&loc]( const item& e ) { + auto mod = std::find_if( loc->contents.begin(), loc->contents.end(), []( const item& e ) { return e.is_toolmod(); } ); p->i_add_or_drop( *mod ); diff --git a/src/npc.cpp b/src/npc.cpp index 9428ccb7c771..6da3d8df6361 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -1770,7 +1770,7 @@ int npc::print_info(WINDOW* w, int line, int vLines, int column) const const int visibility_cap = g->u.get_per() - rl_dist( g->u.pos(), pos() ); const std::string trait_str = enumerate_as_string( my_mutations.begin(), my_mutations.end(), - [ this, visibility_cap ]( const std::pair &pr ) -> std::string { + [visibility_cap ]( const std::pair &pr ) -> std::string { const auto &mut_branch = pr.first.obj(); // Finally some use for visibility trait of mutations // @todo Balance this formula diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 62860877fd6d..16842564e12f 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -727,7 +727,7 @@ void npc::choose_target() constexpr static int def_radius = 6; - const auto ok_by_rules = [this, cur_range]( const Creature &c, int dist, int scaled_dist ) { + const auto ok_by_rules = [cur_range, this]( const Creature &c, int dist, int scaled_dist ) { if( !is_following() ) { return true; } @@ -1620,7 +1620,7 @@ void npc::avoid_friendly_fire() auto candidates = closest_tripoints_first( 1, pos() ); candidates.erase( candidates.begin() ); std::sort( candidates.begin(), candidates.end(), - [&tar, ¢er, this]( const tripoint &l, const tripoint &r ) { + [&tar, ¢er]( const tripoint &l, const tripoint &r ) { return ( rl_dist( l, tar ) - rl_dist( l, center ) ) < ( rl_dist( r, tar ) - rl_dist( r, center ) ); } ); @@ -2248,7 +2248,7 @@ bool npc::wield_better_weapon() // Fists aren't checked below compare_weapon( ret_null ); - visit_items( [this, &compare_weapon]( item *node ) { + visit_items( [&compare_weapon]( item *node ) { // Skip some bad items if( !node->is_melee() ) { return VisitResponse::SKIP; diff --git a/src/options.cpp b/src/options.cpp index 12b5b5a17a8c..f1c11d1c10f4 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -485,7 +485,7 @@ std::string options_manager::cOpt::getDefaultText(const bool bTranslated) const { if (sType == "string_select") { const std::string sItems = enumerate_as_string( vItems.begin(), vItems.end(), - [ this, bTranslated ]( const std::string &elem ) { + [bTranslated ]( const std::string &elem ) { return bTranslated ? optionNames[elem] : elem; }, false ); return string_format(_("Default: %s - Values: %s"), diff --git a/src/pathfinding.cpp b/src/pathfinding.cpp index d4d2757ec6be..53f35996cbfe 100644 --- a/src/pathfinding.cpp +++ b/src/pathfinding.cpp @@ -197,7 +197,7 @@ std::vector map::route( const tripoint &f, const tripoint &t, const auto line_path = line_to( f, t ); const auto &pf_cache = get_pathfinding_cache_ref( f.z ); // Check all points for any special case (including just hard terrain) - if( std::all_of( line_path.begin(), line_path.end(), [&pf_cache, non_normal]( const tripoint & p ) { + if( std::all_of( line_path.begin(), line_path.end(), [&pf_cache]( const tripoint & p ) { return !( pf_cache.special[p.x][p.y] & non_normal ); } ) ) { const std::set sorted_line( line_path.begin(), line_path.end() ); diff --git a/src/ranged.cpp b/src/ranged.cpp index de28321bb607..90a99bba7c18 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -938,7 +938,7 @@ std::vector target_handler::target_ui( player &pc, target_mode mode, t.size()), t.size()); } - const auto set_last_target = [this]( const tripoint &dst ) { + const auto set_last_target = []( const tripoint &dst ) { if( const auto np = g->critter_at( dst ) ) { auto &a = g->active_npc; // Convert the npc pointer into an index in game::active_npc @@ -949,7 +949,7 @@ std::vector target_handler::target_ui( player &pc, target_mode mode, } }; - const auto confirm_non_enemy_target = [this, &pc]( const tripoint &dst ) { + const auto confirm_non_enemy_target = [&pc]( const tripoint &dst ) { if( dst == pc.pos() ) { return true; }