From 64f68e6c634e98f0ac05b6ec65b00f47acd568fa Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 22 May 2008 15:17:21 +0000 Subject: [PATCH] As much fun as it is to have a function named fuckingCompiler(), let's have the services that require the use of an otherwise unreferenced class or symbol take care of referencing that class or symbol themselves, so that if you use LocationDirector, say, all the needed classes are properly included. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5120 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/chat/client/ChatDirector.as | 4 ++ .../threerings/crowd/client/CrowdClient.as | 46 +++++++++++++++++++ .../crowd/client/LocationDirector.as | 7 ++- .../com/threerings/presents/client/Client.as | 4 ++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/as/com/threerings/crowd/client/CrowdClient.as diff --git a/src/as/com/threerings/crowd/chat/client/ChatDirector.as b/src/as/com/threerings/crowd/chat/client/ChatDirector.as index 294902279..b840d4aff 100644 --- a/src/as/com/threerings/crowd/chat/client/ChatDirector.as +++ b/src/as/com/threerings/crowd/chat/client/ChatDirector.as @@ -51,6 +51,7 @@ import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.util.CrowdContext; import com.threerings.crowd.chat.data.ChatCodes; +import com.threerings.crowd.chat.data.ChatMarshaller; import com.threerings.crowd.chat.data.ChatMessage; import com.threerings.crowd.chat.data.SystemMessage; import com.threerings.crowd.chat.data.TellFeedbackMessage; @@ -97,6 +98,9 @@ public class ChatDirector extends BasicDirector registerCommandHandler(msg, "think", new ThinkHandler()); // registerCommandHandler(msg, "tell", new TellHandler()); registerCommandHandler(msg, "broadcast", new BroadcastHandler()); + + // ensure that the compiler includes these necessary symbols + var i :int = ChatMarshaller.AWAY; } /** diff --git a/src/as/com/threerings/crowd/client/CrowdClient.as b/src/as/com/threerings/crowd/client/CrowdClient.as new file mode 100644 index 000000000..1ab39b69e --- /dev/null +++ b/src/as/com/threerings/crowd/client/CrowdClient.as @@ -0,0 +1,46 @@ +// +// $Id$ +// +// Narya library - tools for developing networked games +// Copyright (C) 2002-2008 Three Rings Design, Inc., All Rights Reserved +// http://www.threerings.net/code/narya/ +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package com.threerings.crowd.client { + +import com.threerings.presents.client.Client; +import com.threerings.presents.net.Credentials; + +import com.threerings.crowd.data.BodyMarshaller; +import com.threerings.crowd.data.CrowdPermissionPolicy; + +/** + * Users of the Crowd services should extend this client so that it can ensure that certain + * ActionScript classes that will arrive over the wire as a result of using basic Crowd services + * will be included in the client. + */ +public class CrowdClient extends Client +{ + public function CrowdClient (creds :Credentials) + { + super(creds); + + // ensure that the compiler includes these necessary symbols + var i :int = BodyMarshaller.SET_IDLE; + var c :Class = CrowdPermissionPolicy; + } +} +} diff --git a/src/as/com/threerings/crowd/client/LocationDirector.as b/src/as/com/threerings/crowd/client/LocationDirector.as index b4a6e81db..813fecaf3 100644 --- a/src/as/com/threerings/crowd/client/LocationDirector.as +++ b/src/as/com/threerings/crowd/client/LocationDirector.as @@ -39,6 +39,7 @@ import com.threerings.presents.dobj.SubscriberAdapter; import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.CrowdCodes; import com.threerings.crowd.data.LocationCodes; +import com.threerings.crowd.data.LocationMarshaller; import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.util.CrowdContext; @@ -66,8 +67,10 @@ public class LocationDirector extends BasicDirector _cctx = ctx; // register for location notifications - _cctx.getClient().getInvocationDirector().registerReceiver( - new LocationDecoder(this)); + _cctx.getClient().getInvocationDirector().registerReceiver(new LocationDecoder(this)); + + // ensure that the compiler includes these necessary symbols + var i :int = LocationMarshaller.LEAVE_PLACE; } /** diff --git a/src/as/com/threerings/presents/client/Client.as b/src/as/com/threerings/presents/client/Client.as index 95a237beb..9a71cfa24 100644 --- a/src/as/com/threerings/presents/client/Client.as +++ b/src/as/com/threerings/presents/client/Client.as @@ -32,6 +32,7 @@ import com.threerings.util.MethodQueue; import com.threerings.presents.client.InvocationService_ConfirmListener; import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.InvocationCodes; +import com.threerings.presents.data.TimeBaseMarshaller; import com.threerings.presents.dobj.DObjectManager; @@ -51,6 +52,9 @@ public class Client extends EventDispatcher public function Client (creds :Credentials) { _creds = creds; + + // ensure that the compiler includes these necessary symbols + var i :int = TimeBaseMarshaller.GET_TIME_OID; } /**