Refactored loading a bit to fix an issue where objects "steal" fixed client object ids before the client object can be loaded,fixed 2 errors

This commit is contained in:
Light2
2014-03-28 18:22:21 +01:00
parent 1cd2a139db
commit 932302d1e9
5 changed files with 56 additions and 22 deletions
+20 -4
View File
@@ -42,6 +42,8 @@ import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import com.sleepycat.persist.EntityCursor;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.MeshVisitor;
import engine.clientdata.visitors.PortalVisitor;
@@ -58,7 +60,6 @@ import engine.resources.scene.Quaternion;
import engine.resources.scene.quadtree.QuadTree;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
import protocol.swg.ChatFriendsListUpdate;
import protocol.swg.ChatOnChangeFriendStatus;
import protocol.swg.ChatOnGetFriendsList;
@@ -71,7 +72,6 @@ import protocol.swg.UpdateTransformWithParentMessage;
import protocol.swg.objectControllerObjects.DataTransform;
import protocol.swg.objectControllerObjects.DataTransformWithParent;
import protocol.swg.objectControllerObjects.TargetUpdate;
import resources.objects.building.BuildingObject;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
@@ -170,11 +170,27 @@ public class SimulationService implements INetworkDispatch {
public void insertSnapShotObjects() {
List<SWGObject> objectList = new ArrayList<SWGObject>(core.objectService.getObjectList().values());
for(SWGObject obj : objectList) {
if(obj.getParentId() == 0 && obj.isInSnapshot())
if(obj.getParentId() == 0 && (obj.isInSnapshot() || obj.getAttachment("isBuildout") != null))
add(obj, obj.getPosition().x, obj.getPosition().z);
}
}
public void insertPersistentBuildings() {
EntityCursor<BuildingObject> cursor = core.getBuildingODB().getCursor(Long.class, BuildingObject.class);
Iterator<BuildingObject> it = cursor.iterator();
while(it.hasNext()) {
final BuildingObject building = (BuildingObject) core.objectService.getObject(it.next().getObjectID());
if(building == null)
continue;
if(building.getAttachment("hasLoadedServerTemplate") == null)
core.objectService.loadServerTemplate(building);
add(building, building.getPosition().x, building.getPosition().z);
}
}
public void addCollidable(AbstractCollidable collidable, float x, float y) {
collidableQuadTrees.get(collidable.getPlanet().getName()).put(x, y, collidable);
}
@@ -198,7 +214,7 @@ public class SimulationService implements INetworkDispatch {
Vector<SWGObject> childObjects = (Vector<SWGObject>) object.getAttachment("childObjects");
if(childObjects != null) {
addChildObjects(object, childObjects);
//object.setAttachment("childObjects", null);
object.setAttachment("childObjects", null);
}
if(notifyObservers) {
Point3D pos = new Point3D(x, 0, y);