А теперь одень очки и посмотри:
Код:
public PathFind(int x, int y, int z, int destX, int destY, int destZ, L2Object obj, int refIndex)
{
this.refIndex = refIndex;
Location startpoint = Config.PATHFIND_BOOST == 0 ? new Location(x, y, z) : GeoEngine.moveCheckWithCollision(x, y, z, destX, destY, true, refIndex);
Location native_endpoint = new Location(destX, destY, destZ);
Location endpoint = Config.PATHFIND_BOOST != 2 || Math.abs(destZ - z) > 200 ? native_endpoint.clone() : GeoEngine.moveCheckBackwardWithCollision(destX, destY, destZ, startpoint.x, startpoint.y, true, refIndex);
startpoint.world2geo();
native_endpoint.world2geo();
endpoint.world2geo();
startpoint.z = GeoEngine.NgetHeight(startpoint.x, startpoint.y, startpoint.z, refIndex);
endpoint.z = GeoEngine.NgetHeight(endpoint.x, endpoint.y, endpoint.z, refIndex);
int xdiff = Math.abs(endpoint.x - startpoint.x);
int ydiff = Math.abs(endpoint.y - startpoint.y);
if(xdiff == 0 && ydiff == 0)
{
if(Math.abs(endpoint.z - startpoint.z) < 32)
{
path = new ArrayList<Location>();
path.add(0, startpoint);
}
return;
}
if((buff = PathFindBuffers.alloc(64 + 2 * Math.max(xdiff, ydiff), obj.isPlayable(), startpoint, endpoint, native_endpoint)) != null)
{
if(Config.PATHFIND_DEBUG && obj.isPlayer() && ((L2Player) obj).isGM())
{
if(debugItems != null)
{
for(L2ItemInstance item : debugItems)
item.deleteMe();
debugItems.clear();
}
custom_debug = true;
}
path = findPath();
if(Config.GEODATA_DEBUG && obj.isPlayer())
debugPath((L2Player) obj, buff, path); // TODO дебаг не для лайва!
buff.free();
if(obj.isNpc())
{
L2NpcInstance npc = (L2NpcInstance) obj;
npc.pathfindCount++;
npc.pathfindTime += (System.nanoTime() - buff.useStartedNanos) / 1000000.0;
}
}
}
path = findPath(); вызывается перед тем как debugPath((L2Player) obj, buff, path); // TODO дебаг не для лайва!
собственно весь процесс описанный мною происходит при вызове первого!!!