Sync with L2jServer HighFive Mar 25th 2015.

This commit is contained in:
MobiusDev
2015-03-25 06:48:51 +00:00
parent e0c66b1412
commit 82606870c0
194 changed files with 2619 additions and 2869 deletions

View File

@ -18,7 +18,8 @@
*/
package com.l2jserver.gameserver.pathfinding.cellnodes;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import com.l2jserver.Config;
@ -112,10 +113,9 @@ public class CellNodeBuffer
return _lastElapsedTime;
}
public final ArrayList<CellNode> debugPath()
public final List<CellNode> debugPath()
{
ArrayList<CellNode> result = new ArrayList<>();
final List<CellNode> result = new LinkedList<>();
for (CellNode n = _current; n.getParent() != null; n = (CellNode) n.getParent())
{
result.add(n);
@ -135,7 +135,6 @@ public class CellNodeBuffer
result.add(n);
}
}
return result;
}

View File

@ -19,8 +19,10 @@
package com.l2jserver.gameserver.pathfinding.cellnodes;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -48,7 +50,7 @@ public class CellPathFinding extends PathFinding
private int _postFilterPasses = 0;
private long _postFilterElapsed = 0;
private ArrayList<L2ItemInstance> _debugItems = null;
private List<L2ItemInstance> _debugItems = null;
public static CellPathFinding getInstance()
{
@ -119,16 +121,12 @@ public class CellPathFinding extends PathFinding
{
if (_debugItems == null)
{
_debugItems = new ArrayList<>();
_debugItems = new CopyOnWriteArrayList<>();
}
else
{
for (L2ItemInstance item : _debugItems)
{
if (item == null)
{
continue;
}
item.decayMe();
}
@ -136,7 +134,7 @@ public class CellPathFinding extends PathFinding
}
}
ArrayList<AbstractNodeLoc> path = null;
List<AbstractNodeLoc> path = null;
try
{
CellNode result = buffer.findPath(gx, gy, gz, gtx, gty, gtz);
@ -242,9 +240,9 @@ public class CellPathFinding extends PathFinding
return path;
}
private ArrayList<AbstractNodeLoc> constructPath(AbstractNode node)
private List<AbstractNodeLoc> constructPath(AbstractNode node)
{
ArrayList<AbstractNodeLoc> path = new ArrayList<>();
final LinkedList<AbstractNodeLoc> path = new LinkedList<>();
int previousDirectionX = Integer.MIN_VALUE;
int previousDirectionY = Integer.MIN_VALUE;
int directionX, directionY;
@ -278,13 +276,12 @@ public class CellPathFinding extends PathFinding
previousDirectionX = directionX;
previousDirectionY = directionY;
path.add(node.getLoc());
path.addFirst(node.getLoc());
node.setLoc(null);
}
node = node.getParent();
}
return path;
}

View File

@ -225,7 +225,7 @@ public class GeoPathFinding extends PathFinding
short regoffset = getRegionOffset(getRegionX(node_x), getRegionY(node_y));
ByteBuffer pn = _pathNodes.get(regoffset);
List<AbstractNode> Neighbors = new ArrayList<>(8);
List<AbstractNode> neighbors = new ArrayList<>(8);
GeoNode newNode;
short new_node_x, new_node_y;
@ -239,7 +239,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // NE
@ -251,7 +251,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // E
@ -263,7 +263,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // SE
@ -275,7 +275,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // S
@ -287,7 +287,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // SW
@ -299,7 +299,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // W
@ -311,7 +311,7 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
neighbor = pn.get(idx++); // NW
@ -323,11 +323,11 @@ public class GeoPathFinding extends PathFinding
newNode = readNode(new_node_x, new_node_y, neighbor);
if (newNode != null)
{
Neighbors.add(newNode);
neighbors.add(newNode);
}
}
GeoNode[] result = new GeoNode[Neighbors.size()];
return Neighbors.toArray(result);
GeoNode[] result = new GeoNode[neighbors.size()];
return neighbors.toArray(result);
}
// Private