/** * Adds an ingredient to a schematic slot. * * @param name the name of the slot * @param ingredientId the ingredient to add * @param amount amount of ingredient to add */ void ManufactureSchematicSynchronizedUi::addSlotIngredient(const StringId & name, const NetworkId & ingredientId, int amount) { int iter = m_slotName.find(name); if (iter >= 0) { // auto delta vector doesn't support sub-list updates, so we have to // re-write the entire list of ingredients NetworkIdList ingredients(m_slotIngredient.get(iter)); IntList counts(m_slotIngredientCount.get(iter)); ingredients.push_back(ingredientId); counts.push_back(amount); m_slotIngredient.set(iter, ingredients); m_slotIngredientCount.set(iter, counts); signalIngredientsChanged (); } } // ManufactureSchematicSynchronizedUi::addSlotIngredient
double Recipe::originalGravity() const { double originalGravity = 0; foreach(RecipeIngredient* ingredient, ingredients()) { GrainIngredient *grainIngredient = qobject_cast<GrainIngredient *>(ingredient->ingredient()); if(grainIngredient) { double specificGravity = (grainIngredient->specificGravity() - 1); specificGravity *= ingredient->quantity().valueToPound(); if(grainIngredient->extract()) { originalGravity += specificGravity; } else { originalGravity += specificGravity * efficiency(); } continue; } }