engine/calculators/source/CreateItemCalculator.cpp
// Determine how many items can be created, by dividing the weight of the
// component item by the weight of the creation item.

Determine how many items can be created, by dividing the weight of the
component item by the weight of the creation item.
Determine how many items can be created by dividing the weight of the component item by the weight of the creation item .
uint CreateItemCalculator::calc_quantity(ItemPtr creation_item, ItemPtr component_item)
{
  int quantity = 0;
  if (creation_item != nullptr && component_item != nullptr)
  {
    uint creation_weight_oz = creation_item->get_weight().get_weight();
    uint component_weight_oz = component_item->get_weight().get_weight();
    quantity = (component_weight_oz / creation_weight_oz);
    quantity = std::max<uint>(1, quantity);
  }
  return quantity;
}
uint CreateItemCalculator :: calc_quantity ( ItemPtr creation_item , ItemPtr component_item ) { int quantity = 0 ; if ( creation_item != nullptr && component_item != nullptr ) { uint creation_weight_oz = creation_item -> get_weight ( ) . get_weight ( ) ; uint component_weight_oz = component_item -> get_weight ( ) . get_weight ( ) ; quantity = ( component_weight_oz / creation_weight_oz ) ; quantity = std :: max < uint > ( 1 , quantity ) ; } return quantity ; }
Determine how many items can be created, by dividing the weight of the
component item by the weight of the creation item.
Determine how many items can be created by dividing the weight of the component item by the weight of the creation item .