00001 /* $Id: ai_map.hpp 18558 2009-12-20 00:53:22Z smatz $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * OpenTTD 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, version 2. 00006 * OpenTTD 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. 00007 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 00008 */ 00009 00012 #ifndef AI_MAP_HPP 00013 #define AI_MAP_HPP 00014 00015 #include "ai_object.hpp" 00016 #include "../../tile_type.h" 00017 00021 class AIMap : public AIObject { 00022 public: 00023 static const int TILE_INVALID = (int)INVALID_TILE; 00024 00025 static const char *GetClassName() { return "AIMap"; } 00026 00032 static bool IsValidTile(TileIndex tile); 00033 00039 static TileIndex GetMapSize(); 00040 00046 static uint32 GetMapSizeX(); 00047 00053 static uint32 GetMapSizeY(); 00054 00062 static int32 GetTileX(TileIndex tile); 00063 00071 static int32 GetTileY(TileIndex tile); 00072 00081 static TileIndex GetTileIndex(uint32 x, uint32 y); 00082 00092 static int32 DistanceManhattan(TileIndex tile_from, TileIndex tile_to); 00093 00104 static int32 DistanceMax(TileIndex tile_from, TileIndex tile_to); 00105 00116 static int32 DistanceSquare(TileIndex tile_from, TileIndex tile_to); 00117 00124 static int32 DistanceFromEdge(TileIndex tile); 00125 }; 00126 00127 #endif /* AI_MAP_HPP */