Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for clang #9

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> r;
r.push_back( obj.tname( false ) );
r.push_back( to_string( obj.volume() / units::legacy_volume_factor ) );
Expand Down
2 changes: 1 addition & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/game_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<itype_id> 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() );
Expand Down
2 changes: 1 addition & 1 deletion src/item_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void game::item_action_menu()
std::vector<std::tuple<item_action_id, std::string, std::string>> 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<item_action_id, std::string, std::string> &lhs,
const std::tuple<item_action_id, std::string, std::string> &rhs ) {
return std::get<1>( lhs ).compare( std::get<1>( rhs ) ) < 0;
Expand Down
2 changes: 1 addition & 1 deletion src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<trait_id, trait_data> &pr ) -> std::string {
[visibility_cap ]( const std::pair<trait_id, trait_data> &pr ) -> std::string {
const auto &mut_branch = pr.first.obj();
// Finally some use for visibility trait of mutations
// @todo Balance this formula
Expand Down
6 changes: 3 additions & 3 deletions src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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, &center, this]( const tripoint &l, const tripoint &r ) {
[&tar, &center]( const tripoint &l, const tripoint &r ) {
return ( rl_dist( l, tar ) - rl_dist( l, center ) ) <
( rl_dist( r, tar ) - rl_dist( r, center ) );
} );
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/pathfinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ std::vector<tripoint> 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<tripoint> sorted_line( line_path.begin(), line_path.end() );
Expand Down
4 changes: 2 additions & 2 deletions src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ std::vector<tripoint> 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<npc>( dst ) ) {
auto &a = g->active_npc;
// Convert the npc pointer into an index in game::active_npc
Expand All @@ -949,7 +949,7 @@ std::vector<tripoint> 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;
}
Expand Down