00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_MODEL_GRIDS_SQUAREGRID_H
00023 #define FIFE_MODEL_GRIDS_SQUAREGRID_H
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "util/base/fife_stdint.h"
00034
00035 #include "cellgrid.h"
00036
00037 namespace FIFE {
00038 class SquareGrid: public CellGrid {
00039 public:
00040 SquareGrid(bool allow_diagonals=true);
00041 virtual ~SquareGrid();
00042
00043 const std::string& getType() const;
00044 const std::string& getName() const;
00045 bool isAccessible(const ModelCoordinate& curpos, const ModelCoordinate& target);
00046 double getAdjacentCost(const ModelCoordinate& curpos, const ModelCoordinate& target);
00047 uint32_t getCellSideCount() const { return 4; }
00048 ExactModelCoordinate toMapCoordinates(const ExactModelCoordinate& layer_coords);
00049 ModelCoordinate toLayerCoordinates(const ExactModelCoordinate& map_coord);
00050 ExactModelCoordinate toExactLayerCoordinates(const ExactModelCoordinate& map_coord);
00051 void getVertices(std::vector<ExactModelCoordinate>& vtx, const ModelCoordinate& cell);
00052 CellGrid* clone();
00053
00054 private:
00055 bool isAccessibleDiagonal(const ModelCoordinate& curpos, const ModelCoordinate& target);
00056 };
00057 }
00058
00059 #endif