From 3e56079a1a4aaa798b5c97ca06b2a5eb63d5bf8a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 18 Jun 2007 19:59:57 +0000 Subject: [PATCH] Use GameDefinition.controller if it is configured. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@318 c613c5cb-e716-0410-b11b-feb51c14d237 --- src/as/com/threerings/ezgame/data/EZGameConfig.as | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/as/com/threerings/ezgame/data/EZGameConfig.as b/src/as/com/threerings/ezgame/data/EZGameConfig.as index 5e60bf9b..df964ab9 100644 --- a/src/as/com/threerings/ezgame/data/EZGameConfig.as +++ b/src/as/com/threerings/ezgame/data/EZGameConfig.as @@ -21,6 +21,7 @@ package com.threerings.ezgame.data { +import com.threerings.util.ClassUtil; import com.threerings.util.Hashable; import com.threerings.util.MessageBundle; import com.threerings.util.StreamableHashMap; @@ -113,6 +114,20 @@ public class EZGameConfig extends GameConfig // from PlaceConfig override public function createController () :PlaceController + { + var controller :String = getGameDefinition().controller; + if (controller == null) { + return createDefaultController(); + } + var c :Class = ClassUtil.getClassByName(controller); + return (new c() as PlaceController); + } + + /** + * Creates the controller to be used if the game definition does not specify a custom + * controller. + */ + protected function createDefaultController () :PlaceController { return new EZGameController(); }