| 205 | |
| 206 | |
| 207 | const cFurnaceRecipe::Recipe * cFurnaceRecipe::GetRecipeFrom(const cItem & a_Ingredient) const |
| 208 | { |
| 209 | const Recipe * BestRecipe = 0; |
| 210 | for (RecipeList::const_iterator itr = m_pState->Recipes.begin(); itr != m_pState->Recipes.end(); ++itr) |
| 211 | { |
| 212 | const Recipe & R = *itr; |
| 213 | if ((R.In->m_ItemType == a_Ingredient.m_ItemType) && (R.In->m_ItemCount <= a_Ingredient.m_ItemCount)) |
| 214 | { |
| 215 | if (BestRecipe && (BestRecipe->In->m_ItemCount > R.In->m_ItemCount)) |
| 216 | { |
| 217 | continue; |
| 218 | } |
| 219 | else |
| 220 | { |
| 221 | BestRecipe = &R; |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | return BestRecipe; |
| 226 | } |
| 227 | |
| 228 | |
| 229 |
no test coverage detected