Skip to content

Commit

Permalink
Fix #516, clone the location before adding random numbers willy-nilly.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Nov 7, 2013
1 parent d34808e commit a1f938c
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -52,7 +52,7 @@ public static Location getWalkableLocationNear(Location location, int range) {

int selected_x = random.nextInt(range * 2);
int selected_z = random.nextInt(range * 2);
returnable = location.add(selected_x - range, 1, selected_z - range);
returnable = location.clone().add(selected_x - range, 1, selected_z - range);

if (!isWalkable(returnable)) return getWalkableLocationNear(location, range);
else return returnable;
Expand Down

0 comments on commit a1f938c

Please sign in to comment.