# autoslope.h

Go to the documentation of this file.

    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 "settings_type.h"
    00016 #include "company_func.h"
    00017 #include "depot_func.h"
    00018 #include "slope_func.h"
    00019
    00034 static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance)
    00035 {
    00036   if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false;
    00037   return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new));
    00038 }
    00039
    00047 static inline bool AutoslopeEnabled()
    00048 {
    00049   return (_settings_game.construction.autoslope &&
    00050           (_current_company < MAX_COMPANIES ||
    00051            (_current_company == OWNER_NONE && _game_mode == GM_EDITOR)));
    00052 }
    00053
    00054 #endif /* AUTOSLOPE_H */