Rearrange to put the common case at the top
This commit is contained in:
parent
636da3f28f
commit
6904ef76df
|
@ -43,10 +43,7 @@ public class Turn {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void commit() {
|
private void commit() {
|
||||||
if (_pending != null) {
|
if (_pendingTarget != null) {
|
||||||
_pending.forEach((ac, q) -> ac.execute(() -> Turn.forActor(ac, t -> q.forEach(f -> f.accept(t)))));
|
|
||||||
_pending = null;
|
|
||||||
} else if (_pendingTarget != null) {
|
|
||||||
var ac = _pendingTarget;
|
var ac = _pendingTarget;
|
||||||
Consumer<Turn> q0 = _pending0, q1 = _pending1, q2 = _pending2;
|
Consumer<Turn> q0 = _pending0, q1 = _pending1, q2 = _pending2;
|
||||||
_pendingTarget = null;
|
_pendingTarget = null;
|
||||||
|
@ -56,6 +53,9 @@ public class Turn {
|
||||||
if (q1 != null) q1.accept(t);
|
if (q1 != null) q1.accept(t);
|
||||||
if (q2 != null) q2.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue