Crash fix.
This commit is contained in:
@@ -7,6 +7,7 @@ package org.dyndns.vahagn.sokoban.play;
|
|||||||
import static java.lang.Math.*;
|
import static java.lang.Math.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import org.dyndns.vahagn.sokoban.Puzzle;
|
import org.dyndns.vahagn.sokoban.Puzzle;
|
||||||
|
import static org.dyndns.vahagn.sokoban.App.TAG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -29,7 +30,7 @@ public class PuzzleLogic
|
|||||||
setOfCells = new int[2*puzzle.getColumnCount()*puzzle.getRowCount()];
|
setOfCells = new int[2*puzzle.getColumnCount()*puzzle.getRowCount()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean createSteps(Animator animator, int x, int y )
|
public boolean createSteps(Animator animator, final int x, final int y )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Check that the x,y are valid.
|
// Check that the x,y are valid.
|
||||||
@@ -300,7 +301,8 @@ public class PuzzleLogic
|
|||||||
// Move the worker to the direction. If we cannot move worker
|
// Move the worker to the direction. If we cannot move worker
|
||||||
// next to the box then we cannot select it.
|
// next to the box then we cannot select it.
|
||||||
//
|
//
|
||||||
if ( !tryMoveWorker(animator, pref_x, pref_y) )
|
if ( !puzzle.isValid(pref_x, pref_y)
|
||||||
|
|| !tryMoveWorker(animator, pref_x, pref_y) )
|
||||||
return false;
|
return false;
|
||||||
//
|
//
|
||||||
// Select the box.
|
// Select the box.
|
||||||
@@ -440,7 +442,7 @@ public class PuzzleLogic
|
|||||||
|
|
||||||
public final boolean isAccessible( int x, int y )
|
public final boolean isAccessible( int x, int y )
|
||||||
{
|
{
|
||||||
return stepsAway(x, y) != Integer.MAX_VALUE;
|
return puzzle.isValid(x, y) && stepsAway(x, y) != Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int [] getDirections( int x, int y )
|
public int [] getDirections( int x, int y )
|
||||||
|
|||||||
Reference in New Issue
Block a user