mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-01 16:12:53 -04:00
See extended.
[fixed] Characters could sometimes walk through buildings due to unsigned object Ids [fixed] Critical networking bugs [fixed] Client crash whenever an object was destroyed [added] Loading of client objects is now multithreaded. [updated] Reworked awareness system(engine). [fixed] lots of other small engine fixes.
This commit is contained in:
@@ -23,7 +23,10 @@ package services;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
|
||||
@@ -115,16 +118,34 @@ public class TerrainService {
|
||||
|
||||
public void loadSnapShotObjects() {
|
||||
|
||||
for(Planet planet : planets) {
|
||||
Map<Planet, Thread> threadMap = new HashMap<Planet, Thread>();
|
||||
|
||||
for(final Planet planet : planets) {
|
||||
|
||||
if(planet.getSnapshotVisitor() != null) {
|
||||
|
||||
core.objectService.loadSnapshotObjects(planet);
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
core.objectService.loadSnapshotObjects(planet);
|
||||
}
|
||||
|
||||
});
|
||||
thread.start();
|
||||
threadMap.put(planet, thread);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// wait for threads to finish loading
|
||||
for(Planet planet : planets) {
|
||||
try {
|
||||
threadMap.get(planet).join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user