Fix ActionPool bugs

This commit is contained in:
Asriel Camora
2024-02-29 01:10:42 -08:00
parent ecabc24517
commit 2c15b23f48
2 changed files with 28 additions and 18 deletions
+3 -1
View File
@@ -8,6 +8,7 @@ namespace Craftimizer.Solver;
internal sealed class Simulator : SimulatorNoRandom
{
public readonly ActionPool Pool;
private readonly ActionType[] poolActions;
private readonly int maxStepCount;
public override CompletionState CompletionState
@@ -24,6 +25,7 @@ internal sealed class Simulator : SimulatorNoRandom
public Simulator(in ActionPool pool, int maxStepCount)
{
Pool = pool;
poolActions = Pool.AcceptedActions;
this.maxStepCount = maxStepCount;
}
@@ -135,7 +137,7 @@ internal sealed class Simulator : SimulatorNoRandom
return new();
var ret = new ActionSet();
foreach (var action in Pool.AcceptedActions)
foreach (var action in poolActions)
if (CanUseAction(action, strict))
ret.AddAction(in Pool, action);
return ret;