Skip to content

Commit

Permalink
refactor: make fuel_count const
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 committed Oct 6, 2022
1 parent 880c959 commit 937f8ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vehicle_use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,10 @@ void vehicle::control_engines()
int e_toggle = 0;
bool dirty = false;
//count active engines
int fuel_count = 0;
for( int e : engines ) {
fuel_count += part_info( e ).engine_fuel_opts().size();
}
const int fuel_count = std::accumulate( engines.begin(), engines.end(), int{0},
[&]( int acc, int e ) {
return acc + part_info( e ).engine_fuel_opts().size();
} );

const auto adjust_engine = [this]( int e_toggle ) {
int i = 0;
Expand Down

0 comments on commit 937f8ce

Please sign in to comment.