Package com.l2jfrozen.gameserver.geo.pathfinding

Examples of com.l2jfrozen.gameserver.geo.pathfinding.Node


   * @return NSWE: 0-15
   */
  @Override
  public Node[] getNeighbors(Node n)
  {
    Node newNode;
    int x = n.getNodeX();
    int y = n.getNodeY();
    int parentdirection = 0;
    if(n.getParent() != null) // check for not adding parent again
    {
View Full Code Here


    while(pos != 1)
    {
      int p2 = pos / 2;
      if(_list[pos].getCost() <= _list[p2].getCost())
      {
        Node temp = _list[p2];
        _list[p2] = _list[pos];
        _list[pos] = temp;
        pos = p2;
      }
      else
View Full Code Here

    }
  }

  public Node removeFirst()
  {
    Node first = _list[1];
    _list[1] = _list[_size];
    _list[_size] = null;
    _size--;
    int pos = 1;
    int cpos;
    int dblcpos;
    Node temp;
    while(true)
    {
      cpos = pos;
      dblcpos = cpos * 2;
      if((dblcpos + 1) <= _size)
View Full Code Here

    short gz = (short) z;
    int gtx = tx - L2World.MAP_MIN_X >> 4;
    int gty = ty - L2World.MAP_MIN_Y >> 4;
    short gtz = (short) tz;

    Node start = readNode(gx, gy, gz);
    Node end = readNode(gtx, gty, gtz);
    if(start == null || end == null)
      return null;
    if(Math.abs(start.getZ() - z) > 55)
      return null; // not correct layer
    if(Math.abs(end.getZ() - tz) > 55)
      return null; // not correct layer
    if(start.equals(end))
      return null;
    // TODO: Find closest path node we CAN access. Now only checks if we can not reach the closest
    Location temp = GeoData.getInstance().moveCheck(x, y, z, start.getX(), start.getY(), start.getZ());
    if(temp.getX() != start.getX() || temp.getY() != start.getY())
      return null; //   cannot reach closest...

    // TODO: Find closest path node around target, now only checks if final location can be reached
    temp = GeoData.getInstance().moveCheck(tx, ty, tz, end.getX(), end.getY(), end.getZ());
    if(temp.getX() != end.getX() || temp.getY() != end.getY())
      return null; //   cannot reach closest...

    //return searchAStar(start, end);
    return searchByClosest2(start, end);
  }
View Full Code Here

    short regoffset = getRegionOffset(getRegionX(node_x), getRegionY(node_y));
    ByteBuffer pn = _pathNodes.get(regoffset);

    Node[] Neighbors = new Node[8];
    int index = 0;
    Node newNode;
    short new_node_x, new_node_y;

    //Region for sure will change, we must read from correct file
    byte neighbor = pn.get(idx++); //N
    if(neighbor > 0)
View Full Code Here

    int gtx = tx - L2World.MAP_MIN_X >> 4;
    int gty = ty - L2World.MAP_MIN_Y >> 4;
    if(!GeoData.getInstance().hasGeo(tx, ty))
      return null;
    short gtz = GeoData.getInstance().getHeight(tx, ty, tz);
    Node start = readNode(gx, gy, gz);
    Node end = readNode(gtx, gty, gtz);
    return searchByClosest(start, end);
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.geo.pathfinding.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.