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

Fixed getting min/max drop values from deconstruction when modifier is NULL #75325

Merged
merged 3 commits into from
Aug 2, 2024
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
10 changes: 9 additions & 1 deletion src/item_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,15 @@ std::map<const itype *, std::pair<int, int>> Single_item_creator::every_item_min
i->charges_default() : modifier->charges.second;
return { std::make_pair( i, std::make_pair( modifier->count.first * min_charges, modifier->count.second * max_charges ) ) };
}
return { std::make_pair( i, modifier->count ) };

// since modifier is std::optional it might not be present
// if not - we return [0,1] if item has probability to spawn less than a hundred
// and [1,1] otherwise
if( modifier ) {
return { std::make_pair( i, modifier->count ) };
} else {
return { std::make_pair( i, std::make_pair( probability < 100 ? 0 : 1, 1 ) ) };
}
}
case S_ITEM_GROUP: {
Item_spawn_data *isd = item_controller->get_group( item_group_id( id ) );
Expand Down
Loading