QnD fix for drawing
( seen when joining cells touching only by one point )
This commit is contained in:
@@ -40,6 +40,38 @@ public class DirectionPosition
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
|
||||
// create a new DirectionPosition from this using one possible direction.
|
||||
DirectionPosition moveToAdjacentDirection()
|
||||
{
|
||||
short pointingdirection = 0;
|
||||
Position p = null;
|
||||
if (LabyModel.isFlagSet(direction,LabyModel.RIGHT))
|
||||
{
|
||||
p = new Position(position.getX() + 1, position.getY());
|
||||
pointingdirection |= LabyModel.LEFT;
|
||||
}
|
||||
else if (LabyModel.isFlagSet(direction,LabyModel.LEFT))
|
||||
{
|
||||
p = new Position(position.getX() -1 ,position.getY());
|
||||
pointingdirection |= LabyModel.RIGHT;
|
||||
}
|
||||
else if (LabyModel.isFlagSet(direction,LabyModel.UP))
|
||||
{
|
||||
p = new Position(position.getX(),position.getY() -1);
|
||||
pointingdirection |= LabyModel.DOWN;
|
||||
}
|
||||
else if (LabyModel.isFlagSet(direction,LabyModel.DOWN))
|
||||
{
|
||||
p = new Position(position.getX(),position.getY() + 1);
|
||||
pointingdirection |= LabyModel.UP;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = position;
|
||||
}
|
||||
|
||||
return new DirectionPosition((short) pointingdirection, p);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user