00001 /* $Id$ */ 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 AUTOSLOPE_H 00013 #define AUTOSLOPE_H 00014 00015 #include "company_func.h" 00016 #include "depot_func.h" 00017 #include "tile_map.h" 00018 00033 static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance) 00034 { 00035 if (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new)) return false; 00036 return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new)); 00037 } 00038 00046 static inline bool AutoslopeEnabled() 00047 { 00048 return (_settings_game.construction.autoslope && 00049 (_current_company < MAX_COMPANIES || 00050 (_current_company == OWNER_NONE && _game_mode == GM_EDITOR))); 00051 } 00052 00053 #endif /* AUTOSLOPE_H */