add findShipDef/findModuleDef/findRecipeDef to config structs and re-use them in the rest of the code base
This commit is contained in:
@@ -12,15 +12,6 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
const RecipeDef* findRecipe(const RecipesConfig& recipes, const std::string& id)
|
||||
{
|
||||
for (const RecipeDef& recipe : recipes.recipes)
|
||||
{
|
||||
if (recipe.id == id) { return &recipe; }
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString grantKindLabel(SchematicType type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -120,7 +111,7 @@ SchematicChoiceDialog::SchematicChoiceDialog(
|
||||
QLabel* recipeLabel = new QLabel(
|
||||
QString::fromStdString(toDisplayName(recipeId)), card);
|
||||
recipeLabel->setAlignment(Qt::AlignCenter);
|
||||
if (const RecipeDef* def = findRecipe(recipes, recipeId))
|
||||
if (const RecipeDef* def = recipes.findRecipeDef(recipeId))
|
||||
{
|
||||
recipeLabel->setToolTip(buildRecipeTooltip(*def));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user