@@ 93,6 93,7 @@ public class ProposingBody implements Po
ProposingFixture fixture = world.fixturePool.obtain();
fixture.init(this, resultFixture, hash);
+ world.proposings.put(resultFixture, fixture);
return fixture;
}
@@ 21,12 21,14 @@ import com.badlogic.gdx.physics.box2d.Co
import com.badlogic.gdx.physics.box2d.ContactFilter;
import com.badlogic.gdx.physics.box2d.ContactListener;
import com.badlogic.gdx.physics.box2d.DestructionListener;
+import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.Joint;
import com.badlogic.gdx.physics.box2d.JointDef;
import com.badlogic.gdx.physics.box2d.QueryCallback;
import com.badlogic.gdx.physics.box2d.RayCastCallback;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.utils.Array;
+import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.utils.Pools;
import com.esotericsoftware.kryonet.Connection;
@@ 84,6 86,8 @@ public class ProposingWorld extends Upda
/** the WorldUpdater used to apply Updates (internal) */
private final WorldUpdater updater;
+ final ObjectMap<Object, Object> proposings = new ObjectMap<>(5);
+
/** the created Body (internal) */
private volatile Body resultBody;
@@ 134,6 138,7 @@ public class ProposingWorld extends Upda
ProposingBody body = bodyPool.obtain();
body.init(resultBody, hash);
+ proposings.put(resultBody, body);
return body;
}
@@ 151,6 156,9 @@ public class ProposingWorld extends Upda
if(!accepted)
return null;
+// ProposingJoint joint = jointPool.obtain();
+// joint.init(this, resultJoint);
+// proposings.put(resultJoint, joint);
return resultJoint;
}
@@ 182,10 190,13 @@ public class ProposingWorld extends Upda
assert hash != 0;
destruction.setObjectHash(hash);
- boolean accepted = proposeBlocking(destruction, connection);
+ boolean accepted = proposeBlocking(destruction, connection, callback);
Pools.free(destruction);
+ if(accepted)
+ proposings.remove(object);
+
return accepted;
}
@@ 249,6 260,18 @@ public class ProposingWorld extends Upda
public int getBodyCount() {return world.getBodyCount();}
+ public ProposingBody getProposingBody(Body body) {
+ return (ProposingBody) proposings.get(body);
+ }
+
+ public ProposingFixture getProposingFixture(Fixture fixture) {
+ return (ProposingFixture) proposings.get(fixture);
+ }
+
+// public ProposingJoint getProposingJoint(Joint joint) {
+// return (ProposingJoint) proposings.get(joint);
+// }
+
public DualIntMap<Object> getIndex() {
return updater.getIndex();
}