Skip to content

Commit 0b3ac81

Browse files
committed
replace ammo check for loop with ranges::any_of + lambda
1 parent 1f6e15c commit 0b3ac81

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/character_functions.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -1177,13 +1177,9 @@ void find_ammo_helper( T &src, const item &obj, bool empty, Output out, bool nes
11771177
if( node->is_magazine() ) {
11781178

11791179
if( !node->contents.empty() ) {
1180-
bool match = false;
1181-
for( const ammotype &at : ammo ) {
1182-
if( node->contents.front().ammo_type() == at ) {
1183-
match = true;
1184-
break;
1185-
}
1186-
}
1180+
const bool match = std::ranges::any_of( ammo, [&]( const ammotype & at ) {
1181+
return node->contents.front().ammo_type() == at;
1182+
} );
11871183
if( !match ) {
11881184
return VisitResponse::SKIP;
11891185
}

0 commit comments

Comments
 (0)