Tabs -> spaces

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@268 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2007-06-26 00:07:47 +00:00
parent 0250be64ac
commit 717dc79c02
32 changed files with 191 additions and 191 deletions
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.cast;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("cast"); new com.samskivert.util.Log("cast");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -63,10 +63,10 @@ public class BuilderModel
*/ */
protected void notifyListeners (int event) protected void notifyListeners (int event)
{ {
int size = _listeners.size(); int size = _listeners.size();
for (int ii = 0; ii < size; ii++) { for (int ii = 0; ii < size; ii++) {
((BuilderModelListener)_listeners.get(ii)).modelChanged(event); ((BuilderModelListener)_listeners.get(ii)).modelChanged(event);
} }
} }
/** /**
@@ -43,8 +43,8 @@ public class BuilderPanel extends JPanel
{ {
setLayout(new VGroupLayout()); setLayout(new VGroupLayout());
// give ourselves a wee bit of a border // give ourselves a wee bit of a border
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH); HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
gl.setOffAxisPolicy(HGroupLayout.STRETCH); gl.setOffAxisPolicy(HGroupLayout.STRETCH);
@@ -42,9 +42,9 @@ public class ComponentPanel extends JPanel
*/ */
public ComponentPanel (BuilderModel model, String cprefix) public ComponentPanel (BuilderModel model, String cprefix)
{ {
setLayout(new VGroupLayout(VGroupLayout.STRETCH)); setLayout(new VGroupLayout(VGroupLayout.STRETCH));
// set up a border // set up a border
setBorder(BorderFactory.createEtchedBorder()); setBorder(BorderFactory.createEtchedBorder());
// add the component editors to the panel // add the component editors to the panel
addClassEditors(model, cprefix); addClassEditors(model, cprefix);
} }
+1 -1
View File
@@ -244,7 +244,7 @@ public class GeomUtil
int row = tileIndex / tilesPerRow; int row = tileIndex / tilesPerRow;
int col = tileIndex % tilesPerRow; int col = tileIndex % tilesPerRow;
// crop the tile-sized image chunk from the full image // crop the tile-sized image chunk from the full image
return new Rectangle( return new Rectangle(
tileWidth*col, tileHeight*row, tileWidth, tileHeight); tileWidth*col, tileHeight*row, tileWidth, tileHeight);
} }
+4 -4
View File
@@ -35,25 +35,25 @@ public class Log
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
public static int getLevel () public static int getLevel ()
+4 -4
View File
@@ -35,24 +35,24 @@ public class Log
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.fine(message); log.fine(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.log(Level.WARNING, t.getMessage(), t); log.log(Level.WARNING, t.getMessage(), t);
} }
} }
@@ -311,16 +311,16 @@ public abstract class FrameManager
*/ */
public static Component getRoot (Component comp, Rectangle rect) public static Component getRoot (Component comp, Rectangle rect)
{ {
for (Component c = comp; c != null; c = c.getParent()) { for (Component c = comp; c != null; c = c.getParent()) {
if (!c.isVisible() || !c.isDisplayable()) { if (!c.isVisible() || !c.isDisplayable()) {
return null; return null;
} }
if (c instanceof Window || c instanceof Applet) { if (c instanceof Window || c instanceof Applet) {
return c; return c;
} }
rect.x += c.getX(); rect.x += c.getX();
rect.y += c.getY(); rect.y += c.getY();
} }
return null; return null;
} }
+4 -4
View File
@@ -36,24 +36,24 @@ public class Log
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.fine(message); log.fine(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.log(Level.WARNING, t.getMessage(), t); log.log(Level.WARNING, t.getMessage(), t);
} }
} }
@@ -113,7 +113,7 @@ public class ImageManager
*/ */
public ImageManager (ResourceManager rmgr, OptimalImageCreator icreator) public ImageManager (ResourceManager rmgr, OptimalImageCreator icreator)
{ {
_rmgr = rmgr; _rmgr = rmgr;
_icreator = icreator; _icreator = icreator;
// create our image cache // create our image cache
@@ -124,33 +124,33 @@ public class OggPlayer extends MusicPlayer
// System.out.println(ee); // System.out.println(ee);
//} //}
AudioFormat audioFormat = AudioFormat audioFormat =
new AudioFormat((float)rate, new AudioFormat((float)rate,
16, 16,
channels, channels,
true, // PCM_Signed true, // PCM_Signed
false // littleEndian false // littleEndian
); );
DataLine.Info info = DataLine.Info info =
new DataLine.Info(SourceDataLine.class, new DataLine.Info(SourceDataLine.class,
audioFormat, audioFormat,
AudioSystem.NOT_SPECIFIED); AudioSystem.NOT_SPECIFIED);
if (!AudioSystem.isLineSupported(info)) { if (!AudioSystem.isLineSupported(info)) {
//System.out.println("Line " + info + " not supported."); //System.out.println("Line " + info + " not supported.");
return; return;
} }
try{ try{
outputLine = (SourceDataLine) AudioSystem.getLine(info); outputLine = (SourceDataLine) AudioSystem.getLine(info);
//outputLine.addLineListener(this); //outputLine.addLineListener(this);
outputLine.open(audioFormat); outputLine.open(audioFormat);
} }
catch (LineUnavailableException ex) { catch (LineUnavailableException ex) {
System.out.println("Unable to open the sourceDataLine: " + ex); System.out.println("Unable to open the sourceDataLine: " + ex);
return; return;
} }
catch (IllegalArgumentException ex) { catch (IllegalArgumentException ex) {
System.out.println("Illegal Argument: " + ex); System.out.println("Illegal Argument: " + ex);
return; return;
} }
frameSizeInBytes = audioFormat.getFrameSize(); frameSizeInBytes = audioFormat.getFrameSize();
@@ -294,7 +294,7 @@ public class OggPlayer extends MusicPlayer
break; // need more data break; // need more data
} }
if (result == -1) { // missing or corrupt data at this page position if (result == -1) { // missing or corrupt data at this page position
// System.err.println("Corrupt or missing data in bitstream; continuing..."); // System.err.println("Corrupt or missing data in bitstream; continuing...");
} else { } else {
os.pagein(og); os.pagein(og);
@@ -172,7 +172,7 @@ public class SpriteManager extends AbstractMediaManager
{ {
for (int ii=0, nn=_sprites.size(); ii < nn; ii++) { for (int ii=0, nn=_sprites.size(); ii < nn; ii++) {
Sprite sprite = _sprites.get(ii); Sprite sprite = _sprites.get(ii);
sprite.paintPath(gfx); sprite.paintPath(gfx);
} }
} }
@@ -185,12 +185,12 @@ public class SpriteManager extends AbstractMediaManager
// */ // */
// protected void handleCollisions () // protected void handleCollisions ()
// { // {
// // gather a list of all sprite collisions // // gather a list of all sprite collisions
// int size = _sprites.size(); // int size = _sprites.size();
// for (int ii = 0; ii < size; ii++) { // for (int ii = 0; ii < size; ii++) {
// Sprite sprite = _sprites.get(ii); // Sprite sprite = _sprites.get(ii);
// checkCollisions(ii, size, sprite); // checkCollisions(ii, size, sprite);
// } // }
// } // }
// //
// /** // /**
@@ -205,35 +205,35 @@ public class SpriteManager extends AbstractMediaManager
// */ // */
// protected void checkCollisions (int idx, int size, Sprite sprite) // protected void checkCollisions (int idx, int size, Sprite sprite)
// { // {
// // TODO: make this handle quickly moving objects that may pass // // TODO: make this handle quickly moving objects that may pass
// // through each other. // // through each other.
// //
// // if we're the last sprite we know we've already handled any // // if we're the last sprite we know we've already handled any
// // collisions // // collisions
// if (idx == (size - 1)) { // if (idx == (size - 1)) {
// return; // return;
// } // }
// //
// // calculate the x-position of the right edge of the sprite we're // // calculate the x-position of the right edge of the sprite we're
// // checking for collisions // // checking for collisions
// Rectangle bounds = sprite.getBounds(); // Rectangle bounds = sprite.getBounds();
// int edgeX = bounds.x + bounds.width; // int edgeX = bounds.x + bounds.width;
// //
// for (int ii = (idx + 1); ii < size; ii++) { // for (int ii = (idx + 1); ii < size; ii++) {
// Sprite other = _sprites.get(ii); // Sprite other = _sprites.get(ii);
// Rectangle obounds = other.getBounds(); // Rectangle obounds = other.getBounds();
// if (obounds.x > edgeX) { // if (obounds.x > edgeX) {
// // since sprites are stored in the list sorted by // // since sprites are stored in the list sorted by
// // ascending x-position, we know this sprite and any // // ascending x-position, we know this sprite and any
// // other sprites farther on in the list can't possibly // // other sprites farther on in the list can't possibly
// // intersect with the sprite we're checking, so we're // // intersect with the sprite we're checking, so we're
// // done. // // done.
// return; // return;
// //
// } else if (obounds.intersects(bounds)) { // } else if (obounds.intersects(bounds)) {
// sprite.notifyObservers(new CollisionEvent(sprite, other)); // sprite.notifyObservers(new CollisionEvent(sprite, other));
// } // }
// } // }
// } // }
// /** The comparator used to sort sprites by horizontal position. */ // /** The comparator used to sort sprites by horizontal position. */
// protected static final Comparator SPRITE_COMP = new SpriteComparator(); // protected static final Comparator SPRITE_COMP = new SpriteComparator();
@@ -241,10 +241,10 @@ public class SpriteManager extends AbstractMediaManager
// /** Used to sort sprites. */ // /** Used to sort sprites. */
// protected static class SpriteComparator<Sprite> implements Comparator // protected static class SpriteComparator<Sprite> implements Comparator
// { // {
// public int compare (Sprite s1, Sprite s2) // public int compare (Sprite s1, Sprite s2)
// { // {
// return (s2.getX() - s1.getX()); // return (s2.getX() - s1.getX());
// } // }
// } // }
@Override // from AbstractMediaManager @Override // from AbstractMediaManager
@@ -29,11 +29,11 @@ public class NoSuchTileSetException extends Exception
{ {
public NoSuchTileSetException (String tileSetName) public NoSuchTileSetException (String tileSetName)
{ {
super("No tile set named '" + tileSetName + "'"); super("No tile set named '" + tileSetName + "'");
} }
public NoSuchTileSetException (int tileSetId) public NoSuchTileSetException (int tileSetId)
{ {
super("No tile set with id '" + tileSetId + "'"); super("No tile set with id '" + tileSetId + "'");
} }
} }
@@ -204,16 +204,16 @@ public class ObjectTileSet extends SwissArmyTileSet
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
super.toString(buf); super.toString(buf);
buf.append(", owidths=").append(StringUtil.toString(_owidths)); buf.append(", owidths=").append(StringUtil.toString(_owidths));
buf.append(", oheights=").append(StringUtil.toString(_oheights)); buf.append(", oheights=").append(StringUtil.toString(_oheights));
buf.append(", xorigins=").append(StringUtil.toString(_xorigins)); buf.append(", xorigins=").append(StringUtil.toString(_xorigins));
buf.append(", yorigins=").append(StringUtil.toString(_yorigins)); buf.append(", yorigins=").append(StringUtil.toString(_yorigins));
buf.append(", prios=").append(StringUtil.toString(_priorities)); buf.append(", prios=").append(StringUtil.toString(_priorities));
buf.append(", zations=").append(StringUtil.toString(_zations)); buf.append(", zations=").append(StringUtil.toString(_zations));
buf.append(", xspots=").append(StringUtil.toString(_xspots)); buf.append(", xspots=").append(StringUtil.toString(_xspots));
buf.append(", yspots=").append(StringUtil.toString(_yspots)); buf.append(", yspots=").append(StringUtil.toString(_yspots));
buf.append(", sorients=").append(StringUtil.toString(_sorients)); buf.append(", sorients=").append(StringUtil.toString(_sorients));
buf.append(", constraints=").append(StringUtil.toString(_constraints)); buf.append(", constraints=").append(StringUtil.toString(_constraints));
} }
// documentation inherited // documentation inherited
@@ -42,7 +42,7 @@ public class SwissArmyTileSet extends TileSet
// documentation inherited // documentation inherited
public int getTileCount () public int getTileCount ()
{ {
return _numTiles; return _numTiles;
} }
/** /**
@@ -135,40 +135,40 @@ public class SwissArmyTileSet extends TileSet
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
super.toString(buf); super.toString(buf);
buf.append(", widths=").append(StringUtil.toString(_widths)); buf.append(", widths=").append(StringUtil.toString(_widths));
buf.append(", heights=").append(StringUtil.toString(_heights)); buf.append(", heights=").append(StringUtil.toString(_heights));
buf.append(", tileCounts=").append(StringUtil.toString(_tileCounts)); buf.append(", tileCounts=").append(StringUtil.toString(_tileCounts));
buf.append(", offsetPos=").append(StringUtil.toString(_offsetPos)); buf.append(", offsetPos=").append(StringUtil.toString(_offsetPos));
buf.append(", gapSize=").append(StringUtil.toString(_gapSize)); buf.append(", gapSize=").append(StringUtil.toString(_gapSize));
} }
// documentation inherited // documentation inherited
protected Rectangle computeTileBounds (int tileIndex) protected Rectangle computeTileBounds (int tileIndex)
{ {
// find the row number containing the sought-after tile // find the row number containing the sought-after tile
int ridx, tcount, ty, tx; int ridx, tcount, ty, tx;
ridx = tcount = 0; ridx = tcount = 0;
// start tile image position at image start offset // start tile image position at image start offset
tx = _offsetPos.x; tx = _offsetPos.x;
ty = _offsetPos.y; ty = _offsetPos.y;
while ((tcount += _tileCounts[ridx]) < tileIndex + 1) { while ((tcount += _tileCounts[ridx]) < tileIndex + 1) {
// increment tile image position by row height and gap distance // increment tile image position by row height and gap distance
ty += (_heights[ridx++] + _gapSize.height); ty += (_heights[ridx++] + _gapSize.height);
} }
// determine the horizontal index of this tile in the row // determine the horizontal index of this tile in the row
int xidx = tileIndex - (tcount - _tileCounts[ridx]); int xidx = tileIndex - (tcount - _tileCounts[ridx]);
// final image x-position is based on tile width and gap distance // final image x-position is based on tile width and gap distance
tx += (xidx * (_widths[ridx] + _gapSize.width)); tx += (xidx * (_widths[ridx] + _gapSize.width));
// Log.info("Computed tile bounds [tileIndex=" + tileIndex + // Log.info("Computed tile bounds [tileIndex=" + tileIndex +
// ", ridx=" + ridx + ", xidx=" + xidx + // ", ridx=" + ridx + ", xidx=" + xidx +
// ", tx=" + tx + ", ty=" + ty + "]."); // ", tx=" + tx + ", ty=" + ty + "].");
// crop the tile-sized image chunk from the full image // crop the tile-sized image chunk from the full image
return new Rectangle(tx, ty, _widths[ridx], _heights[ridx]); return new Rectangle(tx, ty, _widths[ridx], _heights[ridx]);
} }
+2 -2
View File
@@ -145,9 +145,9 @@ public class Tile // implements Cloneable
*/ */
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder("["); StringBuilder buf = new StringBuilder("[");
toString(buf); toString(buf);
return buf.append("]").toString(); return buf.append("]").toString();
} }
/** /**
@@ -145,7 +145,7 @@ public class TileManager
*/ */
public TileSetRepository getTileSetRepository () public TileSetRepository getTileSetRepository ()
{ {
return _setrep; return _setrep;
} }
/** /**
@@ -206,7 +206,7 @@ public class TileManager
* @see TileUtil#getFQTileId * @see TileUtil#getFQTileId
*/ */
public Tile getTile (int fqTileId) public Tile getTile (int fqTileId)
throws NoSuchTileSetException throws NoSuchTileSetException
{ {
return getTile(TileUtil.getTileSetId(fqTileId), return getTile(TileUtil.getTileSetId(fqTileId),
TileUtil.getTileIndex(fqTileId), null); TileUtil.getTileIndex(fqTileId), null);
@@ -219,7 +219,7 @@ public class TileManager
* @see TileUtil#getFQTileId * @see TileUtil#getFQTileId
*/ */
public Tile getTile (int fqTileId, TileSet.Colorizer rizer) public Tile getTile (int fqTileId, TileSet.Colorizer rizer)
throws NoSuchTileSetException throws NoSuchTileSetException
{ {
return getTile(TileUtil.getTileSetId(fqTileId), return getTile(TileUtil.getTileSetId(fqTileId),
TileUtil.getTileIndex(fqTileId), rizer); TileUtil.getTileIndex(fqTileId), rizer);
@@ -235,7 +235,7 @@ public class TileManager
* @return the tile object. * @return the tile object.
*/ */
public Tile getTile (int tileSetId, int tileIndex, TileSet.Colorizer rizer) public Tile getTile (int tileSetId, int tileIndex, TileSet.Colorizer rizer)
throws NoSuchTileSetException throws NoSuchTileSetException
{ {
TileSet set = getTileSet(tileSetId); TileSet set = getTileSet(tileSetId);
return set.getTile(tileIndex, rizer); return set.getTile(tileIndex, rizer);
@@ -86,7 +86,7 @@ public abstract class TileSet
*/ */
public String getName () public String getName ()
{ {
return (_name == null) ? _imagePath : _name; return (_name == null) ? _imagePath : _name;
} }
/** /**
@@ -322,7 +322,7 @@ public abstract class TileSet
protected boolean checkTileIndex (int tileIndex) protected boolean checkTileIndex (int tileIndex)
{ {
int tcount = getTileCount(); int tcount = getTileCount();
if (tileIndex >= 0 && tileIndex < tcount) { if (tileIndex >= 0 && tileIndex < tcount) {
return true; return true;
} else { } else {
Log.warning("Requested invalid tile [tset=" + this + Log.warning("Requested invalid tile [tset=" + this +
@@ -377,9 +377,9 @@ public abstract class TileSet
*/ */
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder("["); StringBuilder buf = new StringBuilder("[");
toString(buf); toString(buf);
return buf.append("]").toString(); return buf.append("]").toString();
} }
/** /**
@@ -422,8 +422,8 @@ public abstract class TileSet
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
buf.append("name=").append(_name); buf.append("name=").append(_name);
buf.append(", path=").append(_imagePath); buf.append(", path=").append(_imagePath);
buf.append(", tileCount=").append(getTileCount()); buf.append(", tileCount=").append(getTileCount());
} }
/** The path to the file containing the tile images. */ /** The path to the file containing the tile images. */
@@ -163,10 +163,10 @@ public class TrimmedObjectTileSet extends TileSet
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
super.toString(buf); super.toString(buf);
buf.append(", ometrics=").append(StringUtil.toString(_ometrics)); buf.append(", ometrics=").append(StringUtil.toString(_ometrics));
buf.append(", bounds=").append(StringUtil.toString(_bounds)); buf.append(", bounds=").append(StringUtil.toString(_bounds));
buf.append(", bits=").append(StringUtil.toString(_bits)); buf.append(", bits=").append(StringUtil.toString(_bits));
buf.append(", zations=").append(StringUtil.toString(_zations)); buf.append(", zations=").append(StringUtil.toString(_zations));
} }
/** /**
@@ -83,7 +83,7 @@ public class TrimmedTile extends Tile
// documentation inherited // documentation inherited
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
buf.append(", tbounds=").append(StringUtil.toString(_tbounds)); buf.append(", tbounds=").append(StringUtil.toString(_tbounds));
} }
/** Our extra trimmed image dimension information. */ /** Our extra trimmed image dimension information. */
@@ -88,8 +88,8 @@ public class UniformTileSet extends TileSet
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
super.toString(buf); super.toString(buf);
buf.append(", width=").append(_width); buf.append(", width=").append(_width);
buf.append(", height=").append(_height); buf.append(", height=").append(_height);
} }
/** The width (in pixels) of the tiles in this tileset. */ /** The width (in pixels) of the tiles in this tileset. */
@@ -86,14 +86,14 @@ public class AStarPathUtil
*/ */
public void considerSteps (int x, int y) public void considerSteps (int x, int y)
{ {
considerStep(x - 1, y - 1, DIAGONAL_COST); considerStep(x - 1, y - 1, DIAGONAL_COST);
considerStep(x, y - 1, ADJACENT_COST); considerStep(x, y - 1, ADJACENT_COST);
considerStep(x + 1, y - 1, DIAGONAL_COST); considerStep(x + 1, y - 1, DIAGONAL_COST);
considerStep(x - 1, y, ADJACENT_COST); considerStep(x - 1, y, ADJACENT_COST);
considerStep(x + 1, y, ADJACENT_COST); considerStep(x + 1, y, ADJACENT_COST);
considerStep(x - 1, y + 1, DIAGONAL_COST); considerStep(x - 1, y + 1, DIAGONAL_COST);
considerStep(x, y + 1, ADJACENT_COST); considerStep(x, y + 1, ADJACENT_COST);
considerStep(x + 1, y + 1, DIAGONAL_COST); considerStep(x + 1, y + 1, DIAGONAL_COST);
} }
protected void considerStep (int x, int y, int cost) protected void considerStep (int x, int y, int cost)
@@ -186,8 +186,8 @@ public class AStarPathUtil
return getNodePath(bestpath); return getNodePath(bestpath);
} }
// no path found // no path found
return null; return null;
} }
/** /**
@@ -197,10 +197,10 @@ public class ArcPath extends TimedPath
gfx.setColor(Color.blue); gfx.setColor(Color.blue);
gfx.drawRect(x, y, width-1, height-1); gfx.drawRect(x, y, width-1, height-1);
gfx.setColor(Color.yellow); gfx.setColor(Color.yellow);
gfx.drawArc(x, y, width-1, height-1, 0, 360); gfx.drawArc(x, y, width-1, height-1, 0, 360);
gfx.setColor(Color.red); gfx.setColor(Color.red);
gfx.drawArc(x, y, width-1, height-1, 360-sangle, -delta); gfx.drawArc(x, y, width-1, height-1, 360-sangle, -delta);
} }
@@ -115,7 +115,7 @@ public class LinePath extends TimedPath
// documentation inherited // documentation inherited
public void paint (Graphics2D gfx) public void paint (Graphics2D gfx)
{ {
gfx.setColor(Color.red); gfx.setColor(Color.red);
gfx.drawLine(_source.x, _source.y, _dest.x, _dest.y); gfx.drawLine(_source.x, _source.y, _dest.x, _dest.y);
} }
@@ -309,16 +309,16 @@ public class LineSegmentPath
// documentation inherited // documentation inherited
public void paint (Graphics2D gfx) public void paint (Graphics2D gfx)
{ {
gfx.setColor(Color.red); gfx.setColor(Color.red);
Point prev = null; Point prev = null;
int size = size(); int size = size();
for (int ii = 0; ii < size; ii++) { for (int ii = 0; ii < size; ii++) {
PathNode n = (PathNode)getNode(ii); PathNode n = (PathNode)getNode(ii);
if (prev != null) { if (prev != null) {
gfx.drawLine(prev.x, prev.y, n.loc.x, n.loc.y); gfx.drawLine(prev.x, prev.y, n.loc.x, n.loc.y);
} }
prev = n.loc; prev = n.loc;
} }
} }
// documentation inherited // documentation inherited
@@ -45,7 +45,7 @@ public class MathUtil
*/ */
public static int distanceSq (int x0, int y0, int x1, int y1) public static int distanceSq (int x0, int y0, int x1, int y1)
{ {
return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0)); return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0));
} }
/** /**
@@ -53,8 +53,8 @@ public class MathUtil
*/ */
public static float distance (int x0, int y0, int x1, int y1) public static float distance (int x0, int y0, int x1, int y1)
{ {
return (float)Math.sqrt(((x1 - x0) * (x1 - x0)) + return (float)Math.sqrt(((x1 - x0) * (x1 - x0)) +
((y1 - y0) * (y1 - y0))); ((y1 - y0) * (y1 - y0)));
} }
/** /**
@@ -70,7 +70,7 @@ public class MathUtil
*/ */
public static String lineToString (int x0, int y0, int x1, int y1) public static String lineToString (int x0, int y0, int x1, int y1)
{ {
return "(" + x0 + ", " + y0 + ") -> (" + x1 + ", " + y1 + ")"; return "(" + x0 + ", " + y0 + ") -> (" + x1 + ", " + y1 + ")";
} }
/** /**
@@ -78,7 +78,7 @@ public class MathUtil
*/ */
public static String lineToString (Point p1, Point p2) public static String lineToString (Point p1, Point p2)
{ {
return lineToString(p1.x, p1.y, p2.x, p2.y); return lineToString(p1.x, p1.y, p2.x, p2.y);
} }
/** /**
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.miso;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("miso"); new com.samskivert.util.Log("miso");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -57,17 +57,17 @@ public class TilePath extends LineSegmentPath
public TilePath (MisoSceneMetrics metrics, Sprite sprite, public TilePath (MisoSceneMetrics metrics, Sprite sprite,
List tiles, int destx, int desty) List tiles, int destx, int desty)
{ {
// constrain destination pixels to fine coordinates // constrain destination pixels to fine coordinates
Point fpos = new Point(); Point fpos = new Point();
MisoUtil.screenToFull(metrics, destx, desty, fpos); MisoUtil.screenToFull(metrics, destx, desty, fpos);
// add the starting path node // add the starting path node
int sx = sprite.getX(), sy = sprite.getY(); int sx = sprite.getX(), sy = sprite.getY();
Point ipos = MisoUtil.screenToTile(metrics, sx, sy, new Point()); Point ipos = MisoUtil.screenToTile(metrics, sx, sy, new Point());
addNode(sx, sy, NORTH); addNode(sx, sy, NORTH);
// TODO: make more visually appealing path segments from start to // TODO: make more visually appealing path segments from start to
// second tile, and penultimate to ultimate tile // second tile, and penultimate to ultimate tile
// add all remaining path nodes excepting the last one // add all remaining path nodes excepting the last one
Point prev = new Point(ipos.x, ipos.y); Point prev = new Point(ipos.x, ipos.y);
@@ -111,8 +111,8 @@ public class TilePath extends LineSegmentPath
dir = MisoUtil.getIsoDirection(prev.x, prev.y, tdestx, tdesty); dir = MisoUtil.getIsoDirection(prev.x, prev.y, tdestx, tdesty);
} }
// add the final destination path node // add the final destination path node
addNode(spos.x, spos.y, dir); addNode(spos.x, spos.y, dir);
} }
/** /**
@@ -69,7 +69,7 @@ public class BaseTileSet extends SwissArmyTileSet
protected void toString (StringBuilder buf) protected void toString (StringBuilder buf)
{ {
super.toString(buf); super.toString(buf);
buf.append(", passable=").append(StringUtil.toString(_passable)); buf.append(", passable=").append(StringUtil.toString(_passable));
} }
/** Whether each tile is passable. */ /** Whether each tile is passable. */
@@ -86,16 +86,16 @@ public class MisoSceneMetrics
slopeX = (float)tilehei / (float)tilewid; slopeX = (float)tilehei / (float)tilewid;
slopeY = -slopeX; slopeY = -slopeX;
// calculate the edge length separating each fine coordinate // calculate the edge length separating each fine coordinate
finelen = tilelen / (float)finegran; finelen = tilelen / (float)finegran;
// calculate the fine-coordinate x-axis line // calculate the fine-coordinate x-axis line
fineSlopeX = (float)tilehei / (float)tilewid; fineSlopeX = (float)tilehei / (float)tilewid;
fineBX = -(fineSlopeX * (float)tilehwid); fineBX = -(fineSlopeX * (float)tilehwid);
fineSlopeY = -fineSlopeX; fineSlopeY = -fineSlopeX;
// calculate the fine coordinate dimensions // calculate the fine coordinate dimensions
finehwid = (int)((float)tilehwid / (float)finegran); finehwid = (int)((float)tilehwid / (float)finegran);
finehhei = (int)((float)tilehhei / (float)finegran); finehhei = (int)((float)tilehhei / (float)finegran);
} }
} }
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.openal;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("narya.openal"); new com.samskivert.util.Log("narya.openal");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.resource;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("resource"); new com.samskivert.util.Log("resource");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }