Fixed reading pathnode files.
This commit is contained in:
parent
6d98405053
commit
70842dfabd
6
trunk/dist/game/config/GeoData.properties
vendored
6
trunk/dist/game/config/GeoData.properties
vendored
@ -9,9 +9,9 @@
|
|||||||
# Default: 0
|
# Default: 0
|
||||||
PathFinding = 0
|
PathFinding = 0
|
||||||
|
|
||||||
# Pathnode directory
|
# Pathnode file directory
|
||||||
# Default: pathnode
|
# Default: pathnode
|
||||||
PathnodeDirectory = pathnode
|
PathnodePath = pathnode
|
||||||
|
|
||||||
# Pathfinding array buffers configuration
|
# Pathfinding array buffers configuration
|
||||||
PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2
|
PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2
|
||||||
@ -57,7 +57,7 @@ ForceGeoData = True
|
|||||||
# Default: -1
|
# Default: -1
|
||||||
CoordSynchronize = -1
|
CoordSynchronize = -1
|
||||||
|
|
||||||
# Geodata files folder
|
# Geodata file directory
|
||||||
GeoDataPath = geodata
|
GeoDataPath = geodata
|
||||||
|
|
||||||
# True: Try to load regions not specified below(won't disturb server startup when file does not exist)
|
# True: Try to load regions not specified below(won't disturb server startup when file does not exist)
|
||||||
|
@ -1137,7 +1137,7 @@ public final class Config
|
|||||||
|
|
||||||
// GeoData Settings
|
// GeoData Settings
|
||||||
public static int PATHFINDING;
|
public static int PATHFINDING;
|
||||||
public static File PATHNODE_DIR;
|
public static Path PATHNODE_PATH;
|
||||||
public static String PATHFIND_BUFFERS;
|
public static String PATHFIND_BUFFERS;
|
||||||
public static float LOW_WEIGHT;
|
public static float LOW_WEIGHT;
|
||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
@ -2880,16 +2880,7 @@ public final class Config
|
|||||||
|
|
||||||
final PropertiesParser geoData = new PropertiesParser(GEODATA_FILE);
|
final PropertiesParser geoData = new PropertiesParser(GEODATA_FILE);
|
||||||
|
|
||||||
try
|
PATHNODE_PATH = Paths.get(Config.DATAPACK_ROOT.getPath() + "/" + geoData.getString("PathnodePath", "pathnode"));
|
||||||
{
|
|
||||||
PATHNODE_DIR = new File(geoData.getString("PathnodeDirectory", "pathnode").replaceAll("\\\\", "/")).getCanonicalFile();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
_log.log(Level.WARNING, "Error setting pathnode directory!", e);
|
|
||||||
PATHNODE_DIR = new File("pathnode");
|
|
||||||
}
|
|
||||||
|
|
||||||
PATHFINDING = geoData.getInt("PathFinding", 0);
|
PATHFINDING = geoData.getInt("PathFinding", 0);
|
||||||
PATHFIND_BUFFERS = geoData.getString("PathFindBuffers", "100x6;128x6;192x6;256x4;320x4;384x4;500x2");
|
PATHFIND_BUFFERS = geoData.getString("PathFindBuffers", "100x6;128x6;192x6;256x4;320x4;384x4;500x2");
|
||||||
LOW_WEIGHT = geoData.getFloat("LowWeight", 0.5f);
|
LOW_WEIGHT = geoData.getFloat("LowWeight", 0.5f);
|
||||||
|
@ -27,7 +27,6 @@ import java.nio.MappedByteBuffer;
|
|||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -399,7 +398,7 @@ public class GeoPathFinding extends PathFinding
|
|||||||
{
|
{
|
||||||
_log.info("Path Engine: - Loading Path Nodes...");
|
_log.info("Path Engine: - Loading Path Nodes...");
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
Files.lines(Paths.get(Config.PATHNODE_DIR.getPath(), "pn_index.txt"), StandardCharsets.UTF_8)
|
Files.lines(Config.PATHNODE_PATH.resolve("pn_index.txt"), StandardCharsets.UTF_8)
|
||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
.filter(l -> !l.isEmpty())
|
.filter(l -> !l.isEmpty())
|
||||||
.forEach(line -> {
|
.forEach(line -> {
|
||||||
@ -434,7 +433,7 @@ public class GeoPathFinding extends PathFinding
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
short regionoffset = getRegionOffset(rx, ry);
|
short regionoffset = getRegionOffset(rx, ry);
|
||||||
File file = new File(Config.PATHNODE_DIR, rx + "_" + ry + ".pn");
|
File file = new File(Config.PATHNODE_PATH.toString(), rx + "_" + ry + ".pn");
|
||||||
_log.info("Path Engine: - Loading: " + file.getName() + " -> region offset: " + regionoffset + " X: " + rx + " Y: " + ry);
|
_log.info("Path Engine: - Loading: " + file.getName() + " -> region offset: " + regionoffset + " X: " + rx + " Y: " + ry);
|
||||||
int node = 0, size, index = 0;
|
int node = 0, size, index = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user