From fba67a6957aad0e7e39962db77b292d504bda3e0 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 18 Oct 2001 01:40:40 +0000 Subject: [PATCH] Allow username and initial room oid to be forced. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@486 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../micasa/client/ClientController.java | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/micasa/client/ClientController.java b/src/java/com/threerings/micasa/client/ClientController.java index 8a10a5530..0a177511d 100644 --- a/src/java/com/threerings/micasa/client/ClientController.java +++ b/src/java/com/threerings/micasa/client/ClientController.java @@ -1,5 +1,5 @@ // -// $Id: ClientController.java,v 1.7 2001/10/11 04:13:33 mdb Exp $ +// $Id: ClientController.java,v 1.8 2001/10/18 01:40:40 mdb Exp $ package com.threerings.micasa.client; @@ -44,8 +44,11 @@ public class ClientController // _frame.setPanel(_logonPanel); // configure the client with some credentials and logon - String username = "bob" + - ((int)(Math.random() * Integer.MAX_VALUE) % 500); + String username = System.getProperty("username"); + if (username == null) { + username = + "bob" + ((int)(Math.random() * Integer.MAX_VALUE) % 500); + } Credentials creds = new UsernamePasswordCreds(username, "test"); Client client = _ctx.getClient(); client.setCredentials(creds); @@ -75,10 +78,33 @@ public class ClientController // keep the body object around for stuff _body = (BodyObject)client.getClientObject(); - // head to the default lobby to start things off - MiCasaBootstrapData data = (MiCasaBootstrapData) - client.getBootstrapData(); - _ctx.getLocationDirector().moveTo(data.defLobbyOid); + // figure out where to go + int moveOid = -1; + + // hacky hack + String jumpOidStr = System.getProperty("jumpoid"); + if (jumpOidStr != null) { + try { + moveOid = Integer.parseInt(jumpOidStr); + } catch (NumberFormatException nfe) { + Log.warning("Invalid jump oid [oid=" + jumpOidStr + + ", err=" + nfe + "]."); + } + + } else if (_body.location != -1) { + // if we were already in a location, go there + moveOid = _body.location; + + } else { + // otherwise head to the default lobby to start things off + MiCasaBootstrapData data = (MiCasaBootstrapData) + client.getBootstrapData(); + moveOid = data.defLobbyOid; + } + + if (moveOid > 0) { + _ctx.getLocationDirector().moveTo(moveOid); + } } // documentation inherited