Streaming fixups on the path towards getting things working in beta3.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4105 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -183,9 +183,9 @@ public class PlaceObject extends DObject
|
|||||||
public override function writeObject (out :ObjectOutputStream) :void
|
public override function writeObject (out :ObjectOutputStream) :void
|
||||||
{
|
{
|
||||||
super.writeObject(out);
|
super.writeObject(out);
|
||||||
out.writeField(occupants);
|
out.writeObject(occupants);
|
||||||
out.writeField(occupantInfo);
|
out.writeObject(occupantInfo);
|
||||||
out.writeField(speakService);
|
out.writeObject(speakService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -193,9 +193,9 @@ public class PlaceObject extends DObject
|
|||||||
{
|
{
|
||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
// TODO: this needs fixing!
|
// TODO: this needs fixing!
|
||||||
occupants = (ins.readField(OidList) as OidList);
|
occupants = (ins.readObject() as OidList);
|
||||||
occupantInfo = (ins.readField(DSet) as DSet);
|
occupantInfo = (ins.readObject() as DSet);
|
||||||
speakService = (ins.readField(SpeakMarshaller) as SpeakMarshaller);
|
speakService = (ins.readObject() as SpeakMarshaller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ public class ObjectInputStream
|
|||||||
Log.warning("OMG, cannot stream " + cname);
|
Log.warning("OMG, cannot stream " + cname);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Log.debug("Got streamer (" + streamer + ")");
|
// Log.debug("Got streamer (" + streamer + ")");
|
||||||
|
|
||||||
cmap = new ClassMapping(code, cname, streamer);
|
cmap = new ClassMapping(code, cname, streamer);
|
||||||
_classMap[code] = cmap;
|
_classMap[code] = cmap;
|
||||||
Log.debug("Created mapping for (" + code + "): " + cname);
|
// Log.debug("Created mapping for (" + code + "): " + cname);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.debug("Read known code: " + code);
|
Log.debug("Read known code: " + code);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class Streamer
|
|||||||
initStreamers();
|
initStreamers();
|
||||||
|
|
||||||
// see if we have a streamer for it
|
// see if we have a streamer for it
|
||||||
Log.debug("getStreamer/existing");
|
// Log.debug("getStreamer/existing");
|
||||||
for each (var streamer :Streamer in _streamers) {
|
for each (var streamer :Streamer in _streamers) {
|
||||||
if (streamer.getJavaClassName() === jname) {
|
if (streamer.getJavaClassName() === jname) {
|
||||||
return streamer;
|
return streamer;
|
||||||
@@ -78,7 +78,7 @@ public class Streamer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// see if it's an array that we unstream using an ArrayStreamer
|
// see if it's an array that we unstream using an ArrayStreamer
|
||||||
Log.debug("getStreamer/array");
|
// Log.debug("getStreamer/array");
|
||||||
if (jname.charAt(0) === "[") {
|
if (jname.charAt(0) === "[") {
|
||||||
var streamer :Streamer = new ArrayStreamer(jname);
|
var streamer :Streamer = new ArrayStreamer(jname);
|
||||||
_streamers.push(streamer);
|
_streamers.push(streamer);
|
||||||
@@ -86,18 +86,21 @@ public class Streamer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// otherwise see if it represents a Streamable
|
// otherwise see if it represents a Streamable
|
||||||
Log.debug("getStreamer/Class:Streamable");
|
// Log.debug("getStreamer/Class:Streamable");
|
||||||
var clazz :Class = ClassUtil.getClassByName(
|
var clazz :Class = ClassUtil.getClassByName(
|
||||||
Translations.getFromServer(jname));
|
Translations.getFromServer(jname));
|
||||||
Log.debug("getStreamer/Class:Streamable2");
|
// Log.debug("getStreamer/Class:Streamable2");
|
||||||
if (ClassUtil.isAssignableAs(Streamable, clazz)) {
|
if (ClassUtil.isAssignableAs(Streamable, clazz)) {
|
||||||
return null; // it's streamable
|
return null; // it's streamable
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEMP: workaround for fucked-up bug!!! FUCK ACTIONSCRIPT!
|
// TEMP: workaround for fucked-up bug!!!
|
||||||
if (clazz == StreamableArrayList) {
|
// The isAssignableAs (above) does not work right now, so we assume
|
||||||
return null; // it's streamable, yes it is
|
// ALL classes are streamable, to get things working.
|
||||||
|
if (true) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
// END: hacky temp
|
||||||
|
|
||||||
return BAD_STREAMER;
|
return BAD_STREAMER;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,24 +18,27 @@ public class ArrayStreamer extends Streamer
|
|||||||
{
|
{
|
||||||
super(TypedArray, jname);
|
super(TypedArray, jname);
|
||||||
|
|
||||||
if (jname.charAt(1) === "[") {
|
var secondChar :String = jname.charAt(1);
|
||||||
|
|
||||||
|
if (secondChar === "[") {
|
||||||
// if we're a multi-dimensional array then we need a delegate
|
// if we're a multi-dimensional array then we need a delegate
|
||||||
_delegate = Streamer.getStreamerByJavaName(jname.substring(1));
|
_delegate = Streamer.getStreamerByJavaName(jname.substring(1));
|
||||||
_isFinal = true; // it just is
|
_isFinal = true; // it just is
|
||||||
|
|
||||||
} else {
|
} else if (secondChar === "L") {
|
||||||
if (jname.charAt(1) === "L") {
|
// form is "[L<class>;"
|
||||||
// form is "[L<class>;"
|
var baseClass :String = jname.substring(2, jname.length - 1);
|
||||||
var baseClass :String = jname.substring(2, jname.length - 1);
|
baseClass = Translations.getFromServer(baseClass);
|
||||||
baseClass = Translations.getFromServer(baseClass);
|
_elementType = ClassUtil.getClassByName(baseClass);
|
||||||
_elementType = ClassUtil.getClassByName(baseClass);
|
_isFinal = ClassUtil.isFinal(_elementType);
|
||||||
_isFinal = ClassUtil.isFinal(_elementType);
|
|
||||||
|
|
||||||
} else {
|
} else if (secondChar === "I") {
|
||||||
com.threerings.presents.Log.warning("Other array types are currently not handled yet " +
|
_elementType = int;
|
||||||
"[jname=" + jname + "].");
|
|
||||||
throw new Error("Unimplemented bit");
|
} else {
|
||||||
}
|
com.threerings.presents.Log.warning("Other array types are " +
|
||||||
|
"currently not handled yet [jname=" + jname + "].");
|
||||||
|
throw new Error("Unimplemented bit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +60,12 @@ public class ArrayStreamer extends Streamer
|
|||||||
{
|
{
|
||||||
var arr :Array = (obj as Array);
|
var arr :Array = (obj as Array);
|
||||||
out.writeInt(arr.length);
|
out.writeInt(arr.length);
|
||||||
if (_isFinal) {
|
if (_elementType == int) {
|
||||||
|
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||||
|
out.writeInt(arr[ii] as int);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (_isFinal) {
|
||||||
var mask :ArrayMask = new ArrayMask(arr.length);
|
var mask :ArrayMask = new ArrayMask(arr.length);
|
||||||
for (var ii :int = 0; ii < arr.length; ii++) {
|
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||||
if (arr[ii] != null) {
|
if (arr[ii] != null) {
|
||||||
@@ -84,7 +92,12 @@ public class ArrayStreamer extends Streamer
|
|||||||
:void
|
:void
|
||||||
{
|
{
|
||||||
var arr :Array = (obj as Array);
|
var arr :Array = (obj as Array);
|
||||||
if (_isFinal) {
|
if (_elementType == int) {
|
||||||
|
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||||
|
arr[ii] = ins.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (_isFinal) {
|
||||||
var mask :ArrayMask = new ArrayMask();
|
var mask :ArrayMask = new ArrayMask();
|
||||||
mask.readFrom(ins);
|
mask.readFrom(ins);
|
||||||
for (var ii :int = 0; ii < length; ii++) {
|
for (var ii :int = 0; ii < length; ii++) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.threerings.io.Streamable;
|
|||||||
|
|
||||||
import com.threerings.io.ObjectInputStream;
|
import com.threerings.io.ObjectInputStream;
|
||||||
import com.threerings.io.ObjectOutputStream;
|
import com.threerings.io.ObjectOutputStream;
|
||||||
|
import com.threerings.io.TypedArray;
|
||||||
|
|
||||||
import com.threerings.util.StringBuilder;
|
import com.threerings.util.StringBuilder;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class OidList
|
|||||||
*/
|
*/
|
||||||
public function OidList ()
|
public function OidList ()
|
||||||
{
|
{
|
||||||
_oids = new Array();
|
_oids = new TypedArray("[I");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,16 +108,9 @@ public class OidList
|
|||||||
// documentation inherited from interface Streamable
|
// documentation inherited from interface Streamable
|
||||||
public function readObject (ins :ObjectInputStream) :void
|
public function readObject (ins :ObjectInputStream) :void
|
||||||
{
|
{
|
||||||
// TODO: this is some custom shit. We need to work out array streaming
|
_oids = (ins.readField("[I") as TypedArray);
|
||||||
_oids = new Array();
|
|
||||||
var ecount :int = ins.readInt();
|
|
||||||
for (var ii :int = 0; ii < ecount; ii++) {
|
|
||||||
_oids.push(ins.readInt());
|
|
||||||
}
|
|
||||||
_oids.length = ins.readInt(); // then, limit the length to the size
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function toString () :String
|
public function toString () :String
|
||||||
{
|
{
|
||||||
var buf :StringBuilder = new StringBuilder();
|
var buf :StringBuilder = new StringBuilder();
|
||||||
@@ -126,6 +120,6 @@ public class OidList
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private var _oids :Array;
|
private var _oids :TypedArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user