Removal of FastNodeList implementation.
This commit is contained in:
parent
8658f3a75d
commit
0b38c9f724
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
|
||||
@ -113,7 +112,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -151,7 +150,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
|
||||
@ -113,7 +112,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -151,7 +150,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
|
||||
@ -113,7 +112,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -151,7 +150,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
|
||||
@ -113,7 +112,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -151,7 +150,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
|
||||
@ -113,7 +112,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -151,7 +150,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding;
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.utils.FastNodeList;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
@ -114,7 +113,7 @@ public class GeoPathFinding extends PathFinding
|
||||
// load) level of intelligence though.
|
||||
|
||||
// List of Visited Nodes.
|
||||
final FastNodeList visited = new FastNodeList(550);
|
||||
final List<GeoNode> visited = new ArrayList<>(550);
|
||||
|
||||
// List of Nodes to Visit.
|
||||
final LinkedList<GeoNode> toVisit = new LinkedList<>();
|
||||
@ -152,7 +151,7 @@ public class GeoPathFinding extends PathFinding
|
||||
}
|
||||
for (GeoNode n : neighbors)
|
||||
{
|
||||
if (!visited.containsRev(n) && !toVisit.contains(n))
|
||||
if ((visited.lastIndexOf(n) == -1) && !toVisit.contains(n))
|
||||
{
|
||||
added = false;
|
||||
n.setParent(node);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.geoengine.pathfinding.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNode;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FastNodeList
|
||||
{
|
||||
private final ArrayList<AbstractNode<?>> _list;
|
||||
|
||||
public FastNodeList(int size)
|
||||
{
|
||||
_list = new ArrayList<>(size);
|
||||
}
|
||||
|
||||
public void add(AbstractNode<?> n)
|
||||
{
|
||||
_list.add(n);
|
||||
}
|
||||
|
||||
public boolean contains(AbstractNode<?> n)
|
||||
{
|
||||
return _list.contains(n);
|
||||
}
|
||||
|
||||
public boolean containsRev(AbstractNode<?> n)
|
||||
{
|
||||
return _list.lastIndexOf(n) != -1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user