Skip to content

Commit

Permalink
fix: Construction Recipe check for components same as tool fixed. (#4514
Browse files Browse the repository at this point in the history
)

Adds additional check to check_enough_material.
  • Loading branch information
KheirFerrum authored Apr 22, 2024
1 parent d3cb640 commit a87e89a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/requirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,14 @@ bool requirement_data::check_enough_materials( const item_comp &comp, const inve
}
const int cnt = std::abs( comp.count ) * batch;
const tool_comp *tq = find_by_type( tools, comp.type );
if( tq != nullptr && tq->available == available_status::a_true ) {
// First check is that the use case is the same (soldering iron charges
// being used in tools but the item itself being used as a component)
// If it isn't count_by_charges() any loaded versions are not considered
// valid components
// Second check is just that the tool has been considered valid,
// so must be offset when you count how much is available.
if( tq != nullptr && comp.type->count_by_charges() == tq->by_charges() &&
tq->available == available_status::a_true ) {
// The very same item type is also needed as tool!
// Use charges of it, or use it by count?
const int tc = tq->by_charges() ? 1 : std::abs( tq->count );
Expand Down

0 comments on commit a87e89a

Please sign in to comment.