Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent copying in range-based loops #40110

Merged
merged 1 commit into from
May 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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