From 1a517a94b03d2830427626f251d9063acf2107d6 Mon Sep 17 00:00:00 2001 From: anothersimulacrum <42699974+anothersimulacrum@users.noreply.github.com> Date: Sun, 3 May 2020 15:35:23 -0700 Subject: [PATCH] Prevent copying in range-based loops --- src/bionics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bionics.cpp b/src/bionics.cpp index f0e1783b28dc3..c0e9567ed056e 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -2425,7 +2425,7 @@ void Character::add_bionic( const bionic_id &b ) add_bionic( inc_bid ); } - for( const std::pair spell_pair : b->learned_spells ) { + for( const std::pair &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; @@ -2469,7 +2469,7 @@ void Character::remove_bionic( const bionic_id &b ) continue; } - for( const std::pair &spell_pair : i.id->learned_spells ) { + for( const std::pair &spell_pair : i.id->learned_spells ) { cbm_spells.emplace( spell_pair.first ); } @@ -2477,7 +2477,7 @@ void Character::remove_bionic( const bionic_id &b ) } // any spells you learn from installing a bionic you forget. - for( const std::pair &spell_pair : b->learned_spells ) { + for( const std::pair &spell_pair : b->learned_spells ) { if( cbm_spells.count( spell_pair.first ) == 0 ) { magic.forget_spell( spell_pair.first ); }