Skip to content

Commit

Permalink
Round up in the launch product recipes when calculating input size
Browse files Browse the repository at this point in the history
This prevents it from being set to zero and resulting in invalid
recipe. Fixes DanielKote#76
  • Loading branch information
klao committed Oct 27, 2023
1 parent ef44a9c commit 0743cec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Foreman/DataCache/DataCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ private void ProcessRocketLaunch(JToken objJToken)
if (amount != 0)
{
if (inputSize * amount > product.StackSize)
inputSize = (int)(product.StackSize / amount);
inputSize = (int)Math.Ceiling(product.StackSize / amount);

amount = inputSize * amount;

Expand Down
2 changes: 1 addition & 1 deletion Foreman/DataCache/PresetProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ private static async Task<PresetErrorPackage> TestPresetStreamlined(Preset prese
double amount = (double)productJToken["amount"];
int productStack = (int)(jsonData["items"].First(t => (string)t["name"] == (string)productJToken["name"])["stack"]?? 1);
if (amount != 0 && inputSize * amount > productStack)
inputSize = (int)(productStack / amount);
inputSize = (int)Math.Ceiling(productStack / amount);
}
foreach (var productJToken in objJToken["launch_products"])
{
Expand Down

0 comments on commit 0743cec

Please sign in to comment.