Fixed getBytes() exception

Only objects that are in objectList are added to the Quadtree. Prevents
later errors where the quadtree objects would not be found in
objectList. After all such objects should not even be around, but well
...
This commit is contained in:
CharonInferar
2014-10-05 18:48:34 +02:00
parent 8520db18e2
commit e863548182
2 changed files with 57 additions and 0 deletions
+12
View File
@@ -192,6 +192,7 @@ public class SimulationService implements INetworkDispatch {
if(notifyObservers) {
Point3D pos = new Point3D(x, 0, z);
Collection<SWGObject> newAwareObjects = get(object.getPlanet(), x, z, 512);
cleanAwareObjects(newAwareObjects); // Only objects that are in objectList are considered!!!
for(Iterator<SWGObject> it = newAwareObjects.iterator(); it.hasNext();) {
SWGObject obj = it.next();
if((obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance2D(pos) > 200) || obj == object)
@@ -211,6 +212,17 @@ public class SimulationService implements INetworkDispatch {
return success;
}
public void cleanAwareObjects(Collection<SWGObject> newAwareObjects){
Collection<SWGObject> cleanUpObjects = new ArrayList<SWGObject>();
for(Iterator<SWGObject> it = newAwareObjects.iterator(); it.hasNext();) {
SWGObject obj = it.next();
SWGObject objInList = NGECore.getInstance().objectService.getObject(obj.getObjectID());
if (objInList==null)
cleanUpObjects.add(obj);
}
newAwareObjects.removeAll(cleanUpObjects);
}
public void addChildObjects(SWGObject object, Vector<SWGObject> childObjects) {
for(SWGObject childObject : childObjects) {