Skip to content

Commit

Permalink
Eliminate 'loop variable creates a copy' warning
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong committed Jan 4, 2019
1 parent 83b5b24 commit bf87ac0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9471,7 +9471,7 @@ void game::butcher()
if( disassembles.size() > 1 ) {
int time_to_disassemble = 0;
int time_to_disassemble_all = 0;
for( const auto stack : disassembly_stacks ) {
for( const auto &stack : disassembly_stacks ) {
const item &it = items[ stack.first ];
const int time = recipe_dictionary::get_uncraft( it.typeId() ).time;
time_to_disassemble += time;
Expand All @@ -9485,7 +9485,7 @@ void game::butcher()
}
if( salvageables.size() > 1 ) {
int time_to_salvage = 0;
for( const auto stack : salvage_stacks ) {
for( const auto &stack : salvage_stacks ) {
const item &it = items[ stack.first ];
time_to_salvage += salvage_iuse->time_to_cut_up( it ) * stack.second;
}
Expand Down
2 changes: 1 addition & 1 deletion src/mondeath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void mdeath::splatter( monster &z )
if( pulverized && gibbable ) {
float overflow_ratio = overflow_damage / max_hp + 1;
int gib_distance = round( rng( 2, 4 ) );
for( const auto entry : *z.type->harvest ) {
for( const auto &entry : *z.type->harvest ) {
// only flesh and bones survive.
if( entry.type == "flesh" || entry.type == "bone" ) {
// the larger the overflow damage, the less you get
Expand Down

0 comments on commit bf87ac0

Please sign in to comment.