Skip to content

Commit

Permalink
Refactor ActionUpdater
Browse files Browse the repository at this point in the history
Removed `break` statements in `ActionCondition.cs` and directly returned `false` if conditions are not met. Changed `NextGCDActionChanged` and `NextActionChanged` events in `ActionUpdater.cs` from nullable `Action<uint>?` to non-nullable `Action<uint>` with default empty delegates to avoid null reference issues.
  • Loading branch information
LTS-FFXIV committed Oct 19, 2024
1 parent 8a228b3 commit 09a337e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ protected override bool IsTrueInside(ICustomRotation rotation)
break;
case ActionConditionType.CanUse:
return _action.CanUse(out var act);
break;

}
return false;
}
Expand Down
11 changes: 6 additions & 5 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ static ActionUpdater() {
EzIPC.Init(typeof(ActionUpdater), "RotationSolverReborn.ActionUpdater");
}

[EzIPCEvent] public static Action<uint>? NextGCDActionChanged;
[EzIPCEvent] public static Action<uint>? NextActionChanged;
[EzIPCEvent] public static Action<uint> NextGCDActionChanged = delegate { };
[EzIPCEvent] public static Action<uint> NextActionChanged = delegate { };

private static IAction? _nextAction;
internal static IAction? NextAction
internal static IAction? NextAction
{
get => _nextAction;
set {
if (_nextAction != value)
set
{
if (_nextAction != value)
{
_nextAction = value;
NextActionChanged?.Invoke(_nextAction?.ID ?? 0);
Expand Down

0 comments on commit 09a337e

Please sign in to comment.