v0.9.0: fixed a race condition when 'now' is read as it is being updated
This commit is contained in:
parent
c273f30f72
commit
fe23143d0e
|
@ -215,14 +215,14 @@ public abstract class Actor implements Bundlable {
|
||||||
|
|
||||||
current = null;
|
current = null;
|
||||||
if (!interrupted) {
|
if (!interrupted) {
|
||||||
now = Float.MAX_VALUE;
|
float earliest = Float.MAX_VALUE;
|
||||||
|
|
||||||
for (Actor actor : all) {
|
for (Actor actor : all) {
|
||||||
|
|
||||||
//some actors will always go before others if time is equal.
|
//some actors will always go before others if time is equal.
|
||||||
if (actor.time < now ||
|
if (actor.time < earliest ||
|
||||||
actor.time == now && (current == null || actor.actPriority > current.actPriority)) {
|
actor.time == earliest && (current == null || actor.actPriority > current.actPriority)) {
|
||||||
now = actor.time;
|
earliest = actor.time;
|
||||||
current = actor;
|
current = actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ public abstract class Actor implements Bundlable {
|
||||||
|
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
|
|
||||||
|
now = current.time;
|
||||||
Actor acting = current;
|
Actor acting = current;
|
||||||
|
|
||||||
if (acting instanceof Char && ((Char) acting).sprite != null) {
|
if (acting instanceof Char && ((Char) acting).sprite != null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user