Use fixed point arithmetic for progress/quality

This commit is contained in:
Asriel Camora
2023-11-04 11:43:34 -07:00
parent 9ca83bfe23
commit d08fedb247
23 changed files with 44 additions and 42 deletions
+3 -1
View File
@@ -49,6 +49,8 @@ public struct ActionSet
static ActionSet()
{
AcceptedActionsLUT = new int[Enum.GetValues<ActionType>().Length];
for (var i = 0; i < AcceptedActionsLUT.Length; i++)
AcceptedActionsLUT[i] = -1;
for (var i = 0; i < AcceptedActions.Length; i++)
AcceptedActionsLUT[(byte)AcceptedActions[i]] = i;
}
@@ -57,7 +59,7 @@ public struct ActionSet
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int FromAction(ActionType action)
{
var ret = Simulator.AcceptedActionsLUT[(byte)action];
var ret = AcceptedActionsLUT[(byte)action];
if (ret == -1)
throw new ArgumentOutOfRangeException(nameof(action), action, $"Action {action} is unsupported in {nameof(ActionSet)}.");
return ret;