Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One way to create a recipe was not using the correct comparer for fluids. #216

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Yafc.Model/Model/ProductionTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public bool Search(SearchQuery query) {
/// Add a recipe or technology to this table, and configure the crafter and fuel to reasonable values.
/// </summary>
/// <param name="recipe">The recipe or technology to add.</param>
/// <param name="ingredientVariantComparer">If not <see langword="null"/>, the comparer to use when deciding which fluid variants to use.</param>
/// <param name="ingredientVariantComparer">The comparer to use when deciding which fluid variants to use.</param>
/// <param name="selectedFuel">If not <see langword="null"/>, this method will select a crafter or lab that can use this fuel, assuming such an entity exists.
/// For example, if the selected fuel is coal, the recipe will be configured with a burner assembler/lab if any are available.</param>
public void AddRecipe(RecipeOrTechnology recipe, IComparer<Goods>? ingredientVariantComparer = null, Goods? selectedFuel = null) {
public void AddRecipe(RecipeOrTechnology recipe, IComparer<Goods> ingredientVariantComparer, Goods? selectedFuel = null) {
RecipeRow recipeRow = new RecipeRow(this, recipe);
this.RecordUndo().recipes.Add(recipeRow);
EntityCrafter? selectedFuelCrafter = selectedFuel?.fuelFor.OfType<EntityCrafter>().Where(e => e.recipes.Contains(recipe)).AutoSelect(DataUtils.FavoriteCrafter);
Expand Down
2 changes: 1 addition & 1 deletion Yafc/Workspace/ProductionTable/ProductionTableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ async void addRecipe(RecipeOrTechnology rec) {
}
}
if (!allRecipes.Contains(rec) || (await MessageBox.Show("Recipe already exists", $"Add a second copy of {rec.locName}?", "Add a copy", "Cancel")).choice) {
context.AddRecipe(rec, selectedFuel: selectedFuel);
context.AddRecipe(rec, DefaultVariantOrdering, selectedFuel);
}
}

Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
----------------------------------------------------------------------------------------------------------------------
Version x.y.z
Date:
Bugfixes:
- Fix regression in fluid variant selection when adding recipes.
----------------------------------------------------------------------------------------------------------------------
Version 0.7.5
Date: July 27th 2024
Features:
- Autofocus the project name field when you create a new project
- When opening the main window, use the same column widths as when it was last closed.
Expand Down