Skip to content

Commit

Permalink
fix: mopping floors (#3742)
Browse files Browse the repository at this point in the history
* Fix mopping floors

* style(autofix.ci): automated formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
joveeater and autofix-ci[bot] authored Nov 23, 2023
1 parent 7644cd8 commit e8eb765
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2856,13 +2856,14 @@ bool map::mop_spills( const tripoint &p )

if( !has_flag( "LIQUIDCONT", p ) && !has_flag( "SEALED", p ) ) {
auto items = i_at( p );
auto new_end = std::remove_if( items.begin(), items.end(), []( const item * const & it ) {
return it->made_of( LIQUID );

items.remove_top_items_with( [&retval]( detached_ptr<item> &&e ) {
if( e->made_of( LIQUID ) ) {
retval = true;
return detached_ptr<item>();
}
return std::move( e );
} );
retval = new_end != items.end();
while( new_end != items.end() ) {
new_end = items.erase( new_end );
}
}

field &fld = field_at( p );
Expand Down Expand Up @@ -2893,13 +2894,13 @@ bool map::mop_spills( const tripoint &p )
}
//remove any liquids that somehow didn't fall through to the ground
vehicle_stack here = veh->get_items( elem );
auto new_end = std::remove_if( here.begin(), here.end(), []( const item * const & it ) {
return it->made_of( LIQUID );
here.remove_top_items_with( [&retval]( detached_ptr<item> &&e ) {
if( e->made_of( LIQUID ) ) {
retval = true;
return detached_ptr<item>();
}
return std::move( e );
} );
retval |= ( new_end != here.end() );
while( new_end != here.end() ) {
new_end = here.erase( new_end );
}
}
} // if veh != 0
return retval;
Expand Down

0 comments on commit e8eb765

Please sign in to comment.