diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java index ffcdaf8a0..190de920d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java @@ -204,8 +204,11 @@ public abstract class Actor implements Bundlable { // If it's character's turn to act, but its sprite // is moving, wait till the movement is over try { - synchronized (((Char)acting).sprite) { - ((Char) acting).sprite.wait(); + //yes, we're busy-waiting. This is insignificantly slower than using + //a lock/semaphore but results in more readable code. + while (((Char)acting).sprite.isMoving) { + //tries every ~0.1 milliseconds + Thread.sleep(0, 100000); } } catch (InterruptedException e) { ShatteredPixelDungeon.reportException(e); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 26db8c256..5c40b4b93 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -453,14 +453,11 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } else if (tweener == motion) { - isMoving = false; - synchronized (this){ - notify(); - } - motion.killAndErase(); motion = null; ch.onMotionComplete(); + + isMoving = false; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java index eb455a25a..6b921952f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java @@ -102,11 +102,8 @@ public class TenguSprite extends MobSprite { @Override public void onComplete( Animation anim ) { if (anim == run) { - isMoving = false; - synchronized (this){ - notify(); - } idle(); + isMoving = false; } else { super.onComplete( anim ); }