Added the ability to specify one portal in a scene as the "default
entrance." The default entrance is specially highlighted in the scene and can be read from and written to XML scene description files. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@558 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: XMLSceneWriter.java,v 1.17 2001/10/22 18:21:42 shaper Exp $
|
||||
// $Id: XMLSceneWriter.java,v 1.18 2001/10/25 16:36:43 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene.xml;
|
||||
|
||||
@@ -62,6 +62,8 @@ public class XMLSceneWriter extends DataWriter
|
||||
|
||||
dataElement("portals", getPortalData(scene));
|
||||
|
||||
dataElement("entrance", getEntranceData(scene));
|
||||
|
||||
startElement("tiles");
|
||||
for (int lnum = 0; lnum < MisoScene.NUM_LAYERS; lnum++) {
|
||||
writeLayer(scene, lnum);
|
||||
@@ -189,6 +191,23 @@ public class XMLSceneWriter extends DataWriter
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string detailing the location index of the default
|
||||
* entrance portal for the scene, or <code>"-1"</code> if no
|
||||
* default portal is specified or an error occurs.
|
||||
*/
|
||||
protected String getEntranceData (MisoScene scene)
|
||||
{
|
||||
List locs = scene.getLocations();
|
||||
Portal entrance = scene.getEntrance();
|
||||
|
||||
if (locs.size() == 0 || entrance == null) {
|
||||
return "-1";
|
||||
}
|
||||
|
||||
return String.valueOf(locs.indexOf(entrance));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of the tiles at the specified
|
||||
* row and layer in the given scene. Only <code>len</code> tiles
|
||||
|
||||
Reference in New Issue
Block a user