From 8f13d9295c0722148c6e18ffbecbf139efbbaba7 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Fri, 27 Dec 2019 16:11:46 +0400 Subject: [PATCH] Remove redundant checks --- core/src/com/me/pacman/entity/Ghost.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/com/me/pacman/entity/Ghost.java b/core/src/com/me/pacman/entity/Ghost.java index 469b706..666bf70 100644 --- a/core/src/com/me/pacman/entity/Ghost.java +++ b/core/src/com/me/pacman/entity/Ghost.java @@ -84,16 +84,14 @@ public class Ghost extends MovableEntity { } if (currentPath != null) { + if (!currentPath.finished()) { + return; + } + if (currentPath instanceof EnterGhostHousePath) { - if (!currentPath.finished()) { - return; - } currentPath = new ExitGhostHousePath(pos); returned = true; } else if (currentPath instanceof ExitGhostHousePath) { - if (!currentPath.finished()) { - return; - } speed = GHOST_SPEED; currentBehaviour = chaseBehaviour; currentPath = null;