Skip to content

Commit

Permalink
Prevent copying in range-based loops
Browse files Browse the repository at this point in the history
  • Loading branch information
anothersimulacrum authored and kevingranade committed May 3, 2020
1 parent 34906bd commit 1a517a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2425,7 +2425,7 @@ void Character::add_bionic( const bionic_id &b )
add_bionic( inc_bid );
}

for( const std::pair<spell_id, int> spell_pair : b->learned_spells ) {
for( const std::pair<const spell_id, int> &spell_pair : b->learned_spells ) {
const spell_id learned_spell = spell_pair.first;
if( learned_spell->spell_class != trait_id( "NONE" ) ) {
const trait_id spell_class = learned_spell->spell_class;
Expand Down Expand Up @@ -2469,15 +2469,15 @@ void Character::remove_bionic( const bionic_id &b )
continue;
}

for( const std::pair<spell_id, int> &spell_pair : i.id->learned_spells ) {
for( const std::pair<const spell_id, int> &spell_pair : i.id->learned_spells ) {
cbm_spells.emplace( spell_pair.first );
}

new_my_bionics.push_back( bionic( i.id, i.invlet ) );
}

// any spells you learn from installing a bionic you forget.
for( const std::pair<spell_id, int> &spell_pair : b->learned_spells ) {
for( const std::pair<const spell_id, int> &spell_pair : b->learned_spells ) {
if( cbm_spells.count( spell_pair.first ) == 0 ) {
magic.forget_spell( spell_pair.first );
}
Expand Down

0 comments on commit 1a517a9

Please sign in to comment.