Added getTileSetId() and getTileIndex().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2257 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-02-12 05:32:35 +00:00
parent 8a430a41aa
commit e1a8bd2cc9
@@ -1,5 +1,5 @@
//
// $Id: TileUtil.java,v 1.4 2003/01/13 22:49:46 mdb Exp $
// $Id: TileUtil.java,v 1.5 2003/02/12 05:32:35 mdb Exp $
package com.threerings.media.tile;
@@ -9,13 +9,27 @@ package com.threerings.media.tile;
public class TileUtil
{
/**
* Generates a fully-qualified tileid given the supplied tileset id
* and tile index. This fully-qualified id can be used to fetch the
* tile from the tileset repository which knows about the supplied
* tileset id.
* Generates a fully-qualified tile id given the supplied tileset id
* and tile index.
*/
public static int getFQTileId (int tileSetId, int tileIndex)
{
return (tileSetId << 16) | tileIndex;
}
/**
* Extracts the tile set id from the supplied fully qualified tile id.
*/
public static int getTileSetId (int fqTileId)
{
return (fqTileId >> 16);
}
/**
* Extracts the tile index from the supplied fully qualified tile id.
*/
public static int getTileIndex (int fqTileId)
{
return (fqTileId & 0xFFFF);
}
}