Revert unnecessary changes made by previous PR to SolutionCompon… (#583)

#574 added an out arg to `SolutionComponent.TryRemoveSolution` containing the solution that was removed. I made this change since I thought there was no way to get the removed solution for further use. Didn't notice `SplitSolution` which provides nearly the same behavior. With this PR I want to remove that out arg from `TryRemoveSolution` to keep the SolutionComponent API simple and to avoid having multiple ways of doing things. Existing code uses `SplitSolution`, I just wasn't paying attention.

Feel free to deny merging this if I'm over thinking it. I think it'll help keep solution code from becoming a mess.
This commit is contained in:
moneyl
2020-02-06 10:13:32 -05:00
committed by GitHub
parent 184f2fb68d
commit 6a1d2124df
4 changed files with 9 additions and 32 deletions

View File

@@ -141,14 +141,11 @@ namespace Content.Tests.Shared.Chemistry
{
var solution = new Solution("water", 700);
solution.RemoveSolution(500, out var removedSolution);
solution.RemoveSolution(500);
//Check that edited solution is correct
Assert.That(solution.GetReagentQuantity("water"), Is.EqualTo(200));
Assert.That(solution.TotalVolume, Is.EqualTo(200));
//Check that removed solution is correct
Assert.That(removedSolution.GetReagentQuantity("water"), Is.EqualTo(500));
Assert.That(removedSolution.TotalVolume, Is.EqualTo(500));
}
[Test]
@@ -156,14 +153,11 @@ namespace Content.Tests.Shared.Chemistry
{
var solution = new Solution("water", 800);
solution.RemoveSolution(1000, out var removedSolution);
solution.RemoveSolution(1000);
//Check that edited solution is correct
Assert.That(solution.GetReagentQuantity("water"), Is.EqualTo(0));
Assert.That(solution.TotalVolume, Is.EqualTo(0));
//Check that removed solution is correct
Assert.That(removedSolution.GetReagentQuantity("water"), Is.EqualTo(800));
Assert.That(removedSolution.TotalVolume, Is.EqualTo(800));
}
[Test]
@@ -173,15 +167,11 @@ namespace Content.Tests.Shared.Chemistry
solution.AddReagent("water", 1000);
solution.AddReagent("fire", 2000);
solution.RemoveSolution(1500, out var removedSolution);
solution.RemoveSolution(1500);
Assert.That(solution.GetReagentQuantity("water"), Is.EqualTo(500));
Assert.That(solution.GetReagentQuantity("fire"), Is.EqualTo(1000));
Assert.That(solution.TotalVolume, Is.EqualTo(1500));
Assert.That(removedSolution.GetReagentQuantity("water"), Is.EqualTo(500));
Assert.That(removedSolution.GetReagentQuantity("fire"), Is.EqualTo(1000));
Assert.That(removedSolution.TotalVolume, Is.EqualTo(1500));
}
[Test]
@@ -189,13 +179,10 @@ namespace Content.Tests.Shared.Chemistry
{
var solution = new Solution("water", 800);
solution.RemoveSolution(-200, out var removedSolution);
solution.RemoveSolution(-200);
Assert.That(solution.GetReagentQuantity("water"), Is.EqualTo(800));
Assert.That(solution.TotalVolume, Is.EqualTo(800));
Assert.That(removedSolution.GetReagentQuantity("water"), Is.EqualTo(0));
Assert.That(removedSolution.TotalVolume, Is.EqualTo(0));
}
[Test]