{
d += delta_B;
next_x += inc_x;
tempz = nCanMoveNext(x, y, (int) z, next_x, next_y, tz);
if(tempz == Double.MIN_VALUE)
return new Location((x << 4) + L2World.MAP_MIN_X, (y << 4) + L2World.MAP_MIN_Y, (int) z);
z = tempz;
next_y += inc_y;
//_log.warning("2: next_x:"+next_x+" next_y"+next_y);
tempz = nCanMoveNext(next_x, y, (int) z, next_x, next_y, tz);
if(tempz == Double.MIN_VALUE)
return new Location((x << 4) + L2World.MAP_MIN_X, (y << 4) + L2World.MAP_MIN_Y, (int) z);
z = tempz;
}
else
{
d += delta_A;
next_x += inc_x;
//_log.warning("3: next_x:"+next_x+" next_y"+next_y);
tempz = nCanMoveNext(x, y, (int) z, next_x, next_y, tz);
if(tempz == Double.MIN_VALUE)
return new Location((x << 4) + L2World.MAP_MIN_X, (y << 4) + L2World.MAP_MIN_Y, (int) z);
z = tempz;
}
}
}
else
{
int delta_A = 2 * dx;
int d = delta_A - dy;
int delta_B = delta_A - 2 * dy;
for(int i = 0; i < dy; i++)
{
x = next_x;
y = next_y;
if(d > 0)
{
d += delta_B;
next_y += inc_y;
tempz = nCanMoveNext(x, y, (int) z, next_x, next_y, tz);
if(tempz == Double.MIN_VALUE)
return new Location((x << 4) + L2World.MAP_MIN_X, (y << 4) + L2World.MAP_MIN_Y, (int) z);
z = tempz;
next_x += inc_x;
//_log.warning("5: next_x:"+next_x+" next_y"+next_y);
tempz = nCanMoveNext(x, next_y, (int) z, next_x, next_y, tz);
if(tempz == Double.MIN_VALUE)
return new Location((x << 4) + L2World.MAP_MIN_X, (y << 4) + L2World.MAP_MIN_Y, (int) z);
z = tempz;
}
else
{
d += delta_A;
next_y += inc_y;
//_log.warning("6: next_x:"+next_x+" next_y"+next_y);
tempz = nCanMoveNext(x, y, (int) z, next_x, next_y, tz);
if(tempz == Double.MIN_VALUE)
return new Location((x << 4) + L2World.MAP_MIN_X, (y << 4) + L2World.MAP_MIN_Y, (int) z);
z = tempz;
}
}
}
if(z == startpoint.getZ()) // geodata hasn't modified Z in any coordinate, i.e. doesn't exist
return destiny;
return new Location(destiny.getX(), destiny.getY(), (int) z);
}