Skip to content

Commit 736c523

Browse files
authored
fix(#419): Products after a fluid did not link correctly. (#420)
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.
2 parents a4e0ae0 + 1fdabad commit 736c523

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Yafc.Model/Model/ProductionTableContent.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ IEnumerable<RecipeRowIngredient> @internal() {
461461

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

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

484-
foreach (Product product in recipe.target.products) {
483+
for (int i = 0; i < recipe.target.products.Length; i++) {
484+
Product product = recipe.target.products[i];
485+
485486
if (hierarchyEnabled) {
486487
Quality quality = recipe.quality;
487488
float baseAmount = product.GetAmountPerRecipe(parameters.productivity);
@@ -504,8 +505,6 @@ private IEnumerable<RecipeRowProduct> BuildProducts(bool forSolver) {
504505
}
505506
quality = quality.nextQuality!;
506507
}
507-
508-
i++;
509508
}
510509
}
511510
else {

changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
// Internal changes:
1616
// Changes to the code that do not affect the behavior of the program.
1717
----------------------------------------------------------------------------------------------------------------------
18+
Version:
19+
Date:
20+
Fixes:
21+
- (regression) Links for recipes with fluid outputs were not handled correctly.
22+
----------------------------------------------------------------------------------------------------------------------
1823
Version: 2.8.0
1924
Date: February 19th 2025
2025
Features:

0 commit comments

Comments
 (0)