/*
Tiamat - a role-playing game framework
TileMapData.java - data for TileMap
 
 Copyright  (C) 2004-2005 Hugues Johnson
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.tiamat.graphics;

import java.lang.String;
import java.lang.StringBuffer;

/** TileMapData - data for TileMap
 * @author Hugues Johnson
 */
public class TileMapData{

/* begin public constants */
    /** Tile you walk over with no effect on anything. */
    public final static int TYPE_NORMAL=1;
    /** Tile that exits the map. */
    public final static int TYPE_EXIT=2;
    /** Tile that has some event associated to it. */
    public final static int TYPE_EVENT=4;
    /** Solid tile. */
    public final static int TYPE_SOLID=8; 
    /** Default tile type (TYPE_NORMAL). */
    public final static int DEFAULT_TYPE=TYPE_NORMAL;
/* end public constants */

/* begin public properties */
    //index of tile in array or list of tiles
    private int tile;
    /** 
     * Returns the index of tile in array or list of tiles.
     * @return The index of tile in array or list of tiles.
     */
    public int getTile(){ return(this.tile); }
    /** 
     * Sets the index of tile in array or list of tiles.
     * @param tile The index of tile in array or list of tiles.
     */
    public void setTile(int tile){ this.tile=tile; }
    //one of types defined in public constants
    private int type;
    /**
     * Returns the tile type, one of types defined in public constants.
     * @return The tile type.
     */
    public int getType(){ return(this.type); }
    /**
     * Set the tile type, one of types defined in public constants.
     * @param type One of types defined in public constants.
     */
    public void setType(int type){ this.type=type; }
    //an object that is standing on this tile    
    private Object object;
    /**
     * Retuns the object that is standing on this tile.
     * @return The object that is standing on this tile.
     */
    public Object getObject(){ return(this.object); }
    /**
     * Sets the object that is standing on this tile.
     * @param object The object that is standing on this tile.
     */
    public void setObject(Object object){ this.object=object; }
/* end public properties */
    
/* begin constructors */
    /**
     * Creates a new instance of TileMapData.
     * @param tile The index of tile in array or list of tiles.
     */
    public TileMapData(int tile){
        this.tile=tile;
        this.type=DEFAULT_TYPE;
        this.object=null;        
    }
    /**
     * Creates a new instance of TileMapData.
     * @param tile The index of tile in array or list of tiles.
     * @param type One of types defined in public constants.
     */
    public TileMapData(int tile,int type){
        this.tile=tile;
        this.type=type;
        this.object=null;        
    }
    /**
     * Creates a new instance of TileMapData.
     * @param tile The index of tile in array or list of tiles.
     * @param type One of types defined in public constants.
     * @param object The object that is standing on this tile.
     */
    public TileMapData(int tile,int type,Object object){
        this.tile=tile;
        this.type=type;
        this.object=object;        
    }
/* end constructors */

/* begin public methods */
    /** 
     * Returns a string representation of the object.
     * @return A string representation of the object.
     */
    public String toString(){
        StringBuffer tostring=new StringBuffer(this.getClass().getName());
        tostring.append("\n  tile="+this.tile);
        tostring.append("\n  type="+this.type);
        if(this.object==null){
            tostring.append("\n  object=null");
        } else{
            tostring.append("\n  object="+this.object.toString());
        }
        return(tostring.toString());
    }
/* end public methods */
}