Commit Graph

493 Commits

Author SHA1 Message Date
Ray Greenwell 9cb8f380b0 Now you can have a simple Object hash that understands Hashable keys.
(Because it just uses a Map of your choosing under the hood.)
There is really no new functionality here, but it is neat, except for the one
stupid thing: keys get converted to Strings when iterating with a 'for' loop.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4916 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-21 00:29:04 +00:00
Ray Greenwell d70b867ddb Make null keys work with SortedHashMap.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4914 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-20 21:21:44 +00:00
Ray Greenwell c90e8ef83d First pass at SortedHashMap.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4913 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-20 20:20:04 +00:00
Ray Greenwell 62e8a39e52 Enable idle reporting.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4912 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-19 20:00:36 +00:00
Ray Greenwell dd8fcfc0a7 Allow subclasses to translate the status if a nonstandard one is in use.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4911 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-19 19:14:47 +00:00
Ray Greenwell 2bf1c107d1 Added a simple utility method to initialize an object with properties specified
in an initObject. This is a fairly common practice in flash and let's go ahead
and use it sometimes, even though it's prone to runtime errors.
Our version of this has a defaults Object as well as another Object that can be
specified to mask properties from the initObject.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4908 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-13 23:25:29 +00:00
Ray Greenwell 73ba77af8e Boolean reduction.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4907 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-13 23:21:34 +00:00
Ray Greenwell 4a86621196 Added parseUnsignedInteger.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4906 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-13 23:21:04 +00:00
Robert Zubeck 901cb095ae Weakening the contract on Set.toArray(), to remove the non-modification guarantee from the
resulting array. Users requiring strong non-modification guarantees can manually do a deep or 
a shallow copy of the array, as appropriate for their task.




git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4905 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-10 20:35:45 +00:00
Ray Greenwell dd85d0047e Allow the currently registered ChatFilters to be retrieved.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4904 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-10 03:33:15 +00:00
Ray Greenwell 274811e8f6 Accept an optional Random for shuffle().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4903 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-06 03:34:59 +00:00
Ray Greenwell fcdace5589 Some method documentation.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4902 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-05 02:25:44 +00:00
Ray Greenwell c42510b325 Another place where we call IDataInput's readBytes. Let's just
make sure we never pass it 0 for the length.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4901 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-05 02:11:45 +00:00
Ray Greenwell a920f02030 Found and fixed the "Mother Fucker of a Bug(tm)" that was causing
Zyraxxis to hork.
Deep within our streaming code, ArrayMask objects were being created with
zero length when streaming non-final arrays with a zero length. This tickled
a "feature" of Adobe's IDataInput code, which reads *all available bytes*
if you pass readBytes() a length of 0.
What's really annoying is that this worked fine if you were notified
of the zero-length array via a PropertySetEvent, because that event
would come in on its own frame and so if the array's length was zero then
there were no more bytes to read. But if you entered a game and had
to receive all the usercode properties at once, it booched.
There are clumps of my pulled-out hair all around my desk from that.
And: this is ultimately my own fault, as my old code didn't handle the
case of the passed-in ByteArray having 0 length.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4900 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-05 02:09:59 +00:00
Ray Greenwell 2b5933015e Some documentation.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4899 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-04 03:24:52 +00:00
Ray Greenwell 1b054677c2 Allow ValueEvents to be cancelable.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4898 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-04 03:20:26 +00:00
Tom Conkling 4ad889c106 properly set keyword properties on Set.as
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4897 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-03 21:43:10 +00:00
Tom Conkling 507f214016 whoops - added Set.as to svn
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4896 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-03 21:26:43 +00:00
Tom Conkling c5a557214b ISet -> Set
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4895 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-03 21:22:53 +00:00
Michael Bayne 635bb0a13f Track that we're switching servers so that the client can differentiate during
did logoff between a real logoff and a server switch.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4894 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-03 21:21:50 +00:00
Dave Hoover 289475b253 Keyword substitution.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4893 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-03 21:07:34 +00:00
Tom Conkling 9be9742398 added HashSet and ISet to Narya
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4892 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-12-03 20:42:19 +00:00
Nathan Curtis 362e506fd6 don't need insert - you can add values with ArrayUtil.splice()
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4888 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-30 02:08:13 +00:00
Nathan Curtis 9ddea518fc added an insert method
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4887 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-30 01:54:51 +00:00
Robert Zubeck be0eaf6a22 Make it explicit in the function signature that we're just doing an
"Object == null" comparison. Otherwise the user might pass in an 
undefined, and expect a strict equality test.



