Zones! Scenes can be grouped into zones which are traversed via a
higher-level mechanism. Zones provide zone summaries which can be used to generate maps of the zones on the client. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@727 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// $Id: SceneSummary.java,v 1.1 2001/12/04 00:31:58 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.data;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.threerings.presents.io.Streamable;
|
||||
import com.threerings.presents.io.StreamableUtil;
|
||||
|
||||
/**
|
||||
* The scene summary class is used to provide info about the connected
|
||||
* group of scenes that make up an island. The group of scenes that make
|
||||
* up an island is a self-contained set of scenes, connected with one
|
||||
* another (by portals) but not to any scenes outside the group.
|
||||
*/
|
||||
public class SceneSummary implements Streamable
|
||||
{
|
||||
/** The id of this scene. */
|
||||
public int sceneId;
|
||||
|
||||
/** The name of this scene. */
|
||||
public String name;
|
||||
|
||||
/** The ids of the scenes to which this scene is connected via
|
||||
* portals. */
|
||||
public int[] neighbors;
|
||||
|
||||
/**
|
||||
* Returns the population of this scene summary instance. This is
|
||||
* synchronized because the population can be updated by a background
|
||||
* thread.
|
||||
*/
|
||||
public synchronized int getPopulation ()
|
||||
{
|
||||
return _population;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to set the population of this scene summary instance.
|
||||
*/
|
||||
public synchronized void setPopulation (int population)
|
||||
{
|
||||
_population = population;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
out.writeInt(sceneId);
|
||||
out.writeUTF(name);
|
||||
StreamableUtil.writeInts(out, neighbors);
|
||||
out.writeInt(_population);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
sceneId = in.readInt();
|
||||
name = in.readUTF();
|
||||
neighbors = StreamableUtil.readInts(in);
|
||||
_population = in.readInt();
|
||||
}
|
||||
|
||||
/** The number of people currently occupying this scene. */
|
||||
protected int _population;
|
||||
}
|
||||
Reference in New Issue
Block a user