Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

AStarTile.h

Go to the documentation of this file.
00001 
00007 #ifndef _ASTARTILE_H_
00008 #define _ASTARTILE_H_
00009 
00010 #include "IsoBomb.h"
00011 
00012 class AStarTile {
00013     
00017 public:
00018 
00022     AStarTile();
00023 
00033     AStarTile( int initX, int initY, int initG, int initH, AStarTile* initParent );
00034 
00038     ~AStarTile();
00039 
00049     void init( int initX, int initY, int initG, int initH, AStarTile* initParent );
00050 
00056     int getF() const;
00057 
00063     int getG() const;
00064 
00070     int getH() const;
00071 
00077     int getX() const;
00078 
00084     int getY() const;
00085 
00091     AStarTile* getParent() const;
00092 
00093 
00094     Point getPoint() const;
00095 
00096 private:
00097 
00098     int g;
00099 
00100     int h;
00101 
00102     int f;
00103 
00104     Point pt;
00105 
00106     AStarTile* parent;
00107 
00108 };
00109 
00115 class AStarTileKey {
00116 
00117 public:
00118 
00124     AStarTileKey( AStarTile* theTile ) : tile(theTile) {
00125         
00126     }
00127 
00131     ~AStarTileKey() {
00132 
00133     }
00134 
00141     bool operator<( const AStarTileKey rhs ) const {
00142         AStarTile* tile2 = rhs.getTile();
00143 
00144         if( tile->getF() == tile2->getF() ) {
00145             if( tile->getX() != tile2->getX() ) {
00146                 return tile->getX() < tile2->getX();
00147             }
00148             else {
00149                 return tile->getY() < tile2->getY();
00150             }
00151         }
00152         else {
00153             return tile->getF() < tile2->getF();
00154         }
00155     }
00156 
00160     bool operator==( const AStarTileKey rhs ) const {
00161         return (tile->getX() == rhs.getTile()->getX()) &&
00162                (tile->getY() == rhs.getTile()->getY());
00163     }
00164     
00170     AStarTile* getTile() const {
00171         return tile;
00172     }
00173 
00174 private:
00175 
00176     AStarTile* tile;
00177     
00178 };
00179 
00180 #endif

Generated on Tue Mar 4 02:29:25 2003 for SuperIsoBomb by doxygen1.2.18