git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4886 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-28 02:34:50 +00:00
Par Winzell 195f78376b Haha, there was already one in StringUtil. I was sure I'd checked...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4881 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-24 21:50:54 +00:00
Par Winzell 9a8df29c8e I'm afraid we really do need a hashcode method...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4880 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-24 21:41:53 +00:00
Robert Zubeck 31dbdc78be A simple Flash assert class. Where's a preprocessor when you need one...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4876 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-16 22:56:08 +00:00
Ray Greenwell 376f5e680a Sorry, Log, no more free ride for you.
Putting you at the top level screws up use of another Log class.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4874 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-11-13 09:30:23 +00:00
Par Winzell a30dca8581 Oops, warnings, I guess they don't auto-cast function references to booleans without grumbling. Good for them I suppose.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4859 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-28 15:05:27 +00:00
Par Winzell b7d2bfb1af Another handy adapter.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4858 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-27 18:54:53 +00:00
Ray Greenwell 480abdee8a For primitive types, the coercive casts never fail. Let's be lenient and let
a TypedArray of int work if people fill it with strings like "4" or "9".


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4854 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-24 21:51:32 +00:00
Ray Greenwell 2f4439c64e Made the map work with null as a key.
(Dictionary supports null keys, so we merely call null a 'simple' key.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4848 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-18 23:55:26 +00:00
Andrzej Kapolka 8c4776a3f0 Might as well use a different signifier in case people do want to use
negative indices.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4846 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-18 18:01:49 +00:00
Andrzej Kapolka 924a8a319d That was a fun one to track down. Using an index of -1 for Array.splice
inserts the element just before--not after--the last element.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4845 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-18 01:41:19 +00:00
Michael Bayne a34e500ea6 Added startTransaction() and commitTransaction() to the InvocationDirector so
that EZGame can batch up state change requests which are all invocation service
requests.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4844 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-17 21:33:05 +00:00
Michael Bayne 6b46554eaf Widening.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4843 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-10-17 21:06:17 +00:00
Nathan Curtis 57421c8a58 There are many ways I could rant about this, but I'm going to try to keep it short and
informative (and clean ><)...

While testing the ability to go straight to someone in a game from My Whirled, I was getting 
decoding streaming problems (but only sometimes) when fetching the game data.  After many hours
of looking for the problem and swearing up and down that it was nothing but consistent, malicious 
bitrot, I've tracked it down to this.

In Underwhirled Drift (which is the game I was testing this on), I have a couple of property arrays
that get set when the game is first started up with this:

    _control.set(PLAYER_STATE, new Array(numPlayers));

This allows me to fill in the proper indices at a later time in random order.  This was working
fine for multi-player games, and after what I've discovered here, I think I can get away with 
something simpler, but that can wait for later.

When this was getting encoded, the expected effect would be to encode a TypedArray with a null
in each spot that is defined in the source array (numPlayers long).  In fact, it was creating an
empty, zero length TypedArray.  I'm not sure why - but that was confusing the system somewhere
along the line so that when that set of bytes was read back from the server on another client 
(for instance, when fetching the EZGameObject when trying to join an in-progress game).  Of course,
zero-length TypedArrays should go over the wire just fine, so I'm not entirely convinced that I've
tracked down the entire problem (or if that is in fact the issue, then it needs to be addressed).

The diffs here will cause the encoding and decoding to correctly pull nulls out of the array, and 
put them in the TypedArray.  The moral of this story is to watch out for this construct:

    for each (var obj :Object in arr) {
    }

...it may not always be doing what you would rightfully expect...


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4827 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-09-18 23:29:49 +00:00
Michael Bayne 810969f6f9 Pass a message along with a FailureResponse.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4819 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-22 01:15:39 +00:00
Michael Bayne 9a150ebcda Some widening.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4818 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-22 01:12:02 +00:00
Robert Zubeck 59086147e6 A signed 64-bit integer can be stored as two 32-bit integers in Actionscript, but converting
them to a single number becomes inconvenient for values larger than an single int, and tricky 
when the value is negative (i.e. in two's complement split into two words, with sign bit only
in the high int). 

Instead of splitting a long into two ints, we store it internally as a byte array that corresponds 
exactly to Java's serialized version (sequence of eight bytes, high byte first), and we provide 
accessors to convert to and from Actionscript numbers. This makes Java Long values readable in 
Actionscript, and vice versa.

Unfortunately, Actionscript does not have a native 64-bit integer - the closest equivalent is the 
Number class. Since this is a double float with a 52-bit mantissa, very large long values will 
suffer precision loss during conversion. 




git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4811 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-10 20:49:03 +00:00
Robert Zubeck 77ef41cb42 Separated out chat message listener functionality, and subsequent chat message
processing. This enables subclasses of ChatDirector to listen for their own
types of chat messages, but call the superclass to process them.



git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4810 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-10 20:33:03 +00:00
Michael Bayne 4260a71946 When we call leavePlace() make sure locationDidChange() is dispatched to
listeners letting them know that we're no longer in a location.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4805 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-03 22:40:00 +00:00
Michael Bayne affca34556 Pipe down there little fellas. There seems to be no easy way to not show debug
logging on the console so let's not be uninformatively verbose.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4803 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-02 18:48:45 +00:00
Michael Bayne 0cb497e6ce This ain't overridin' nothin'.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4802 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-01 17:45:19 +00:00
Michael Bayne 010b2fc77a Regenerated from the Java version.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4799 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-01 17:24:26 +00:00
Ray Greenwell 47bace1003 This is tested.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4793 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-07-31 06:50:19 +00:00
Michael Bayne 962326fcaf Revamped the way BodyObject.location is tracked. Now we use an object which can
be extended to contain the sceneId by Whirled (Vilya's Whirled, though also
Whirled Whirled by extension) so that we don't end up with problems where
BodyObject.location changes but BodyObject.sceneId remains stale. This won't
impact Yohoho because the Yohoho client is always in a scene, it uses a
separate mechanism to track games, whereas Whirled's natural usage is to move
between scenes and non-scenes.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4779 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-07-21 00:46:25 +00:00
Michael Bayne 10f606be27 Regenerated services. TypedArray is imported even though it's not used because
our code generation stuff is not the ultra-sophisticated, but we'll cope.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4764 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-07-13 23:54:25 +00:00
Michael Bayne 27c11ce393 Oops, missed this guy.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4763 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-07-13 21:58:09 +00:00