script_map.hpp

Go to the documentation of this file.
00001 /* $Id: script_map.hpp 23614 2011-12-19 20:57:23Z truebrain $ */
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 SCRIPT_MAP_HPP
00013 #define SCRIPT_MAP_HPP
00014 
00015 #include "script_object.hpp"
00016 #include "../../tile_type.h"
00017 
00022 class ScriptMap : public ScriptObject {
00023 public:
00024   static const int TILE_INVALID = (int)INVALID_TILE; 
00025 
00031   static bool IsValidTile(TileIndex tile);
00032 
00038   static TileIndex GetMapSize();
00039 
00045   static uint32 GetMapSizeX();
00046 
00052   static uint32 GetMapSizeY();
00053 
00061   static int32 GetTileX(TileIndex tile);
00062 
00070   static int32 GetTileY(TileIndex tile);
00071 
00080   static TileIndex GetTileIndex(uint32 x, uint32 y);
00081 
00091   static int32 DistanceManhattan(TileIndex tile_from, TileIndex tile_to);
00092 
00103   static int32 DistanceMax(TileIndex tile_from, TileIndex tile_to);
00104 
00115   static int32 DistanceSquare(TileIndex tile_from, TileIndex tile_to);
00116 
00123   static int32 DistanceFromEdge(TileIndex tile);
00124 };
00125 
00126 #endif /* SCRIPT_MAP_HPP */