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

Fix extension cords falling off when items are turned on #74268

Merged
merged 4 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ item &item::convert( const itype_id &new_type, Character *carrier )
}

item_counter = 0;
update_link_traits();
update_prefix_suffix_flags();
return *this;
}
Expand Down
6 changes: 4 additions & 2 deletions src/item_contents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,8 @@ void item_contents::combine( const item_contents &read_input, const bool convert
auto current_pocket_iter = contents.begin();
std::advance( current_pocket_iter, pocket_index );

if( !current_pocket_iter->is_type( pocket.saved_type() ) ) {
if( !current_pocket_iter->is_type( convert ? pocket.get_pocket_data()->type :
pocket.saved_type() ) ) {
mismatched_pockets.push_back( pocket );
continue;
}
Expand Down Expand Up @@ -750,8 +751,9 @@ void item_contents::combine( const item_contents &read_input, const bool convert
}

for( const item_pocket &pocket : mismatched_pockets ) {
const pocket_type mismatched_type = convert ? pocket.get_pocket_data()->type : pocket.saved_type();
for( const item *it : pocket.all_items_top() ) {
const ret_val<item *> inserted = insert_item( *it, pocket.saved_type(), ignore_contents );
const ret_val<item *> inserted = insert_item( *it, mismatched_type, ignore_contents );
if( !inserted.success() ) {
uninserted_items.push_back( *it );
debugmsg( "error: item %s cannot fit into any pocket while loading: %s",
Expand Down
Loading