ai_map.cpp

Go to the documentation of this file.
00001 /* $Id: ai_map.cpp 18809 2010-01-15 16:41:15Z rubidium $ */
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 #include "ai_map.hpp"
00013 #include "../../tile_map.h"
00014 
00015 /* static */ bool AIMap::IsValidTile(TileIndex t)
00016 {
00017   return ::IsValidTile(t);
00018 }
00019 
00020 /* static */ TileIndex AIMap::GetMapSize()
00021 {
00022   return ::MapSize();
00023 }
00024 
00025 /* static */ uint32 AIMap::GetMapSizeX()
00026 {
00027   return ::MapSizeX();
00028 }
00029 
00030 /* static */ uint32 AIMap::GetMapSizeY()
00031 {
00032   return ::MapSizeY();
00033 }
00034 
00035 /* static */ int32 AIMap::GetTileX(TileIndex t)
00036 {
00037   if (!::IsValidTile(t)) return -1;
00038   return ::TileX(t);
00039 }
00040 
00041 /* static */ int32 AIMap::GetTileY(TileIndex t)
00042 {
00043   if (!::IsValidTile(t)) return -1;
00044   return ::TileY(t);
00045 }
00046 
00047 /* static */ TileIndex AIMap::GetTileIndex(uint32 x, uint32 y)
00048 {
00049   return ::TileXY(x, y);
00050 }
00051 
00052 /* static */ int32 AIMap::DistanceManhattan(TileIndex t1, TileIndex t2)
00053 {
00054   if (!::IsValidTile(t1) || !::IsValidTile(t2)) return -1;
00055   return ::DistanceManhattan(t1, t2);
00056 }
00057 
00058 /* static */ int32 AIMap::DistanceMax(TileIndex t1, TileIndex t2)
00059 {
00060   if (!::IsValidTile(t1) || !::IsValidTile(t2)) return -1;
00061   return ::DistanceMax(t1, t2);
00062 }
00063 
00064 /* static */ int32 AIMap::DistanceSquare(TileIndex t1, TileIndex t2)
00065 {
00066   if (!::IsValidTile(t1) || !::IsValidTile(t2)) return -1;
00067   return ::DistanceSquare(t1, t2);
00068 }
00069 
00070 /* static */ int32 AIMap::DistanceFromEdge(TileIndex t)
00071 {
00072   if (!::IsValidTile(t)) return -1;
00073   return ::DistanceFromEdge(t);
00074 }

Generated on Sat Apr 17 23:24:45 2010 for OpenTTD by  doxygen 1.6.1