Skip to content

Commit

Permalink
Use move semantics in profession::items() (CleverRaven#55127)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong authored Feb 6, 2022
1 parent 3999b5e commit 54ca282
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/profession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,14 @@ std::list<item> profession::items( bool male, const std::vector<trait_id> &trait
add_legacy_items( legacy_starting_items );
add_legacy_items( male ? legacy_starting_items_male : legacy_starting_items_female );

const std::vector<item> group_both = item_group::items_from( _starting_items,
advanced_spawn_time() );
const std::vector<item> group_gender = item_group::items_from( male ? _starting_items_male :
_starting_items_female, advanced_spawn_time() );
result.insert( result.begin(), group_both.begin(), group_both.end() );
result.insert( result.begin(), group_gender.begin(), group_gender.end() );
std::vector<item> group_both = item_group::items_from( _starting_items,
advanced_spawn_time() );
std::vector<item> group_gender = item_group::items_from( male ? _starting_items_male :
_starting_items_female, advanced_spawn_time() );
result.insert( result.begin(), std::make_move_iterator( group_both.begin() ),
std::make_move_iterator( group_both.end() ) );
result.insert( result.begin(), std::make_move_iterator( group_gender.begin() ),
std::make_move_iterator( group_gender.end() ) );

if( !has_flag( "NO_BONUS_ITEMS" ) ) {
const std::vector<item> &items = item_substitutions.get_bonus_items( traits );
Expand Down

0 comments on commit 54ca282

Please sign in to comment.