Rearrange to put the common case at the top

This commit is contained in:
Tony Garnock-Jones 2023-10-28 16:27:51 +02:00
parent 636da3f28f
commit 6904ef76df
1 changed files with 5 additions and 5 deletions

View File

@ -43,10 +43,7 @@ public class Turn {
}
private void commit() {
if (_pending != null) {
_pending.forEach((ac, q) -> ac.execute(() -> Turn.forActor(ac, t -> q.forEach(f -> f.accept(t)))));
_pending = null;
} else if (_pendingTarget != null) {
if (_pendingTarget != null) {
var ac = _pendingTarget;
Consumer<Turn> q0 = _pending0, q1 = _pending1, q2 = _pending2;
_pendingTarget = null;
@ -56,7 +53,10 @@ public class Turn {
if (q1 != null) q1.accept(t);
if (q2 != null) q2.accept(t);
}));
}
} else if (_pending != null) {
_pending.forEach((ac, q) -> ac.execute(() -> Turn.forActor(ac, t -> q.forEach(f -> f.accept(t)))));
_pending = null;
}
}
private void enqueue(Actor target, Consumer<Turn> action) {