Fixed username member for actionscript. Serialization was completely hosed

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5437 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-10-11 05:17:40 +00:00
parent f1b1a06834
commit a99238faf8
2 changed files with 11 additions and 16 deletions
+4 -15
View File
@@ -33,14 +33,11 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
/** /**
* The basic user object class for Crowd users. Bodies have a username, a location and a status. * The basic user object class for Crowd users. Bodies have a location and a status.
*/ */
public class BodyObject extends ClientObject public class BodyObject extends ClientObject
{ {
// AUTO-GENERATED: FIELDS START // AUTO-GENERATED: FIELDS START
/** The field name of the <code>username</code> field. */
public static const USERNAME :String = "username";
/** The field name of the <code>location</code> field. */ /** The field name of the <code>location</code> field. */
public static const LOCATION :String = "location"; public static const LOCATION :String = "location";
@@ -51,13 +48,6 @@ public class BodyObject extends ClientObject
public static const AWAY_MESSAGE :String = "awayMessage"; public static const AWAY_MESSAGE :String = "awayMessage";
// AUTO-GENERATED: FIELDS END // AUTO-GENERATED: FIELDS END
/**
* The username associated with this body object. This should not be used directly; in general
* {@link #getVisibleName} should be used unless you specifically know that you want the
* username.
*/
public var username :Name;
/** /**
* The oid of the place currently occupied by this body or -1 if they currently occupy no * The oid of the place currently occupied by this body or -1 if they currently occupy no
* place. * place.
@@ -84,8 +74,9 @@ public class BodyObject extends ClientObject
} }
/** /**
* Returns the name that should be displayed to other users and used for * Returns the name that should be displayed to other users. The default is to use
* the chat system. The default is to use {@link #username}. * <code>username</code>.
* @see com.threerings.presents.data.ClientObject#username
*/ */
public function getVisibleName () :Name public function getVisibleName () :Name
{ {
@@ -189,8 +180,6 @@ public class BodyObject extends ClientObject
override public function readObject (ins :ObjectInputStream) :void override public function readObject (ins :ObjectInputStream) :void
{ {
super.readObject(ins); super.readObject(ins);
username = (ins.readObject() as Name);
location = (ins.readObject() as Place); location = (ins.readObject() as Place);
status = ins.readByte(); status = ins.readByte();
awayMessage = (ins.readField(String) as String); awayMessage = (ins.readField(String) as String);
@@ -21,6 +21,8 @@
package com.threerings.presents.data { package com.threerings.presents.data {
import com.threerings.util.Name;
import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.DSet; import com.threerings.presents.dobj.DSet;
import com.threerings.presents.dobj.DSet_Entry; import com.threerings.presents.dobj.DSet_Entry;
@@ -45,6 +47,9 @@ public class ClientObject extends DObject
* switch usernames (and therefore user objects). */ * switch usernames (and therefore user objects). */
public static const CLOBJ_CHANGED :String = "!clobj_changed!"; public static const CLOBJ_CHANGED :String = "!clobj_changed!";
/** The authenticated user name of this client. */
public var username :Name;
/** Used to publish all invocation service receivers registered on /** Used to publish all invocation service receivers registered on
* this client. */ * this client. */
public var receivers :DSet; public var receivers :DSet;
@@ -54,7 +59,7 @@ public class ClientObject extends DObject
*/ */
public function who () :String public function who () :String
{ {
return "(" + getOid() + ")"; return "(" + username + ":" + getOid() + ")";
} }
/** /**
@@ -103,6 +108,7 @@ public class ClientObject extends DObject
override public function readObject (ins :ObjectInputStream) :void override public function readObject (ins :ObjectInputStream) :void
{ {
super.readObject(ins); super.readObject(ins);
username = (ins.readObject() as Name);
receivers = (ins.readObject() as DSet); receivers = (ins.readObject() as DSet);
_permPolicy = (ins.readObject() as PermissionPolicy); _permPolicy = (ins.readObject() as PermissionPolicy);
} }