Skip to content

Commit

Permalink
Fixed an OptimalItem() Bug
Browse files Browse the repository at this point in the history
- Prevented the OptimalItem() method from highlighting an already maxed upgrade item.
  • Loading branch information
Cons-Cat committed Jan 28, 2020
1 parent a6c0e67 commit 8de975f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
Binary file modified Source/.vs/Source/v16/.suo
Binary file not shown.
Binary file modified Source/.vs/Source/v16/Server/sqlite3/storage.ide
Binary file not shown.
35 changes: 19 additions & 16 deletions Source/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -711,25 +711,28 @@ private uint OptimalItem()
// Do not consider upgrades for agents that do not exist.
if (agentCount[i].value > 0)
{
// Divide each Upgrade's price by its immediate income rate.
MassiveNumber calcNumber2 = new MassiveNumber();
calcNumber2.value = upgraPrice[i].value;
calcNumber2.echelon = upgraPrice[i].echelon;
if (upgraCount[i].value < 3)
{
// Divide each Upgrade's price by its immediate income rate.
MassiveNumber calcNumber2 = new MassiveNumber();
calcNumber2.value = upgraPrice[i].value;
calcNumber2.echelon = upgraPrice[i].echelon;

MassiveNumber UpgradeIncome = new MassiveNumber();
UpgradeIncome.value = agentCount[i].Mult(upgraIncomeMult[i] + 1, 1);
UpgradeIncome.UpdateEchelon();
MassiveNumber UpgradeIncome = new MassiveNumber();
UpgradeIncome.value = agentCount[i].Mult(upgraIncomeMult[i] + 1, 1);
UpgradeIncome.UpdateEchelon();

calcNumber2.value = UpgradeIncome.Div(upgraPrice[i].value, upgraPrice[i].echelon);
calcNumber2.UpdateEchelon();
calcNumber2.value = UpgradeIncome.Div(upgraPrice[i].value, upgraPrice[i].echelon);
calcNumber2.UpdateEchelon();

// If this is the shortest time to break even.
if (!calcNumber2.IsGreaterThan(tempNumber))
{
returnRow = i;
optimalIsAgent = false; // Side effect.
tempNumber.value = calcNumber2.value;
tempNumber.echelon = calcNumber2.echelon;
// If this is the shortest time to break even.
if (!calcNumber2.IsGreaterThan(tempNumber))
{
returnRow = i;
optimalIsAgent = false; // Side effect.
tempNumber.value = calcNumber2.value;
tempNumber.echelon = calcNumber2.echelon;
}
}
}
}
Expand Down
Binary file modified Source/bin/Debug/Source.exe
Binary file not shown.
Binary file modified Source/bin/Debug/Source.pdb
Binary file not shown.
Binary file modified Source/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary file not shown.
Binary file modified Source/obj/Debug/Source.csprojAssemblyReference.cache
Binary file not shown.
Binary file modified Source/obj/Debug/Source.exe
Binary file not shown.
Binary file modified Source/obj/Debug/Source.pdb
Binary file not shown.

0 comments on commit 8de975f

Please sign in to comment.