D:/Development/Projects/X-Clone/X-Clone/trunk/MapTile.h

Go to the documentation of this file.
00001 #ifndef XCLONE_MAPTILE_H
00002 #define XCLONE_MAPTILE_H
00003 
00004 #include "includes.h"
00005 
00006 class MapTile;
00007 typedef boost::shared_ptr<MapTile> spMapTile;
00008 typedef boost::weak_ptr<MapTile> wpMapTile;
00009 
00010 #include "Terrain.h"
00011 #include "MapObject.h"
00012 #include "Direction.h"
00013 #include "Unit.h"
00014 
00015 class MapTile
00016 {
00017    public:
00018       static spMapTile makeMapTile(TerrainType type, int x, int y);
00019       ~MapTile();
00020 
00021       bool isPassable() const;
00022       bool isPassable(Direction dir) const;
00023       bool hasObstruction(Direction dir) const;
00024       int getX() const;
00025       int getY() const;
00026       int getScreenX() const;
00027       int getScreenY() const;
00028       int getCenterX() const;
00029       int getCenterY() const;
00030       TerrainType getTerrainType();
00031       static int getWidth();
00032       static int getHeight();
00033 
00034       int getMoveCost(const Direction& dir) const;
00035 
00036       void addTileInDirection( spMapTile tile, const Direction& dir);
00037       spMapTile getTileInDirection( const Direction& dir ) const;
00038 
00039       bool addUnit(spUnit unit);
00040       spUnit getUnit();
00041       void removeUnit();
00042       bool hasUnit() const;
00043 
00044       bool addObject(spMapObject object);
00045       void removeObject(spMapObject object);
00046 
00047       void drawTerrain(Point offset) const;
00048       void drawObjects(Point offset) const;
00049       void highlight(Point offset);
00050       void highlightMoveable(Point offset);
00051 
00052    private:
00053       MapTile(TerrainType type, int x, int y);
00054 
00055       wpMapTile _weak;
00056 
00057       int _x;
00058       int _y;
00059       int _screenX;
00060       int _screenY;
00061       int _centerX;
00062       int _centerY;
00063       static int _width;
00064       static int _height;
00065       
00066       static SDL_Surface* _highlight;
00067       static SDL_Surface* _highlightMove;
00068       Terrain _terrain;
00069       
00070       spUnit _unit;
00071       list<spMapObject> _objects;
00072       map<Direction, spMapTile> directionTileMap;
00073 
00074       static int cardinalMoveBase;
00075       static int diagonalMoveBase;
00076 };
00077 
00078 #endif
00079 

Generated on Fri Sep 22 06:00:26 2006 for X-CLONE by  doxygen 1.4.7