Skip to content

Commit

Permalink
fix(#419): Products after a fluid did not link correctly. (#420)
Browse files Browse the repository at this point in the history
Fluid products caused subsequent products to display the wrong link
information. Moving the `i++` out one set of curlies fixed things in
Simon's sample, and then I looked at it and realized it should just be a
for loop, rather than a foreach-with-counter loop.
  • Loading branch information
shpaass authored Feb 20, 2025
2 parents a4e0ae0 + 1fdabad commit 736c523
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Yafc.Model/Model/ProductionTableContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ IEnumerable<RecipeRowIngredient> @internal() {

private IEnumerable<RecipeRowProduct> BuildProducts(bool forSolver) {
float factor = forSolver ? 1 : (float)recipesPerSecond; // recipesPerSecond can be 0 when running the solver, which would create useless results.
int i = 0;
IObjectWithQuality<Item>? spentFuel = fuel.FuelResult();
bool handledFuel = spentFuel == null || forSolver; // If we're running the solver or there's no spent fuel, it's already handled.

Expand All @@ -481,7 +480,9 @@ private IEnumerable<RecipeRowProduct> BuildProducts(bool forSolver) {
}
}

foreach (Product product in recipe.target.products) {
for (int i = 0; i < recipe.target.products.Length; i++) {
Product product = recipe.target.products[i];

if (hierarchyEnabled) {
Quality quality = recipe.quality;
float baseAmount = product.GetAmountPerRecipe(parameters.productivity);
Expand All @@ -504,8 +505,6 @@ private IEnumerable<RecipeRowProduct> BuildProducts(bool forSolver) {
}
quality = quality.nextQuality!;
}

i++;
}
}
else {
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
// Internal changes:
// Changes to the code that do not affect the behavior of the program.
----------------------------------------------------------------------------------------------------------------------
Version:
Date:
Fixes:
- (regression) Links for recipes with fluid outputs were not handled correctly.
----------------------------------------------------------------------------------------------------------------------
Version: 2.8.0
Date: February 19th 2025
Features:
Expand Down

0 comments on commit 736c523

Please sign in to comment.