diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2012-06-04 13:01:20 -0400 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2012-06-04 13:01:20 -0400 |
commit | ce7c2b7b69ab2e689f73a6d082c643c5c6b8d9a4 (patch) | |
tree | 1415b3bc7e60982a44fa5453f920980d893e788c /src/com | |
parent | ff100d50d611db8ae0541e67c652c7cfe63c3d1c (diff) | |
download | frigidearth-ce7c2b7b69ab2e689f73a6d082c643c5c6b8d9a4.tar.gz frigidearth-ce7c2b7b69ab2e689f73a6d082c643c5c6b8d9a4.tar.bz2 frigidearth-ce7c2b7b69ab2e689f73a6d082c643c5c6b8d9a4.zip |
Fixed bug where mice would move onto positions in use by other mobs
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/fourisland/frigidearth/MapViewGameState.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index 64ac2de..62fc632 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java | |||
@@ -899,8 +899,21 @@ public class MapViewGameState implements GameState | |||
899 | Point to = toDir.to(mob.getPosition()); | 899 | Point to = toDir.to(mob.getPosition()); |
900 | if ((isValidPosition(to.x,to.y)) && (!grid[to.x][to.y].isBlocked()) && (!to.equals(new Point(playerx, playery)))) | 900 | if ((isValidPosition(to.x,to.y)) && (!grid[to.x][to.y].isBlocked()) && (!to.equals(new Point(playerx, playery)))) |
901 | { | 901 | { |
902 | mob.moveInDirection(toDir); | 902 | boolean found = false; |
903 | break; | 903 | for (Mob m : mobs) |
904 | { | ||
905 | if (m.getPosition().equals(to)) | ||
906 | { | ||
907 | found = true; | ||
908 | break; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | if (!found) | ||
913 | { | ||
914 | mob.moveInDirection(toDir); | ||
915 | break; | ||
916 | } | ||
904 | } | 917 | } |
905 | } | 918 | } |
906 | } | 919 | } |