Files
Satisfactory/calculator/Recipe.cpp

21 lines
501 B
C++

#include <exception>
#include <format>
#include <string>
#include "Recipe.h"
std::vector<std::pair<Product, float> > Recipe::Ingredients(float overclock)
{
if(overclock < 0.0f || overclock > 2.5f)
{
auto error = std::format("Invalid overclock of {:.2f}%.", (overclock * 100.0f));
throw std::invalid_argument(error);
}
std::vector<std::pair<Product, float> > rtn;
for(const auto &ingredient : ingredients)
rtn.push_back({ingredient.first, ingredient.second * overclock});
return rtn;
}