From e1a8bd2cc93f1df24a08f9dede7db2a88bafc8ea Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 12 Feb 2003 05:32:35 +0000 Subject: [PATCH] Added getTileSetId() and getTileIndex(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2257 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/tile/TileUtil.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/media/tile/TileUtil.java b/src/java/com/threerings/media/tile/TileUtil.java index 570f98eaf..5f7079a4c 100644 --- a/src/java/com/threerings/media/tile/TileUtil.java +++ b/src/java/com/threerings/media/tile/TileUtil.java @@ -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); + } }